Created
November 22, 2012 17:46
-
-
Save daiksy/4132353 to your computer and use it in GitHub Desktop.
Project Euler Problem 10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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