EKG sequence convergence: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: added the REXX computer programming language.)
m (→‎{{header|REXX}}: added code to align the integers in the sequences.)
Line 420:
 
do s=1 for words(start); $= /*step through the specified STARTs. */
second= word(start, s); say /*obtain the second intergerinteger in the seq.*/
 
do j=1 for nums
if j<3 then do; #=1; if j==2 then #=second; end /*handle 1st & 2nd number*/
else #= ekg(#)
$= $ right(#, max(2, length(#) ) ) /*append the EKG integer to the $ list.*/
end /*j*/ /* [↑] the RIGHT BIF aligns the numbers*/
say '(start' right(second, max(2, length(second) ) )"):" $ /*display the EKG sequence to terminalseq.*/
end /*s*/
exit /*stick a fork in it, we're all done. */
Line 455:
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
(start 2): 1 2 4 6 3 9 12 8 10 5 15 18 14 7 21 24 16 20 22 11 33 27 30 25 35 28 26 13 39 36
 
(start 5): 1 5 10 4 6 3 9 12 8 14 7 21 15 18 16 20 22 11 33 24 26 13 39 27 30 25 35 28 32 34
 
(start 7): 1 7 14 4 6 3 9 12 8 10 5 15 18 16 20 22 11 33 21 24 26 13 39 27 30 25 35 28 32 34
 
(start 9): 1 9 3 6 4 8 10 5 15 12 14 7 21 18 16 20 22 11 33 24 26 13 39 27 30 25 35 28 32 34
 
(start 10): 1 10 4 6 3 9 12 8 14 7 21 15 5 20 16 18 22 11 33 24 26 13 39 27 30 25 35 28 32 34
</pre>