Note, when I say "negate", I mean replace all ones with zeroes (i.e. a bitwise negation)
The Thue-Morse sequence goes like 01101001
The way you generate it is:
Start by taking 0. Negate what is left and append it to the end.
So, take 0
. Negate it and add that to the end - 01
Then take that and negate it and add that to the end - 0110
And so on.
Another interesting property of this is that distance between zeros creates an "irrational" and non-repeating string.
So:
0110100110010110
|__|_||__||_|__|
2 1 0 2 01 2 <------------Print this!
Can you write a program that, when input n, will output the first n digits of the string to printed?
This is code golf, so shortest number of bytes wins!