Anonymous user
Thue-Morse: Difference between revisions
m
→using in-line code: used a template for the output section, added whitespace.
m (→using functions: used a template for the output section.) |
m (→using in-line code: used a template for the output section, added whitespace.) |
||
Line 1,498:
<lang rexx>/*REXX pgm generates & displays the Thue─Morse sequence up to the Nth term (inclusive). */
parse arg N . /*obtain the optional argument from CL.*/
if N=='' | N=="," then N=
$= /*the Thue─Morse sequence (so far). */
do j=0 to N /*generate sequence up to the Nth item.*/
$= $ || length( space( translate( x2b( d2x(j) ), , 0), 0)
end /*j*/
say $ /*stick a fork in it, we're all done. */</lang>
===using 2's complement===
|