ababup1192
4/27/2016 - 6:10 AM

Getting Started - Prime Numbers http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C

import scala.io.StdIn
 
object Main {
  def main(args: Array[String]){
    val N = StdIn.readInt()
    val inputs = (0 to N-1).map(_ => StdIn.readInt)
    println(inputs.filter{i =>
      (2 to Math.sqrt(i).toInt).forall(i % _ != 0)}.length)
  }
}