RosettaCodeData/Task/Thue-Morse/Python/thue-morse-4.py

10 lines
226 B
Python

>>> def thue_morse(n):
... (v, i) = ('0', '1')
... for _ in range(0,n):
... (v, i) = (v + i, i + v)
... return v
...
>>> thue_morse(6)
'0110100110010110100101100110100110010110011010010110100110010110'
>>>