ArticleslgStudy

mathematics

Kolakoski sequence

Kolakoski sequence is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Kolakoski sequence rather than just read about it. In short: In mathematics, the Kolakoski sequence, sometimes also known as the Oldenburger–Kolakoski sequence, is an infinite sequence of symbols {1,2} that is the sequence of run lengths in its own run-length encoding. It is named after the recreational mathematician William Kolakoski (1944–97) who described it in 1965, but it was previously discussed by Rufus Oldenburger in 1939.

Kolakoski sequence — main illustration
Kolakoski sequence — illustration

Key takeaways

  • Kolakoski sequence belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Kolakoski sequence to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Kolakoski sequence from memory before moving on to harder problems.

Reference excerpt

In mathematics, the Kolakoski sequence, sometimes also known as the Oldenburger–Kolakoski sequence, is an infinite sequence of symbols {1,2} that is the sequence of run lengths in its own run-length encoding. It is named after the recreational mathematician William Kolakoski (1944–97) who described it in 1965, but it was previously discussed by Rufus Oldenburger in 1939.

Definition

The initial terms of the Kolakoski sequence are:

1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,2,1,1,2,1,2,2,1,1,... (sequence A000002 in the OEIS) Each symbol occurs in a "run" (a sequence of equal elements) of either one or two consecutive terms, and writing down the lengths of these runs gives exactly the same sequence:

1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,2,1,1,2,1,2,2,1,1,2,1,1,2,1,2,2,1,2,2,1,1,2,1,2,2,... 1, 2 , 2 ,1,1, 2 ,1, 2 , 2 ,1, 2 , 2 ,1,1, 2 ,1,1, 2 , 2 ,1, 2 ,1,1, 2 ,1, 2 , 2 ,1,1, 2 ,... The description of the Kolakoski sequence is therefore reversible. If K stands for "the Kolakoski sequence", description #1 logically implies description #2 (and vice versa):

1. The terms of K are generated by the runs (i.e., run-lengths) of K 2. The runs of K are generated by the terms of K Accordingly, one can say that each term of the Kolakoski sequence generates a run of one or two future terms. The first 1 of the sequence generates a run of "1", i.e. itself; the first 2 generates a run of "22", which includes itself; the second 2 generates a run of "11"; and so on. Each number in the sequence is the length of the next run to be generated, and the element to be generated alternates between 1 and 2:

1,2 (length of sequence l = 2; sum of terms s = 3) 1,2,2 (l = 3, s = 5) 1,2,2,1,1 (l = 5, s = 7) 1,2,2,1,1,2,1 (l = 7, s = 10) 1,2,2,1,1,2,1,2,2,1 (l = 10, s = 15) 1,2,2,1,1,2,1,2,2,1,2,2,1,1,2 (l = 15, s = 23) As can be seen, the length of the sequence at each stage is equal to the sum of terms in the previous stage. This animation illustrates the process:

These self-generating properties, which remain if the sequence is written without the initial 1, mean that the Kolakoski sequence can be described as a fractal, or mathematical object that encodes its own representation on other scales. Bertran Steinsky has created a recursive formula for the i-th term of the sequence.

Research

Recurrence properties The sequence is not eventually periodic, that is, its terms do not have a general repeating pattern (cf. irrational numbers like π and √2). More generally, the sequence is cube-free, i.e., has no substring of the form w w w {\displaystyle www} with w {\displaystyle w} some nonempty finite string. It is not known whether every string appearing in the sequence occurs infinitely many times, nor whether the occurrence of a string implies the occurrence of its reverse string; the two facts, however, are known to be equivalent.

Density It seems plausible that the density of 1s in the Kolakoski {1,2}-sequence is 1/2, but this conjecture remains unproved. Václav Chvátal has proved that the upper density of 1s is less than 0.50084. Nilsson has used the same method with far greater computational power to obtain the bound 0.500080. Although calculations of the first 3×108 values of the sequence appeared to show its density converging to a value slightly different from 1/2, later calculations that extended the sequence to its first 1013 values show the deviation from a density of 1/2 growing smaller, as one would expect if the limiting density actually is 1/2.

Connection with tag systems The Kolakoski sequence can also be described as the result of a simple cyclic tag system. However, as this system is a 2-tag system rather than a 1-tag system (that is, it replaces pairs of symbols by other sequences of symbols, rather than operating on a single symbol at a time) it lies in the region of parameters for which tag systems are Turing complete, making it difficult to use this representation to reason about the sequence.

Algorithms The Kolakoski sequence may be generated by an algorithm that, in the i-th iteration, reads the value xi that has already been output as the i-th value of the sequence (or, if no such value has been output yet, sets xi = i). Then, if i is odd, it outputs xi copies of the number 1, while if i is even, it outputs xi copies of the number 2. Thus, the first few steps of the algorithm are:

The first value has not yet been output, so set x1 = 1, and output 1 copy of the number 1 The second value has not yet been output, so set x2 = 2, and output 2 copies of the number 2 The third value x3 was output as 2 in the second step, so output 2 copies of the number 1. The fourth value x4 was output as 1 in the third step, so output 1 copy of the number 2. Etc. This algorithm takes linear time, but because it needs to refer back to earlier positions in the sequence it needs to store the whole sequence, taking linear space. An alternative algorithm that generates multiple copies of the sequence at different speeds, with each copy of the sequence using the output of the previous copy to determine what to do at each step, can be used to generate the sequence in linear time and only logarithmic space.

See also Golomb sequence — another self-generating sequence based on run-length Gijswijt's sequence Look-and-say sequence

Notes

… excerpt ends here. Continue reading the full article.

Illustrations

Kolakoski sequence: Visualisation of the 3rd to 50th terms of the Kolakoski sequence as a spiral. The terms start at the dot at the middle of the spiral. In the following revolution, each arc is repeated if the term is 1, or divided into two equal halves if it is 2. The first two terms cannot be shown as they are self-referential. In the SVG image, hover over an arc or label to highlight it and show its statistics.
Visualisation of the 3rd to 50th terms of the Kolakoski sequence as a spiral. The terms start at the dot at the middle of the spiral. In the following revolution, each arc is repeated if the term is 1, or divided into two equal halves if it is 2. The first two terms cannot be shown as they are self-referential. In the SVG image, hover over an arc or label to highlight it and show its statistics.
Kolakoski sequence: the Kolakoski sequence describes its own run length
the Kolakoski sequence describes its own run length

Worked examples

Example 1 — a first encounter with Kolakoski sequence

Start with the simplest possible case. Write down what Kolakoski sequence claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Kolakoski sequence before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Kolakoski sequence ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Kolakoski sequence

In research
Kolakoski sequence appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Kolakoski sequence in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Kolakoski sequence is common in secondary-school and first-year university syllabi. It links to neighbouring topics Fractals, Integer sequences, Parity (mathematics), so understanding it makes those chapters shorter.
In everyday life
Look for Kolakoski sequence outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Kolakoski sequence” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Kolakoski sequence in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Kolakoski sequence means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Kolakoski sequence out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Kolakoski sequence in simple terms?

In mathematics, the Kolakoski sequence, sometimes also known as the Oldenburger–Kolakoski sequence, is an infinite sequence of symbols {1,2} that is the sequence of run lengths in its own run-length encoding. It is named after the recreational mathematician William Kolakoski (1944–97) who described…

Why does Kolakoski sequence matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Kolakoski sequence?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Kolakoski sequence.

Tags

  • Fractals
  • Integer sequences
  • Parity (mathematics)

Keep exploring