# New Year's eve riddle

A bit more than 20 years ago, the following exercise was assigned to a class as the christmas holiday exercise. I did search for a while whether it was posted here earlier and could not find it. I guess I might as well ask it as New Year's eve riddle here. It was in German, I hope I can translate it in such a way that it's spirit is preserved.

Two politicians are arguing who of the two of them is able to give the longest talk, without saying the same thing three times in a row. There is a problem, however, they both do only know 2 words, namely 'but' (B) and 'if' (I).

The first one begins 'B', the second one replies 'BI' which is countered by 'BIIB'. The second politician is quite bright, he simply repeats literally the last talk given by the other one, then takes that talk again but interchanges B and I and appends the result of this operation to the first talk. His opponent realizes this strategy and proceeds in the same way. So we get talks $$B, B\, I, BI\, IB, BIIB\, IBBI, BIIB IBBI\, IBBIBIIB, ...$$ That is, the $k$-th talk $T_k$ has length $2^{k-1}$ and coincides with the first half of $T_{k+1}$.

A mathematician comes along, who has not much to contribute, either. But he solves the controversy in a mathematician's manner. He gives a talk $T$ of infinite length, such that the first $2^{k-1}$ words of $T$ agree with $T_k$. Afterwards (!) he leaves and leaves it to the politicians to prove that in his talk he had never said the same thing three times in a row, to be more precise, nowhere in his talk $T$ exists a segment $S$ of finite length which occurs three times as a sequence $SSS$ in $T$.

How do you prove this? :-)

-
This is the Thue-Morse sequence, q.v. –  Gerry Myerson Dec 31 '11 at 19:09
This falls under the umbrella concept of combinatorics on words. This sequence if known as the Thue-Morse sequence. The latter Wikipedia page lists the 'cubefree' property, but without proof :-). Happy Sylvester/New Year to you all depending on your time zone (and time of reading)! –  Jyrki Lahtonen Dec 31 '11 at 19:13
as one of my teachers once said: now it has a name and we need no longer be afraid of it ;-) I still don't know how to solve it.. –  user20266 Dec 31 '11 at 19:17
cs.umb.edu/~offner/files/thue.pdf :) (Warning: Might contain spoilers ^^) –  Listing Dec 31 '11 at 19:18
@Listing yes, it does. Contain spoilers, that is. –  user20266 Dec 31 '11 at 19:54

Ah, a beautiful riddle. The answer is the Thue-Morse sequence: http://en.wikipedia.org/wiki/Thue–Morse_sequence . Defined as follows: Starting with a(0), a(n) is equal to B if n has an odd number of 1s in his binary representation, and I otherwise. The theorem (never saying the same thing thrice in a row) is a special case of "no overlaps", where overlap means xAxAx where x is a letter and A is a (possibly empty) string of letters. The proof of "no overlaps in the Thue-Morse sequence" is in this paper: http://arxiv.org/abs/0706.0907 . If there is some nonepmty string of letters A that's said thrice in a row, AAA, then A=xB where x is the first letter of A and B is the rest of the string (B might be empty), then there is AAA=xBxBxB, but even xBxBx doesn't appear in the sequence, thus xBxBxB=AAA doesn't appear.

-