Anonymous user
Substring primes: Difference between revisions
m
→{{header|REXX}}: changed some comments, simplified the code.
(Added Sidef) |
m (→{{header|REXX}}: changed some comments, simplified the code.) |
||
Line 464:
say ' index │'center(title, 1 + cols*(w+1) ) /*display the title of the output. */
say '───────┼'center("" , 1 + cols*(w+1), '─') /* " " separator " " " */
found= 0; idx= 1 /*
$= /*a list of substring primes (so far). */
do j=1 for #; x= @.j; x2= substr(x, 2) /*search for primes that fit criteria. */
Line 476:
end /*k*/
found= found + 1 /*bump the number of
if found//cols\==0 then iterate /*have we populated a line of output? */
say center(idx, 7)'│' substr($, 2); $= /*display what we have so far (cols). */
Line 501 ⟶ 499:
if j// 3==0 then iterate /*" " " 3? */
if j// 7==0 then iterate /*" " " 7? */
do k=5 while s.k<=j /* [↓] divide by the known odd primes.*/
if j // @.k == 0 then iterate j /*Is J ÷ X? Then not prime. ___ */
|