Cuban primes: Difference between revisions

Content added Content deleted
Line 1,014: Line 1,014:


cubans :: [Int]
cubans :: [Int]
cubans = [1..] >>= \x -> [(succ x ^ 3) - (x ^ 3)] >>= \r -> guard (isPrime r) >> [r]
cubans = filter isPrime . map (\x -> (succ x ^ 3) - (x ^ 3)) $ [1..]


main :: IO ()
main :: IO ()