A sequence that is its own list of runs
Worth reading first: The orbit written as a word · Fractions repeat and roots look random.
Write down a 1. A sequence of 1s and 2s can be described by the lengths of its runs of equal symbols, and the question William Kolakoski asked in 1965 is whether some sequence is its own description. Start with 1: the first run has length 1, so it is a single 1, and the next run must be 2s. The second term must be the length of that second run; make it 2. So the second run is 2, 2, and the third term — also 2 — says the third run, of 1s, has length 2: 1, 1. Carrying on, the sequence writes itself:
and its runs have lengths 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, … — the same sequence. Each term, once written, says how long a later run must be, and the writing always stays ahead of the reading, so there is never any choice. It is the only sequence of 1s and 2s beginning with 1 that is its own run-length list.
Nothing could be easier to generate, and almost nothing about it is known. Whether half its terms are 1s is open. Whether the share of 1s among the first terms even tends to a limit is open. Whether it can be produced by any of the standard machines that produce structured infinite words — substitution rules, automata — is open, and believed not. It sits beside the look-and-say sequence, the other famous self-describing sequence, in a revealing way: look-and-say was tamed by finding a finite set of pieces that never interact, and Kolakoski’s sequence has never yielded any such pieces. This essay generates ten million terms and measures what can be measured.
Reading while writing
The figure draws the first 44 terms with every run bracketed. Under the brackets the run lengths read 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, … which is the top row again. The generation in the figure, and for the ten million terms below, is the obvious one: keep a pointer that reads the sequence and a pointer that writes it, and for each term read, write a run of that length, alternating between 1s and 2s. The writing pointer moves on average one and a half places for every place the reading pointer moves, so it is always ahead, and the procedure never stalls.
The sequence can also be read as an orbit written as a word, in the sense of symbolic dynamics: the rule “replace each term by a run of that length” is a map on infinite sequences, and Kolakoski’s sequence is a fixed point of it. That is where the questions come from. Fixed points of a substitution — a rule that replaces each symbol by a fixed block, such as , for the Thue–Morse sequence — have frequencies that are always computable, from the eigenvector of a small matrix. The run-length rule is almost a substitution, but not quite: the block a term becomes depends on whether it falls in a run of 1s or 2s, and that depends on the parity of its position among the runs, which is a global property. That small defect is what has blocked every attempt to compute the frequencies.
The contrast with a genuine substitution is instructive. The Thue–Morse sequence, 0, 1, 1, 0, 1, 0, 0, 1, …, is the fixed point of , : every term’s block is decided by the term alone. Consequently every statistic about it is a finite computation — exactly half its terms are 1s, its blocks of length number at most about , and the frequency of any block is a rational number read off a small matrix. Substitutions of this kind are the one-dimensional shadows of the self-similar tilings that never repeat, and their whole theory rests on the substitution’s matrix, whose eigenvector is the vector of frequencies. Kolakoski’s rule would have such a matrix if a term’s block depended only on the term. Because it also depends on where the term falls in the alternation of runs, the matrix does not exist, and there is no eigenvector to compute. Every statement below that is measured rather than proved is measured for that reason.
Two facts are easy. The sequence contains no run longer than 2, since every term is 1 or 2, and therefore no block 111 or 222. And it is not eventually periodic: if it repeated with some period from some point on, its run-length list would also repeat, with a period shortened by the ratio of the number of runs to the number of terms in a period, and following the shortening down leads to a contradiction.
A share that stays at one half
The natural guess is that half the terms are 1s, and the figure measures how close the guess comes. Among the first thousand terms the share of 1s is 0.5020; among the first million, 0.4999860; among the first ten million, 0.5000046. On logarithmic scales the distance from one half falls much faster than the dashed line, which marks the typical distance for the same number of fair coin flips, : by ten million terms a coin would be off by about one part in six thousand, and the sequence is off by about one part in two hundred thousand.
Computations far beyond this one agree. The sequence has been generated to more than terms, using a method that stores only a few levels of the reading-while-writing recursion at a time, and the share of 1s stays within a few millionths of one half throughout. But no amount of computation decides whether the share tends to one half, and the best proved statement is weak by comparison. In 1993 Vašek Chvátal showed, by a computer-assisted analysis of the blocks that can occur, that the upper density of 1s — the largest share the sequence approaches infinitely often — is at most 0.50084. The red line in the figure marks that bound. The truth, if the computations are a guide, is a hundred times closer to one half than anything anyone can prove.
This is the same gap as the one between fractions that repeat and roots that look random: a sequence produced by a simple deterministic rule, statistically perfect wherever it is examined, and beyond the reach of every method for proving that it is.
Closer to balanced than chance
The share hides the more striking measurement, which is the raw excess. The figure plots the number of 1s minus the number of 2s among the first terms, all the way to ten million. A sequence of fair coin flips would wander away like a random walk, with a typical distance of — over three thousand by the end — and the dashed curves leave the frame before 60,000 terms. Kolakoski’s excess never gets further than 189 from zero in ten million terms and ends at 92.
That is evidence of structure, not of randomness, and it is the kind of evidence that is very hard to turn into a proof. The excess does wander, and nothing is known that would keep it bounded, but it grows much more slowly than a random walk’s, perhaps like a small power of . Nobody knows the exponent, or even that there is one. If the excess grows more slowly than , the density is one half; that is the whole content of the open question, restated as a question about this curve. The difference between the average settling and the wobble not settling is the difference between the law of large numbers and the central limit theorem, and for Kolakoski’s sequence neither is available, because there is no independence to appeal to.
How many different blocks occur
A different measure of structure counts the distinct blocks — the different strings of consecutive terms that occur anywhere in the sequence. A random sequence of 1s and 2s contains every one of the possible blocks of each length; a periodic sequence contains only as many as its period; and the simplest non-periodic sequences, the Sturmian words that a straight line spells as it crosses a grid, contain exactly blocks of each length , the fewest any non-periodic sequence can have.
Kolakoski’s sequence sits in between, and the figure counts its blocks in the first million and a half terms. There are 2 of length 1, 4 of length 2, then 6, 10, 14 and 18, 50 of length 10, 250 of length 20 and 1,302 of length 40. On logarithmic scales the points lie roughly on a line, steepening slightly; between lengths 20 and 40 the count grows like . A count that grows like a power of means the sequence has zero entropy, in the sense of the entropy in a single orbit: it is far from random, and the information in a block of length is only about bits. Whether the count settles on a single power of is unknown; the exponent measured at accessible lengths is still creeping upwards, and heuristics based on the way the run-length rule stretches the sequence by a factor of three halves suggest it continues to do so for a long time.
That the block count is polynomial is itself what makes the sequence so hard. Sequences with exponential block counts behave like random ones and can be studied by probability; sequences with linear block counts are rigid and can be studied by arithmetic. Kolakoski’s sequence is in the narrow middle where neither toolkit applies.
Blocks and their mirror images
Of the 32 conceivable blocks of length five, only 14 occur, since runs have length 1 or 2 and the run lengths themselves are constrained. The figure lists them in pairs with their mirror images — the block with every 1 changed to 2 and every 2 to 1 — and measures how often each begins a position among the first ten million terms. In every pair, the two frequencies agree to within 0.00003. The blocks 12112 and 12212 each occur at about a ninth of all positions, and the other five pairs at about an eighteenth each, block and mirror alike.
The symmetry is not built into the rule, which treats 1s and 2s very differently — a 1 asks for a run of one and a 2 for a run of two. It is conjectured that every block and its mirror image occur with the same frequency, for blocks of every length, which would in particular make the density of 1s exactly one half. Like the density itself, it is confirmed at every length anyone has computed and proved at none. The figure shows the first nontrivial case of a conjecture that, if true, says the sequence cannot tell its two symbols apart, however the rule that generates it seems to.
Other pairs of symbols
The rule makes sense for any two positive whole numbers. Over the sequence begins 1, 3, 3, 3, 1, 1, 1, 3, 3, 3, 1, 3, … — one 1, three 3s, three 1s, three 3s, one 1 — and is again its own run-length list. The figure generates four such sequences to a million terms and plots the running share of the first symbol. Three of them, , and , hover at one half. The fourth, , settles decisively near 0.3972, nowhere near a half.
And here, for once, there is a theorem. When the two symbols have the same parity — both odd, like 1 and 3, or both even — Bernd Sing and Michael Baake showed that the self-describing sequence can be produced by a substitution rule acting on pairs of symbols, because the parity problem that blocks the case disappears: every run then flips the alternation the same way. For those cases the frequencies are eigenvector components of a small matrix and can be computed exactly; for the share of 1s is an algebraic number, the 0.3972 that the figure approaches. The cases with one odd and one even symbol, including Kolakoski’s original , are exactly those for which no such description is known — and the computations suggest they are the ones that land on one half.
What ten million terms cannot settle
Every figure here measures a finite prefix, and the questions about Kolakoski’s sequence are about the infinite sequence. Ten million terms, or ten trillion, can refute a conjecture — a frequency that drifted away from one half, a block whose mirror never occurs — but cannot confirm one, and the history of mathematics has examples of quantities that sit near a simple value for longer than any computation reaches and then leave it.
The measurements are also of different reliability. The share of 1s is measured with enormous precision and agrees with one half to within the computation’s noise; the block-count exponent is measured at short lengths where it is still changing, and the 2.38 found here between lengths 20 and 40 is not an estimate of any limit; the mirror symmetry is measured only for blocks of length five. And the figure of the excess shows its wandering on one sample path, the only one there is: the sequence is deterministic, so there is no second run to compare against and no error bar in the usual sense. What the curve can be compared with is the family of other self-describing sequences, and the case shows why that comparison is not reassuring: a computable cousin of the same rule settles somewhere quite different from one half, so the value one half is not forced by the shape of the rule. It has to come, if it comes at all, from something particular to the symbols 1 and 2.
Still open: is half of it ones?
The central question is Michael Keane’s from 1991: does the density of 1s in Kolakoski’s sequence exist, and is it one half? Chvátal’s 0.50084 is the best upper bound, and the matching lower bound, by symmetry of the argument, is 0.49916; nothing better is known after three decades. Related questions are equally open — whether the sequence is recurrent in the strong sense that every block that occurs once occurs with bounded gaps, whether every block’s mirror image occurs, whether the sequence can be produced by any finite machine reading the position in some base.
There is a structural reason to expect difficulty. The sequence is a fixed point of the run-length operator, which multiplies lengths by three halves on average, and three halves is not a whole number. Every tractable class of structured sequences — automatic, substitutive, Sturmian — involves stretching by whole-number or at least algebraically compatible factors, and Kolakoski’s stretching mixes the scales two and three in a way that resembles, on a tiny scale, the interplay of doubling and tripling that makes other simple problems intractable.
A rule that describes itself
Kolakoski’s sequence, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, …, is the only sequence of 1s and 2s beginning with 1 that is its own list of run lengths, and in ten million terms its 1s and 2s stay balanced to within 189 — far closer than a random sequence would — with the share of 1s at 0.5000046. Its distinct blocks grow like a power of their length, 1,302 at length 40, so it is neither random nor rigid; every block of length five occurs as often as its mirror image. Yet the best proved bound keeps the long-run share of 1s only below 0.50084, and whether the share settles at all is open. Over , where the symbols share a parity, the same rule becomes a substitution and its share, 0.3972, is computable; over no such description exists, and the answer the computation keeps giving — one half — is still a guess.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A walk that may not step where it has been — both name open problem, random walk
- Abundant, and still not a sum of its parts — both name density, open problem
Named objects
A dashed tag is an object no other essay names yet.
DensityOpen problemRandom walkSubstitutionSubword complexitySymbolic sequence