Skip to content

Instantly share code, notes, and snippets.

@daiksy
Created November 22, 2012 17:46
Show Gist options
  • Save daiksy/4132353 to your computer and use it in GitHub Desktop.
Save daiksy/4132353 to your computer and use it in GitHub Desktop.
Project Euler Problem 10
/**
* http://projecteuler.net/problem=10
* http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2010
*/
def isPrime(n: Long) = Iterator.from(2).takeWhile(p => p * p <= n).forall(p => n % p != 0)
def xs = 2L until 2000000L
val ret = xs filter isPrime sum
println(ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment