import scala.io.StdIn object Problem211 { def proc(k: Int): Double = { val prime = Seq(2, 3, 5, 7, 11, 13) val composite = Seq(4, 6, 8, 9, 10, 12) val allPatterns = for { p <- prime c <- composite } yield { p * c } allPatterns.count(_ == k) / allPatterns.length.toDouble } def main(args: Array[String]) { val k = StdIn.readInt() val result: Double = proc(k) println(result) } }