All Tools
Categories
Number Tools 69 XML Tools 64 Email Marketing Tools 55 Import-Export Tools 50 JSON Tools 45 Text Tools 13 Shipping Freight Tools 5 Calculator 4
About Contact Privacy

Thue-Morse Sequence Generator

Generate the Thue-Morse sequence: t(n) = parity of the bit count of n: 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0... Overlap-free, used from chess to radar. Start anywhere, run in your browser. Free.

Parameters
1 - 10,000
t(n) = 1 when the binary form of n holds an odd number of 1s, else 0. Doubling rule: copy the word and flip every bit.
Sequence

          

About Thue-Morse Sequence Generator

Take the parity of the number of 1s in the binary form of n, and you have written — in one breath — one of the most surprising words in mathematics: the Thue-Morse sequence, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, ... First studied by Axel Thue in 1906 for its impossible-sounding property — a binary word with no overlapping repetitions — it reappeared in Morse theory, in radar, in chess rules, and in a 19th-century problem of Prouhet about splitting powers perfectly evenly.

Thue-Morse Sequence Generator computes t(n) by the parity definition for any window you choose, annotates each row with the binary form and bit count, and offers the doubling-rule view in the reference tab.

Features

  • Parity definition, exactly: t(n) = popcount parity, computed bit by bit for every n.
  • Evidence on every row: Binary form and bit count appear next to each value.
  • Live balance stats: The 0/1 census and the sliding imbalance of the window.
  • Start anywhere: Any index from 0 to 1,000,000, up to 10,000 consecutive terms.
  • Reference tab: The doubling rule, overlap-freedom, Prouhet, music and history.
  • Free and private: All computation is local; nothing is uploaded, stored or logged.

How to Use

  1. Set the start index — first n to evaluate (0 to 1,000,000).
  2. Set the count — consecutive bits to generate (1 to 10,000).
  3. Generate — parity of each bit count is shown with the binary evidence.
  4. Check the census — balance between 0s and 1s across the window.
  5. Copy or download — the run as index = value lines, or as a flat binary word.

Examples

Example 1 — The famous opening. Count 16 bits: 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 — the doubling word 01101001 twice, complemented.

Example 2 — A single bit flips the value. n = 7 (111, three 1s) gives 1, while n = 6 (110, two 1s) gives 0: one less 1 changes the parity completely.

Example 3 — Perfect balance. Count 32: exactly sixteen 0s and sixteen 1s. Every power-of-two window is exactly balanced, a hallmark of the sequence.

Example 4 — No cubes anywhere. Scan count 256: no block of bits appears three times consecutively — the overlap-free property that made Thue's reputation.

Example 5 — Large indices. Start 999,983, count 16: twenty-bit indices still flip signs by popcount parity as the window shifts.

Benefits

  • Definition-faithful: The parity rule decides every bit; the doubling view is derived, not assumed.
  • Educational rows: Binary digits and counts make each answer self-explanatory.
  • Insightful stats: Balance and census show the deeper equidistribution.
  • Flexible ranges: Any window of up to 10,000 terms from any origin.
  • Clean export: Copy or download per-index lines or a flat binary word.
  • Private by design: No servers, no uploads, no logs.

Frequently Asked Questions

What is the Thue-Morse sequence?
t(n) is 0 when the binary expansion of n has an even number of 1s and 1 when it has an odd number. The word begins 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, ... and was discovered independently by Thue (1906), Morse (1921) and others.
Why is the sequence famous?
It is the simplest "overlap-free" word: no block ever appears immediately followed by itself plus one extra bit, and it contains no cube (three consecutive equal blocks). Proving that took a full paper by Axel Thue at the dawn of formal language theory.
How is it built without bit counting?
By a magical doubling rule: write down the current word and append its complement — 0 becomes 1, 1 becomes 0. Start with 0: 0, 01, 0110, 01101001, ... Each doubling repeats what the bit-parity definition produces.
What does "overlap-free" mean?
No finite word can appear as the start of a square where the two copies overlap by one character. Concretely, words like 01010 (which contains "01010" with an overlapping repeat) never occur as a subsequence of consecutive bits.
Where is it used?
It defeats several games: a chess rule banning threefold repetition uses it, composers from Ligeti forward have woven the doubling word into scores, radar and interconnect design exploit its spectral evenness, and Prouhet partitions split powers equally — 0 + 7 = 3 + 4 for squares, cubes, and further powers.
Is anything stored or uploaded?
No. Bits are computed locally from the parity of bit counts. Nothing leaves the browser, is saved or logged. Copy or download a run before closing the tab.