Task

Create a Thue-Morse sequence.



See also
   YouTube entry: The Fairest Sharing Sequence Ever
   YouTube entry: Math and OCD - My story with the Thue-Morse sequence
   Task: Fairshare between two and more


import extensions;
import system'text;
 
sequence(int steps)
{
    var sb1 := TextBuilder.load("0");
    var sb2 := TextBuilder.load("1"); 
    for(int i := 0, i < steps, i += 1)
    {
        var tmp := sb1.Value;
        sb1.write(sb2);
        sb2.write(tmp)
    };
    console.printLine(sb1).readLine()
}
 
public program()
{
    sequence(6)
}