Created
August 21, 2016 12:17
-
-
Save bradyt/7db45a92f31b088111be1bcc610545f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 :: ([Int], [Int]) -> ([Int], [Int]) | |
sieve p=if (null (snd p)) | |
then p | |
else sieve ( fst p ++ [ head $ snd p ] | |
, filter (\n -> (/=0) $ mod n $ head $ snd p ) $ tail $ snd p ) | |
sieven :: Int -> [Int] | |
sieven n = fst $ sieve ([2], [3,5..n]) | |
list20k = sieven 20000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment