Skip to content

Instantly share code, notes, and snippets.

@Rembane
Last active December 12, 2015 07:19
Show Gist options
  • Save Rembane/4735754 to your computer and use it in GitHub Desktop.
Save Rembane/4735754 to your computer and use it in GitHub Desktop.
This version of Eratosthenes sieve works on infinite lists! :D
-- A simpler version, should give the same output as the former one.
eratosthenes2 (x:[]) = [x]
eratosthenes2 (x:xs) = x:eratosthenes2 [y | y <- xs, (mod y x) /= 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment