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


class ThueMorse {
  function : Main(args : String[]) ~ Nil {
    Sequence(6);
  }
 
  function : Sequence(steps : Int) ~ Nil {
    sb1 := "0";
    sb2 := "1";
    for(i := 0; i < steps; i++;) {
      tmp := String->New(sb1);
      sb1 += sb2;
      sb2 += tmp;
    };
    sb1->PrintLine();
  }
}
 