Smarandache prime-digital sequence: Difference between revisions

m
Line 667:
smarandache = [2,3,5,7] <> s [2,3,5,7] >>= \x -> guard (isPrime x) >> [x]
where
fs gxs = gr <>>= \x -> [x*10+2, x*10+3,s x*10+5,r x*10+7]
s xswhere r = rxs <>>= s\x r-> where[x*10+2, rx*10+3, =x*10+5, f xsx*10+7]
 
nextSPDSTerms :: [Int] -> [(String, String)]
Line 687:
mapM_ (uncurry (printf "The %8sth SPDS: %15s\n")) $
nextSPDSTerms [100, 1_000, 10_000, 100_000]
where f = show . take 25</lang>
where
f = show . take 25</lang>
{{out}}
<pre>
Anonymous user