{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Description\n\nThe *Thue–Morse sequence* is the binary [[sequence|0G9EKM0E15]] $(t_n)_{n \\ge 0}$ given by $t_0 = 0$, $t_{2n} = t_n$ and $t_{2n+1} = 1 - t_n$.\nEquivalently, $t_n$ is $0$ if the binary expansion of $n$ has an even number of digits $1$, and $1$ otherwise.\nIts first sixteen terms are\n$$0110\\,1001\\,1001\\,0110.$$\n\n## Remarks\n\nCheck: $t_5 = 0$ because $5 = 101_2$ has two digits $1$, and $t_7 = 1$ because $7 = 111_2$ has three.\n\nThe sequence is the fixed point, starting with $0$, of the morphism $\\mu$ of words with $\\mu(0) = 01$ and $\\mu(1) = 10$.\nSo the first $2^{m+1}$ terms are the first $2^m$ terms followed by their complement, where $0$ and $1$ are swapped.\n\nThe sequence is overlap-free: it has no factor of the form $a x a x a$, where $a$ is a letter and $x$ is a word.\nIn particular it has no factor of the form $u u u$ with $u$ nonempty.\nThue proved overlap-freeness, and it makes the sequence a basic example in [[combinatorics on words|YJ961M051W]].\nIt is not periodic, and it is a $2$-automatic sequence, computed by a finite automaton that reads $n$ in base $2$.\n\n## Explanations\n\n### L1 human\n\nStart with $0$, and at each stage append the complement of what you have.\nThis gives $0$, then $01$, then $0110$, then $01101001$, and so on.\nThe result never repeats any block three times in a row.\nIt is also used as a fair order of turns: two players who pick in the order $A B B A B A A B \\ldots$ share the advantage of going first.\n",
  "commit": "547b6eddb8f2feb8d579f2d633d22a27b7e132fc",
  "front": {
    "instance_of": [
      "0G9EKM0E15"
    ],
    "kind": "object",
    "msc": [
      "11B85",
      "68R15"
    ],
    "name": "Thue–Morse sequence",
    "same_as": {
      "wikidata": "Q1477120",
      "wikipedia": "Thue–Morse sequence"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Thue%E2%80%93Morse_sequence"
      }
    ],
    "tag": "7JZVT385PC"
  },
  "kind": "object",
  "link": "https://math2.tamnd.com/node/7JZVT385PC/",
  "links": [
    {
      "field": "instance_of",
      "target": "0G9EKM0E15"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/7JZVT385PC.md",
  "msc": [
    "11B85",
    "68R15"
  ],
  "name": "Thue–Morse sequence",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/7JZ/7JZVT385PC.md",
  "status": null,
  "tag": "7JZVT385PC",
  "uri": "m2://7JZVT385PC",
  "url": "https://math2.tamnd.com/wiki/thue-morse-sequence/",
  "writing": {
    "tag": "7JZVT385PC",
    "kind": "object",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
