Report Tool or Give Us Suggestions

Kolakoski Sequence Generator

Generate terms of the self-describing Kolakoski sequence with custom run characters and instant copy or download options.

L ading . . .

What is the Kolakoski Sequence?

The Kolakoski sequence is an infinite self-describing sequence of natural numbers (specifically $1$s and $2$s). It is famous for its self-generating nature: the sequence of the lengths of its consecutive runs of identical symbols is exactly identical to the sequence itself.

How is the Sequence Constructed?

The sequence starts with $K = (1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, \dots)$.

Let's analyze the run lengths of $K$:

  • First run is a single $1$ $\implies$ run length of **$1$**.
  • Second run is two $2$s $\implies$ run length of **$2$**.
  • Third run is two $1$s $\implies$ run length of **$2$**.
  • Fourth run is a single $2$ $\implies$ run length of **$1$**.
  • Fifth run is a single $1$ $\implies$ run length of **$1$**.
  • Sixth run is two $2$s $\implies$ run length of **$2$**.

If we write down these run lengths, we get: **$1, 2, 2, 1, 1, 2, \dots$**, which is exactly the starting portion of the sequence itself!

Unsolved Conjectures: The Density of 1s

Although the sequence is easy to construct, it is one of the most mysterious sequences in recreational mathematics.
The most famous unsolved question is: **Is the limiting density of 1s in the sequence exactly $0.5$ (or $50\%$)?**
In other words, as the number of terms $N \to \infty$, does the frequency of 1s approach exactly half of the sequence? While computer searches of up to $10^{13}$ terms support this ($50.00000\%$), a formal mathematical proof is yet to be discovered.

How to Use the Kolakoski Sequence Generator

Our free online tool allows you to easily generate and customize terms of this fascinating sequence:

  1. Enter the Number of Terms you wish to generate (up to 10,000).
  2. Customize the State Symbols for '1' and '2'. You can use letters like A/B or other numbers.
  3. Choose a Separator (comma, space, new line, semicolon, pipe) or select "None" for a continuous stream of states.
  4. Turn on the Show 1-Based Index Labels to display the term index next to each state.
  5. Click Generate to see the results instantly, then copy the sequence or download it as a text file.

Frequently Asked Questions

Who discovered the Kolakoski sequence?

It is named after the American mathematician William Kolakoski, who published a query about it in the American Mathematical Monthly in 1965. However, it was first described in a paper by Rufus Oldenburger in 1939.

Is Gijswijt's sequence different from Kolakoski's?

Yes. Gijswijt's sequence is determined by looking at the curling numbers of suffix blocks, whereas the Kolakoski sequence is determined by matching the run lengths of its blocks to its own terms.

Does the sequence contain any numbers other than 1 and 2?

No, by standard definition, the classical Kolakoski sequence only consists of the numbers 1 and 2.

What is the max number of terms this tool can generate?

You can generate up to 10,000 terms instantly. The generation runs entirely inside your browser's local sandbox, maintaining maximum efficiency and absolute security.

logo OnlineMiniTools

OnlineMiniTools.com is your ultimate destination for a wide range of web-based tools, all available for free.

Feel free to reach out with any suggestions or improvements for any tool at admin@onlineminitools.com. We value your feedback and are continuously striving to enhance the tool's functionality.

© 2026 OnlineMiniTools . All rights reserved.

Hosted on Hostinger

v1.10.0