Anonymous user
Ludic numbers: Difference between revisions
m
→{{header|REXX}}: changed output format, optimized the function to be about twice as fast.
m (→{{header|Haskell}}: concat . map -> concatMap, (and dropped a couple of redundant $)) |
m (→{{header|REXX}}: changed output format, optimized the function to be about twice as fast.) |
||
Line 2,889:
say 'The first ' N " ludic numbers: " ludic(n) /*display title for what's coming next.*/
say
say "
▲$=ludic(-triples) 0 0; #=0; @=
say
do j=1 for words($); _=word($,j) /*it is known that ludic _ exists. */
if _>=triples then leave /*only process up to a specific number.*/
if wordpos(_+2, $)==0 | wordpos(_+6, $)==0 then iterate /*Not triple? Skip it.*/
#=#+1; @=@ '◄'_ _+2 _+6"► "
end /*j*/ /* [↑] append the found triple ──► @ */
Line 2,903 ⟶ 2,902:
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
ludic: procedure; parse arg m,
@=@' ';
end /*while*/ /* [↑] done eliding ludic numbers. */
Some older REXXes don't have a '''changestr''' BIF, so one is included here ──► [[CHANGESTR.REX]].
<br><br>
Line 2,926 ⟶ 2,921:
The first 25 ludic numbers: 1 2 3 5 7 11 13 17 23 25 29 37 41 43 47 53 61 67 71 77 83 89 91 97 107
▲The 2000 to 2005 ludic numbers are: 21475 21481 21487 21493 21503 21511
From 1──►249, 8 triples found: ◄1 3 7► ◄5 7 11► ◄11 13 17► ◄23 25 29► ◄41 43 47► ◄173 175 179► ◄221 223 227► ◄233 235 239►
|