Anonymous user
Prime triplets: Difference between revisions
m
→{{header|REXX}}: optimized and simplified some code.
(→{{header|REXX}}: added the computer programming language REXX.) |
m (→{{header|REXX}}: optimized and simplified some code.) |
||
Line 129:
Tprimes= 0; idx= 1 /*initialize # prime triplets & index.*/
$= /*a list of prime triplets (so far). */
do j=1 to lim
p6= p2 + 4; if \!.p6 then iterate /* " P6 " " " " " */
Tprimes= Tprimes + 1 /*bump the number of prime triplets. */
if cols==0
@@@= commas(@.j)__ commas(p2)__ commas(p6) /*add commas & blanks to prime triplet.*/
$= $ left( '('@@@")", w) /*add a prime triplet ──► the $ list.*/
if Tprimes//cols\==0
say center(idx, 7)'│' strip(substr($, 2), 'T'); $= /*show what we have so far.*/
idx= idx + cols /*bump the index count for the output*/
|