Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created August 1, 2012 04:22
Show Gist options
  • Save rhysd/3223663 to your computer and use it in GitHub Desktop.
Save rhysd/3223663 to your computer and use it in GitHub Desktop.
main = print $ sum . filter isPrime $ [2..2000000]
where
isPrime n = null $ filter (\x->n `mod` x==0) [2..floor $ sqrt $ fromIntegral n]
-- 142913828922 ( 11.21s with Core i5, 4G Mem )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment