Jump to content

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=80 80 /*Not specified? Then use the default.*/
$= /*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) ) // 2 /*append to $.*/
end /*j*/
say $ /*stick a fork in it, we're all done. */</lang>
'''{{out|output''' |text=&nbsp; is identical to the 1<sup>st</sup> REXX version.}} <br>
 
===using 2's complement===
Cookies help us deliver our services. By using our services, you agree to our use of cookies.