Guest User

Untitled

a guest
Feb 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import Data.List
  2. s = 120000
  3. numberPool :: [Int]
  4. numberPool = [1,3..s]
  5.  
  6. sieveHelper n x = x `mod` n == 0 && not (n == x)
  7. sieve (x:xs)
  8. | x < truncate ((sqrt . fromIntegral) s) = x : sieve (filter (not . sieveHelper x) (xs))
  9. | otherwise = x:xs
  10.  
  11.  
  12. main = do
  13. putStrLn (show ( last (take 10001 (sieve numberPool))))
Add Comment
Please, Sign In to add comment