Thue-Morse: Difference between revisions
Content added Content deleted
(Created page with "{{draft task}}Make [http://en.wikipedia.org/wiki/Thue%E2%80%93Morse_sequence Thue-Morse sequence]. =={{header|AWK}}== <lang AWK>BEGIN{print x="0"};{gsub(/./," &",x);gsub(/ 0/...") |
mNo edit summary |
||
Line 2: | Line 2: | ||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
<lang AWK>BEGIN{print x="0"} |
<lang AWK>BEGIN{print x="0"} |
||
{gsub(/./," &",x);gsub(/ 0/,"01",x);gsub(/ 1/,"10",x);print x}</lang> |
|||
=={{header|SQL}}== |
=={{header|SQL}}== |
Revision as of 01:21, 20 September 2015
Thue-Morse is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Make Thue-Morse sequence.
AWK
<lang AWK>BEGIN{print x="0"} {gsub(/./," &",x);gsub(/ 0/,"01",x);gsub(/ 1/,"10",x);print x}</lang>
SQL
This example is using SQLite. <lang SQL>with recursive a(a) as (select '0' union all select replace(replace(hex(a),30,'01'),31,'10') from a) select * from a;</lang>