Created
October 30, 2008 21:58
-
-
Save astro/21156 to your computer and use it in GitHub Desktop.
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
is_prime 1 = False | |
is_prime 2 = True | |
is_prime x = not (any (\n -> x `rem` n == 0) [2..(x `div` 2)]) | |
primes = [x | x <- [1..], is_prime x] | |
primes_until n = takeWhile (<= n) primes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment