EKG sequence convergence: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added code to align the integers in the sequences.) |
m (→{{header|REXX}}: changed two comments.) |
||
Line 415: | Line 415: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
<lang rexx>/*REXX program can generate and display several EKG sequences (with various starts).*/ |
<lang rexx>/*REXX program can generate and display several EKG sequences (with various starts).*/ |
||
parse arg nums start /*obtain optional |
parse arg nums start /*obtain optional arguments from the CL*/ |
||
if nums=='' | nums=="," then nums= 30 /*Not specified? Then use the default.*/ |
if nums=='' | nums=="," then nums= 30 /*Not specified? Then use the default.*/ |
||
if start= '' | start= "," then start=2 5 7 9 10 /* " " " " " " */ |
if start= '' | start= "," then start=2 5 7 9 10 /* " " " " " " */ |
||
Line 438: | Line 438: | ||
if j==9 then iterate; call add_ /*skip ÷ 9; add to list.*/ |
if j==9 then iterate; call add_ /*skip ÷ 9; add to list.*/ |
||
end /*k*/ |
end /*k*/ |
||
/* |
/*↓ skips multiples of 3*/ |
||
do y=0 by 2; j= j + 2 + y//4 /*increment J by 2 or 4.*/ |
do y=0 by 2; j= j + 2 + y//4 /*increment J by 2 or 4.*/ |
||
parse var j '' -1 r; if r==5 then iterate /*divisible by five ? */ |
parse var j '' -1 r; if r==5 then iterate /*divisible by five ? */ |