Skip to content

Instantly share code, notes, and snippets.

@gilesbradshaw
Created December 2, 2015 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilesbradshaw/121f7b5c109d3d762aa6 to your computer and use it in GitHub Desktop.
Save gilesbradshaw/121f7b5c109d3d762aa6 to your computer and use it in GitHub Desktop.
primes :: [Int]
primes = sieve [2..]
sieve :: [Int] -> [Int]
sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /=0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment