Created
December 21, 2013 15:13
-
-
Save missett/8070630 to your computer and use it in GitHub Desktop.
Haskell implementation of the Sieve of Eratosthenes algorithm for finding prime numbers.
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 :: [Integer] -> [Integer] | |
sieve [] = [] | |
sieve (x:xs) | |
| x < 2 = sieve xs | |
| otherwise = x : sieve (filter (\n -> n `mod` x /= 0) xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment