Anonymous user
Cuban primes: Difference between revisions
m
→{{header|Haskell}}
Line 856:
cubans :: [Int]
cubans = [1..] >>= \x -> [(succ x ^ 3) - (x ^ 3)] >>= \r -> guard (isPrime r) >> [r]
thousands = reverse . intercalate "," . chunksOf 3 . reverse . show▼
main :: IO ()
Line 865 ⟶ 862:
printf "\nThe 100,000th cuban prime is: %10s\n" $ thousands $ cubans !! 99999
where
rows = chunksOf 10 . take 200
▲ thousands = reverse . intercalate "," . chunksOf 3 . reverse . show</lang>
{{out}}
<pre>
|