HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, the Thue–Morse or Prouhet–Thue–Morse sequence is the
binary sequence A bitstream (or bit stream), also known as binary sequence, is a sequence of bits. A bytestream is a sequence of bytes. Typically, each byte is an 8-bit quantity, and so the term octet stream is sometimes used interchangeably. An octet may ...
(an infinite sequence of 0s and 1s) that can be obtained by starting with 0 and successively appending the Boolean complement of the sequence obtained thus far. It is sometimes called the fair share sequence because of its applications to
fair division Fair division is the problem in game theory of dividing a set of resources among several people who have an Entitlement (fair division), entitlement to them so that each person receives their due share. The central tenet of fair division is that ...
or parity sequence. The first few steps of this procedure yield the strings 0, 01, 0110, 01101001, 0110100110010110, and so on, which are the prefixes of the Thue–Morse sequence. The full sequence begins: :01101001100101101001011001101001.... The sequence is named after
Axel Thue Axel Thue (; 19 February 1863 – 7 March 1922) was a Norwegian mathematician, known for his original work in diophantine approximation and combinatorics. Work Thue published his first important paper in 1909. He stated in 1914 the so-called w ...
, Marston Morse and (in its extended form) Eugène Prouhet.


Definition

There are several equivalent ways of defining the Thue–Morse sequence.


Direct definition

To compute the ''n''th element ''tn'', write the number ''n'' in binary. If the number of ones in this binary expansion is odd then ''tn'' = 1, if even then ''tn'' = 0. That is, ''tn'' is the even parity bit for ''n''. John H. Conway ''et al''. deemed numbers ''n'' satisfying ''tn'' = 1 to be ''odious'' (intended to be similar to ''odd'') numbers, and numbers for which ''tn'' = 0 to be ''evil'' (similar to ''even'') numbers.


Fast sequence generation

This method leads to a fast method for computing the Thue–Morse sequence: start with , and then, for each ''n'', find the highest-order bit in the binary representation of ''n'' that is different from the same bit in the representation of . If this bit is at an even index, ''tn'' differs from , and otherwise it is the same as . In Python: def generate_sequence(seq_length: int) -> int: """Thue–Morse sequence.""" value: int = 1 for n in range(seq_length): # Note: assumes that (-1).bit_length() gives 1 x: int = (n ^ (n - 1)).bit_length() + 1 if x & 1

0: # Bit index is even, so toggle value value = 1 - value yield value
The resulting algorithm takes constant time to generate each sequence element, using only a logarithmic number of bits (constant number of words) of memory.


Recurrence relation

The Thue–Morse sequence is the sequence ''tn'' satisfying the
recurrence relation In mathematics, a recurrence relation is an equation according to which the nth term of a sequence of numbers is equal to some combination of the previous terms. Often, only k previous terms of the sequence appear in the equation, for a parameter ...
:\begin t_0 &= 0,\\ t_ &= t_n,\\ t_ &= 1 - t_n, \end for all non-negative integers ''n''.


L-system

The Thue–Morse sequence is a morphic word: it is the output of the following Lindenmayer system:


Characterization using bitwise negation

The Thue–Morse sequence in the form given above, as a sequence of bits, can be defined recursively using the operation of
bitwise negation In computer programming, a bitwise operation operates on a bit string, a bit array or a binary numeral (considered as a bit string) at the level of its individual bits. It is a fast and simple action, basic to the higher-level arithmetic opera ...
. So, the first element is 0. Then once the first 2''n'' elements have been specified, forming a string ''s'', then the next 2''n'' elements must form the bitwise negation of ''s''. Now we have defined the first 2''n''+1 elements, and we recurse. Spelling out the first few steps in detail: * We start with 0. * The bitwise negation of 0 is 1. * Combining these, the first 2 elements are 01. * The bitwise negation of 01 is 10. * Combining these, the first 4 elements are 0110. * The bitwise negation of 0110 is 1001. * Combining these, the first 8 elements are 01101001. * And so on. So * ''T''0 = 0. * ''T''1 = 01. * ''T''2 = 0110. * ''T''3 = 01101001. * ''T''4 = 0110100110010110. * ''T''5 = 01101001100101101001011001101001. * ''T''6 = 0110100110010110100101100110100110010110011010010110100110010110. * And so on. In Python: def thue_morse_bits(n): """Return an int containing the first 2**n bits of the Thue-Morse sequence, low-order bit 1st.""" bits = 0 for i in range(n): bits , = ((1 << (1 << i)) - 1 - bits) << (1 << i) return bits Which can then be converted to a (reversed) string as follows: n = 7 print(f"")


Infinite product

The sequence can also be defined by: : \prod_^ \left(1 - x^\right) = \sum_^ (-1)^ x^j, where ''t''''j'' is the ''j''th element if we start at ''j'' = 0.


Properties

The Thue–Morse sequence contains many ''squares'': instances of the string XX, where X denotes the string A, \overline, A \overlineA, or \overlineA \overline, where A=T_ for some k\ge 0 and \overline is the bitwise negation of A. For instance, if k=0, then A=T_=0 . The square A \overlineAA \overlineA = 010010 appears in T starting at the 16th bit. Since all squares in T are obtained by repeating one of these 4 strings, they all have length 2^n or 3\cdot2^n for some n\ge 0. T contains no ''cubes'': instances of XXX. There are also no ''overlapping squares'': instances of 0X0X0 or 1X1X1. The critical exponent of T is 2. The Thue–Morse sequence is a uniformly recurrent word: given any finite string ''X'' in the sequence, there is some length ''nX'' (often much longer than the length of ''X'') such that ''X'' appears in ''every'' block of length ''nX''. Notably, the Thue–Morse sequence is uniformly recurrent ''without'' being either periodic or eventually periodic (i.e., periodic after some initial nonperiodic segment). The sequence ''T''2''n'' is a palindrome for any ''n''. Furthermore, let ''q''''n'' be a word obtained by counting the ones between consecutive zeros in ''T''2''n'' . For instance, ''q''1 = 2 and ''q''2 = 2102012. Since ''Tn'' does not contain ''overlapping squares'', the words ''qn'' are palindromic squarefree words. The Thue–Morse
morphism In mathematics, a morphism is a concept of category theory that generalizes structure-preserving maps such as homomorphism between algebraic structures, functions from a set to another set, and continuous functions between topological spaces. Al ...
''μ'' is defined on alphabet by the substitution map ''μ''(0) = 01, ''μ''(1) = 10: every 0 in a sequence is replaced with 01 and every 1 with 10. If ''T'' is the Thue–Morse sequence, then ''μ''(''T'') is also ''T''. Thus, ''T'' is a fixed point of ''μ''. The morphism ''μ'' is a prolongable morphism on the
free monoid In abstract algebra, the free monoid on a set is the monoid whose elements are all the finite sequences (or strings) of zero or more elements from that set, with string concatenation as the monoid operation and with the unique sequence of zero ...
with ''T'' as fixed point: ''T'' is essentially the ''only'' fixed point of ''μ''; the only other fixed point is the bitwise negation of ''T'', which is simply the Thue–Morse sequence on (1,0) instead of on (0,1). This property may be generalized to the concept of an automatic sequence. The ''generating series'' of ''T'' over the binary field is the
formal power series In mathematics, a formal series is an infinite sum that is considered independently from any notion of convergence, and can be manipulated with the usual algebraic operations on series (addition, subtraction, multiplication, division, partial su ...
:t(Z) = \sum_^\infty T(n) Z^n \ . This
power series In mathematics, a power series (in one variable) is an infinite series of the form \sum_^\infty a_n \left(x - c\right)^n = a_0 + a_1 (x - c) + a_2 (x - c)^2 + \dots where ''a_n'' represents the coefficient of the ''n''th term and ''c'' is a co ...
is algebraic over the field of rational functions, satisfying the equation :Z + (1+Z)^2 t + (1+Z)^3 t^2 = 0


In combinatorial game theory

The set of ''evil numbers'' (numbers n with t_n=0) forms a subspace of the nonnegative integers under nim-addition ( bitwise
exclusive or Exclusive or, exclusive disjunction, exclusive alternation, logical non-equivalence, or logical inequality is a logical operator whose negation is the logical biconditional. With two inputs, XOR is true if and only if the inputs differ (on ...
). For the game of Kayles, evil nim-values occur for few (finitely many) positions in the game, with all remaining positions having odious nim-values.


The Prouhet–Tarry–Escott problem

The Prouhet–Tarry–Escott problem can be defined as: given a positive integer ''N'' and a non-negative integer ''k'', partition the set ''S'' = into two disjoint subsets ''S''0 and ''S''1 that have equal sums of powers up to k, that is: : \sum_ x^i = \sum_ x^i for all integers ''i'' from 1 to ''k''. This has a solution if ''N'' is a multiple of 2''k''+1, given by: * ''S''0 consists of the integers ''n'' in ''S'' for which ''tn'' = 0, * ''S''1 consists of the integers ''n'' in ''S'' for which ''tn'' = 1. For example, for ''N'' = 8 and ''k'' = 2, : : The condition requiring that ''N'' be a multiple of 2''k''+1 is not strictly necessary: there are some further cases for which a solution exists. However, it guarantees a stronger property: if the condition is satisfied, then the set of ''k''th powers of any set of ''N'' numbers in
arithmetic progression An arithmetic progression or arithmetic sequence is a sequence of numbers such that the difference from any succeeding term to its preceding term remains constant throughout the sequence. The constant difference is called common difference of that ...
can be partitioned into two sets with equal sums. This follows directly from the expansion given by the
binomial theorem In elementary algebra, the binomial theorem (or binomial expansion) describes the algebraic expansion of powers of a binomial. According to the theorem, the power expands into a polynomial with terms of the form , where the exponents and a ...
applied to the binomial representing the ''n''th element of an arithmetic progression. For generalizations of the Thue–Morse sequence and the Prouhet–Tarry–Escott problem to partitions into more than two parts, see Bolker, Offner, Richman and Zara, "The Prouhet–Tarry–Escott problem and generalized Thue–Morse sequences".


Fractals and turtle graphics

Using turtle graphics, a curve can be generated if an automaton is programmed with a sequence. When Thue–Morse sequence members are used in order to select program states: * If ''t''(''n'') = 0, move ahead by one unit, * If ''t''(''n'') = 1, rotate by an angle of π/3
radian The radian, denoted by the symbol rad, is the unit of angle in the International System of Units (SI) and is the standard unit of angular measure used in many areas of mathematics. It is defined such that one radian is the angle subtended at ...
s (60°) The resulting curve converges to the Koch curve, a
fractal curve A fractal curve is, loosely, a mathematical curve (mathematics), curve whose shape retains the same general pattern of Pathological (mathematics), irregularity, regardless of how high it is magnified, that is, its graph takes the form of a fract ...
of infinite length containing a finite area. This illustrates the fractal nature of the Thue–Morse Sequence. It is also possible to draw the curve precisely using the following instructions: *If ''t''(''n'') = 0, rotate by an angle of π radians (180°), * If ''t''(''n'') = 1, move ahead by one unit, then rotate by an angle of π/3 radians.


Equitable sequencing

In their book on the problem of
fair division Fair division is the problem in game theory of dividing a set of resources among several people who have an Entitlement (fair division), entitlement to them so that each person receives their due share. The central tenet of fair division is that ...
, Steven Brams and Alan Taylor invoked the Thue–Morse sequence but did not identify it as such. When allocating a contested pile of items between two parties who agree on the items' relative values, Brams and Taylor suggested a method they called ''balanced alternation'', or ''taking turns taking turns taking turns . . . '', as a way to circumvent the favoritism inherent when one party chooses before the other. An example showed how a divorcing couple might reach a fair settlement in the distribution of jointly-owned items. The parties would take turns to be the first chooser at different points in the selection process: Ann chooses one item, then Ben does, then Ben chooses one item, then Ann does. Lionel Levine and Katherine E. Stange, in their discussion of how to fairly apportion a shared meal such as an Ethiopian dinner, proposed the Thue–Morse sequence as a way to reduce the advantage of moving first. They suggested that “it would be interesting to quantify the intuition that the Thue–Morse order tends to produce a fair outcome.” Robert Richman addressed this problem, but he too did not identify the Thue–Morse sequence as such at the time of publication. He presented the sequences ''Tn'' as step functions on the interval ,1and described their relationship to the Walsh and Rademacher functions. He showed that the ''n''th
derivative In mathematics, the derivative is a fundamental tool that quantifies the sensitivity to change of a function's output with respect to its input. The derivative of a function of a single variable at a chosen input value, when it exists, is t ...
can be expressed in terms of ''Tn''. As a consequence, the step function arising from ''Tn'' is
orthogonal In mathematics, orthogonality (mathematics), orthogonality is the generalization of the geometric notion of ''perpendicularity''. Although many authors use the two terms ''perpendicular'' and ''orthogonal'' interchangeably, the term ''perpendic ...
to
polynomial In mathematics, a polynomial is a Expression (mathematics), mathematical expression consisting of indeterminate (variable), indeterminates (also called variable (mathematics), variables) and coefficients, that involves only the operations of addit ...
s of order ''n'' − 1. A consequence of this result is that a resource whose value is expressed as a monotonically decreasing
continuous function In mathematics, a continuous function is a function such that a small variation of the argument induces a small variation of the value of the function. This implies there are no abrupt changes in value, known as '' discontinuities''. More preci ...
is most fairly allocated using a sequence that converges to Thue–Morse as the function becomes flatter. An example showed how to pour cups of
coffee Coffee is a beverage brewed from roasted, ground coffee beans. Darkly colored, bitter, and slightly acidic, coffee has a stimulating effect on humans, primarily due to its caffeine content, but decaffeinated coffee is also commercially a ...
of equal strength from a carafe with a nonlinear
concentration In chemistry, concentration is the abundance of a constituent divided by the total volume of a mixture. Several types of mathematical description can be distinguished: '' mass concentration'', '' molar concentration'', '' number concentration'', ...
gradient In vector calculus, the gradient of a scalar-valued differentiable function f of several variables is the vector field (or vector-valued function) \nabla f whose value at a point p gives the direction and the rate of fastest increase. The g ...
, prompting a whimsical article in the popular press. Joshua Cooper and Aaron Dutle showed why the Thue–Morse order provides a fair outcome for discrete events. They considered the fairest way to stage a Galois duel, in which each of the shooters has equally poor shooting skills. Cooper and Dutle postulated that each dueler would demand a chance to fire as soon as the other's ''a priori'' probability of winning exceeded their own. They proved that, as the duelers’ hitting probability approaches zero, the firing sequence converges to the Thue–Morse sequence. In so doing, they demonstrated that the Thue–Morse order produces a fair outcome not only for sequences ''Tn'' of length ''2n'', but for sequences of any length. Thus the mathematics supports using the Thue–Morse sequence instead of alternating turns when the goal is fairness but earlier turns differ monotonically from later turns in some meaningful quality, whether that quality varies continuously or discretely. Sports competitions form an important class of equitable sequencing problems, because strict alternation often gives an unfair advantage to one team. Ignacio Palacios-Huerta proposed changing the sequential order to Thue–Morse to improve the '' ex post'' fairness of various tournament competitions, such as the kicking sequence of a
penalty shoot-out The penalty shootout is a method of determining a winner in sports matches that would have otherwise been drawn or tied. The rules for penalty shootouts vary between sports and even different competitions; however, the usual form is similar to pe ...
in soccer. He did a set of field experiments with pro players and found that the team kicking first won 60% of games using ABAB (or ''T''1), 54% using ABBA (or ''T''2), and 51% using full Thue–Morse (or ''T''n).  As a result, ABBA is undergoing extensive trials in FIFA (European and World Championships) and English Federation professional soccer (
EFL Cup The English Football League Cup, often referred to as the League Cup and currently known as the Carabao Cup for sponsorship reasons, is an annual Single-elimination tournament, knockout competition in men's domestic football in England. Orga ...
). An ABBA serving pattern has also been found to improve the fairness of tennis tie-breaks. In competitive rowing, ''T''2 is the only arrangement of port- and starboard-rowing crew members that eliminates transverse forces (and hence sideways wiggle) on a four-membered coxless racing boat, while ''T''3 is one of only four rigs to avoid wiggle on an eight-membered boat. Fairness is especially important in player drafts. Many professional sports leagues attempt to achieve competitive parity by giving earlier selections in each round to weaker teams. By contrast, fantasy football leagues have no pre-existing imbalance to correct, so they often use a “snake” draft (forward, backward, etc.; or ''T''1). Ian Allan argued that a “third-round reversal” (forward, backward, backward, forward, etc.; or ''T''2) would be even more fair. Richman suggested that the fairest way for “captain A” and “captain B” to choose sides for a pick-up game of basketball mirrors ''T''3: captain A has the first, fourth, sixth, and seventh choices, while captain B has the second, third, fifth, and eighth choices.


Hash collisions

The initial bits of the Thue–Morse sequence are mapped to 0 by a wide class of polynomial
hash function A hash function is any Function (mathematics), function that can be used to map data (computing), data of arbitrary size to fixed-size values, though there are some hash functions that support variable-length output. The values returned by a ...
s modulo a
power of two A power of two is a number of the form where is an integer, that is, the result of exponentiation with number 2, two as the Base (exponentiation), base and integer  as the exponent. In the fast-growing hierarchy, is exactly equal to f_1^ ...
, which can lead to
hash collision In computer science, a hash collision or hash clash is when two distinct pieces of data in a hash table share the same hash value. The hash value in this case is derived from a hash function which takes a data input and returns a fixed length of ...
s.


Riemann zeta function

Certain linear combinations of Dirichlet series whose coefficients are terms of the Thue–Morse sequence give rise to identities involving the Riemann Zeta function (Tóth, 2022 ). For instance: : \begin \sum_ \frac &= 4 \zeta(2) = \frac, \\ \sum_ \frac &= 8 \zeta(3),\end where (t_n)_ is the n^ term of the Thue–Morse sequence. In fact, for all s with real part greater than 1, we have : (2^s+1) \sum_ \frac + (2^s-1) \sum_ \frac = 2^s \zeta(s).


History

The Thue–Morse sequence was first studied by in 1851,The ubiquitous Prouhet-Thue-Morse sequence by Jean-Paul Allouche and Jeffrey Shallit
/ref> who applied it to
number theory Number theory is a branch of pure mathematics devoted primarily to the study of the integers and arithmetic functions. Number theorists study prime numbers as well as the properties of mathematical objects constructed from integers (for example ...
. However, Prouhet did not mention the sequence explicitly; this was left to
Axel Thue Axel Thue (; 19 February 1863 – 7 March 1922) was a Norwegian mathematician, known for his original work in diophantine approximation and combinatorics. Work Thue published his first important paper in 1909. He stated in 1914 the so-called w ...
in 1906, who used it to found the study of combinatorics on words. The sequence was only brought to worldwide attention with the work of Marston Morse in 1921, when he applied it to
differential geometry Differential geometry is a Mathematics, mathematical discipline that studies the geometry of smooth shapes and smooth spaces, otherwise known as smooth manifolds. It uses the techniques of Calculus, single variable calculus, vector calculus, lin ...
. The sequence has been discovered independently many times, not always by professional research mathematicians; for example, Max Euwe, a chess grandmaster and mathematics
teacher A teacher, also called a schoolteacher or formally an educator, is a person who helps students to acquire knowledge, competence, or virtue, via the practice of teaching. ''Informally'' the role of teacher may be taken on by anyone (e.g. w ...
, discovered it in 1929 in an application to
chess Chess is a board game for two players. It is an abstract strategy game that involves Perfect information, no hidden information and no elements of game of chance, chance. It is played on a square chessboard, board consisting of 64 squares arran ...
: by using its cube-free property (see above), he showed how to circumvent the threefold repetition rule aimed at preventing infinitely protracted games by declaring repetition of moves a draw. At the time, consecutive identical board states were required to trigger the rule; the rule was later amended to the same board position reoccurring three times at any point, as the sequence shows that the consecutive criterion can be evaded forever.


See also

* Dejean's theorem * Fabius function * First difference of the Thue–Morse sequence *
Gray code The reflected binary code (RBC), also known as reflected binary (RB) or Gray code after Frank Gray (researcher), Frank Gray, is an ordering of the binary numeral system such that two successive values differ in only one bit (binary digit). For ...
* Komornik–Loreti constant * Prouhet–Thue–Morse constant


Notes


References

* * * * * * * } * * * * * * * * * * * *


Further reading

* *


External links

* * * Allouche, J.-P.; Shallit, J. O
The Ubiquitous Prouhet-Thue-Morse Sequence
(contains many applications and some history) * Thue–Morse Sequence over (1,2) * *
Reducing the influence of DC offset drift in analog IPs using the Thue-Morse Sequence
A technical application of the Thue–Morse Sequence
MusiNum - The Music in the Numbers
Freeware to generate self-similar music based on the Thue–Morse Sequence and related number sequences. * {{DEFAULTSORT:Thue-Morse Sequence Binary sequences Fixed points (mathematics) Parity (mathematics)