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


sub complement
{
    my $s = shift;
 
    $s =~ tr/01/10/;
 
    return $s;
}
 
my $str = '0';
 
for (0..6) {
    say $str;
    $str .= complement($str);
}
 