Jump to content

Thue-Morse: Difference between revisions

m
→‎using 2's complement: added whitespace, used a template for the output section.
m (→‎using in-line code: used a template for the output section, added whitespace.)
m (→‎using 2's complement: added whitespace, used a template for the output section.)
Line 1,513:
parse arg N . /*obtain the optional argument from CL.*/
if N=='' | N=="," then N=6 /*Not specified? Then use the default.*/
$=0 0 /*the Thue─Morse sequence (so far). */
do j=1 for N /*generate sequence up to the Nth item.*/
$= $ || translate($, 10, 01) /*append $'s complement to $ string.*/
end /*j*/
say $ /*stick a fork in it, we're all done. */</lang>
'''{{out|output''' |text=&nbsp; when using the default input:}}
<pre>
0110100110010110100101100110100110010110011010010110100110010110
Cookies help us deliver our services. By using our services, you agree to our use of cookies.