Skip to content

Instantly share code, notes, and snippets.

@oskimura
Created September 28, 2010 09:04
Show Gist options
  • Save oskimura/600655 to your computer and use it in GitHub Desktop.
Save oskimura/600655 to your computer and use it in GitHub Desktop.
{--
素数の求めかたはこちらを参考にしました
http://haskell.g.hatena.ne.jp/nobsun/20060617/p1
--}
primes = 2:filter prime [3..]
prime n = all ((0/=) . mod n) $ takeWhile ((n>=) . s (*) id) primes
s f g x = f x (g x)
euler10 = sum . takeWhile (<=2000000) $ primes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment