HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What are some uses of the Thue-Morse sequence in computer science?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
sciencethewhatarethueusessequencesomecomputermorse

Problem

Note: I come from a mathematics background.

The Thue-Morse sequence $t_n$ is a binary sequence that takes the value $0$ at the positive integer $n$ if the number of $1$s in its binary expansion is even, $1$ otherwise.

A definition that is closer to computer science states that $t_n$ is the binary sequence obtained by starting with $0$ and successively appending the boolean complement of the sequence obtained so far.

Thus, $t_n$ begins $0,1,1,0,1,0,0,1,\ldots$

This sequence is of much interest in mathematics, but so far I have not come across any applications in computer science. This surprises me, for the two following reasons:

  • The Thue-Morse sequence is automatic, i.e., the sequence is fully characterized by a finite automaton,



  • It is a binary sequence.




What theoretic or practical applications of the Thue-Morse sequence are there in computer science?

Solution

I don't know if this counts as an application but at least it shows up. When using a polynomial rolling hash, it's tempting to do it modulo $2^{32}$ or $2^{64}$ (depending on the word size of the computer) since on most modern architectures addition and multiplication of integers just handle overflows this way, saving time. This method will fail often on Thue-Morse-like strings (like ABBABAAB...), as explained here. I remember not understanding the factorization of $T$ a few years ago, the key is the recurrence relation $t_{2n} = t_n$, $t_{2n+1} = 1-t_n$

Alternative explanation of the factorization: from the "append the negated sequence" definition one can directly see $\Pi_n (1-x^{2^n})$ , since each each term does exactly that.

Context

StackExchange Computer Science Q#120982, answer score: 4

Revisions (0)

No revisions yet.