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.

4 Steps 1 min read Easy

Step-by-Step Guide

  1. 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. ,
  2. Step 2: Calculate each subsequent element one at a time

  3. Step 3: starting from t1.

  4. 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

G

George Long

Creates helpful guides on creative arts to inspire and educate readers.

38 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: