How to Generate the Thue Morse Sequence
Start with 0 as the first element of the sequence (element t); , Calculate each subsequent element one at a time, starting from t1., Repeat step 2 to determine as many digits of the sequence as you like.
Step-by-Step Guide
-
Step 1: Start with 0 as the first element of the sequence (element t);
To calculate the nth element:
Convert n to the binary format.
For example, 5 becomes 101 Count the number of 1s in the binary format of n.
For example, 5 has 2 "1"s in its binary representation Determine the digit at position n by setting it to 1 if the number of "1"s is odd and 0 if the number of "1"s is even. , -
Step 2: Calculate each subsequent element one at a time
-
Step 3: starting from t1.
-
Step 4: Repeat step 2 to determine as many digits of the sequence as you like.
Detailed Guide
To calculate the nth element:
Convert n to the binary format.
For example, 5 becomes 101 Count the number of 1s in the binary format of n.
For example, 5 has 2 "1"s in its binary representation Determine the digit at position n by setting it to 1 if the number of "1"s is odd and 0 if the number of "1"s is even. ,
About the Author
George Long
Creates helpful guides on creative arts to inspire and educate readers.
Rate This Guide
How helpful was this guide? Click to rate: