Skip to content

Instantly share code, notes, and snippets.

@daewon
Last active December 18, 2015 13:29
Show Gist options
  • Save daewon/5790362 to your computer and use it in GitHub Desktop.
Save daewon/5790362 to your computer and use it in GitHub Desktop.
Euler 프로젝트 실습 10번
def isPrime(n: Long) = (2L to math.sqrt(n).toInt).forall(n % _ != 0)
// val sum = (2L to 2000000L).filter(isPrime).sum
val sum = 2 + (3L to 2000000L by 2).filter(isPrime).sum
assert(sum == 142913828922L)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment