Last active
December 17, 2015 21:49
-
-
Save onemouth/5677760 to your computer and use it in GitHub Desktop.
Sieve of Eratosthenes
This file contains 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
sieve [] = [] | |
sieve (x:xs) = x: sieve notMutipleOfX | |
where notMutipleOfX = filter (\n -> n `mod` x /= 0 ) xs | |
primes = sieve [2..] | |
main = print $ take 5000 primes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment