Morse thue binary number pattern java program
Allouche and Shallit , pp. Amazingly, the Thue-Morse sequence can be generated from the substitution system. Interpreting these to sequences as decimal numbers gives the sequences 0, 1, 6, , , , OEIS A and 1, 2, 9,1 50, , , After the initial generation, each subsequence generation has 0s and 1s.
Wolfram provides various pieces of Wolfram Language code that produce the first terms of the complemented Thue-Morse sequence 1, 0, 0, 1, 0, 0, 1, The position of the evil numbers , which have an even number of 1's in their binary expansion OEIS A ,.
A generating function , following , ,. A closed-form expression in terms of a hypergeometric function.
Writing the sequence as a power series over the finite field GF 2 ,. This equation has two solutions, and , where is the complement of , i. The equality 10 can be demonstrated as follows. To get , simply use the rule for squaring power series over GF 2. Then multiply by which just adds a zero at the front to get. This is the first term of the quadratic equation, which is the Thue-Morse sequence with each term doubled up.
The next term is , so we have. The sum is the above two sequences XOR ed together there are no carries because we're working over GF 2 , giving. The Thue-Morse words are overlapfree Allouche and Shallit , p. The sequence therefore contains no substrings of the form , where is any word. For example, it does not contain the words , or In fact, the following stronger statement is true: We can obtain a squarefree sequence on three symbols by doing the following: Replace 01 by 0, 10 by 1, 00 by 2 and 11 by 2 to get the following: Then this sequence is squarefree Morse and Hedlund The Thue-Morse sequence has important connections with the Gray code.
Kindermann generates fractal music using the self-similarity of the Thue-Morse sequence. Monthly , , However, there are no cubes: There are also no overlapping squares: Further, let q n be a word obtain from T 2 n by counting ones between consecutive zeros.
The words T n do not contain overlapping squares in consequence, the words q n are palindrome squarefree words. The statement above that the Thue—Morse sequence is "filled with squares" can be made precise: It is a uniformly recurrent word , meaning that given any finite string X in the sequence, there is some length n X often much longer than the length of X such that X appears in every block of length n X.
Then n X can be set to any multiple of m that is larger than twice the length of X. But the Morse sequence is uniformly recurrent without being periodic, not even eventually periodic meaning periodic after some nonperiodic initial segment. We define the Thue—Morse morphism to be the function f from the set of binary sequences to itself by replacing every 0 in a sequence with 01 and every 1 with 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. This power series is algebraic over the field of formal power series, satisfying the equation .
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 can be defined as: However, it guarantees a stronger property: This follows directly from the expansion given by the binomial theorem applied to the binomial representing the n th element of an arithmetic progression.
Using turtle graphics , a curve can be generated if an automaton is programmed with a sequence. If the Thue—Morse sequence members are used in order to select program states:. This illustrates the fractal nature of the Thue—Morse Sequence. In their book on the problem of fair division , 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.
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 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.
Robert Richman addressed this problem, but he too did not identify the Thue—Morse sequence as such at the time of publication. He showed that the n th derivative can be expressed in terms of T n. A consequence of this result is that a resource whose value is expressed as a monotonically decreasing continuous function 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 of equal strength from a carafe with a nonlinear concentration gradient , 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. In so doing, they demonstrated that the Thue-Morse order produces a fair outcome not only for sequences T n of length 2 n , 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.
However, Prouhet did not mention the sequence explicitly; this was left to Axel Thue in , 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 , when he applied it to differential geometry. The sequence has been discovered independently many times, not always by professional research mathematicians; for example, Max Euwe , a chess grandmaster , who held the world championship title from to , and mathematics teacher , discovered it in in an application to chess: From Wikipedia, the free encyclopedia.
This graphic demonstrates the repeating and complementary makeup of the Thue—Morse sequence. Abrahams, Marc 12 July