Smarandache prime-digital sequence: Difference between revisions
Content added Content deleted
Line 667: | Line 667: | ||
smarandache = [2,3,5,7] <> s [2,3,5,7] >>= \x -> guard (isPrime x) >> [x] |
smarandache = [2,3,5,7] <> s [2,3,5,7] >>= \x -> guard (isPrime x) >> [x] |
||
where |
where |
||
s xs = r <> s r |
|||
where r = xs >>= \x -> [x*10+2, x*10+3, x*10+5, x*10+7] |
|||
nextSPDSTerms :: [Int] -> [(String, String)] |
nextSPDSTerms :: [Int] -> [(String, String)] |
||
Line 687: | Line 687: | ||
mapM_ (uncurry (printf "The %8sth SPDS: %15s\n")) $ |
mapM_ (uncurry (printf "The %8sth SPDS: %15s\n")) $ |
||
nextSPDSTerms [100, 1_000, 10_000, 100_000] |
nextSPDSTerms [100, 1_000, 10_000, 100_000] |
||
⚫ | |||
where |
|||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> |