Created
September 11, 2019 20:09
-
-
Save leogao2/c7dc0230d44ea87e5730f11a1037fda7 to your computer and use it in GitHub Desktop.
Haskell prime numbers (inefficient)
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
p :: (Integral a) => a -> Bool | |
p 2 = True | |
p x = not (any id (map (==0) (map (mod x) (filter p [2..x-1])))) | |
main = do print (take 10 (filter p [2..])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment