Gijswijt Sequence Calculator

Sequences

first 10 terms of the Gijswijt sequence1, 1, 2, 1, 1, 2, 2, 2, 3, 1
largest term so far3
first occurrence of 2term 3
first occurrence of 3term 9
How this was calculated
  1. Start with 1. Each next term is the largest k such that the sequence so far ends with k back-to-back repetitions of some block of terms.
  2. After 1, 1 the block '1' repeats twice, so the third term is 2; no block repeats three times until the single block '2, 2' pattern builds up later.
  3. Reading off the first 10 terms gives a largest value of 3; the first 3 appears at term 9.
  4. Gijswijt's sequence grows astonishingly slowly - the first 4 does not appear until term 218 - because long repetitions of a block are rare.

The Gijswijt Sequence Calculator generates terms of the Gijswijt sequence and shows you how each one is produced. The sequence starts 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, and each new term is the largest k such that the sequence so far ends with k back-to-back repetitions of some block. Enter how many terms you want, and the calculator returns the sequence along with the count that determined every new term. You can see for yourself that the first 2 appears at term 3 and the first 3 at term 9, that the largest value in the first 30 terms is only 3, and that the first 4 does not appear until term 218.

The underlying method is the accepted standard for this kind of calculation because it applies the sequence's defining rule directly: at each step it checks, for the longest possible block, whether the sequence so far ends with that block repeated k times, and records the largest such k. Nothing is approximated or guessed. The page shows the formula, step-by-step workings, worked examples and sources, so you can follow the reasoning behind each term rather than just reading a list of numbers. The sequence is named after Dion Gijswijt, who defined it in 2006, and it is famous for growing astonishingly slowly: a value as small as 4 waits until term 218. This calculator makes that slow growth easy to inspect term by term.

Worked examples

First 10 terms

(10)

first 10 terms of the Gijswijt sequence1, 1, 2, 1, 1, 2, 2, 2, 3, 1
largest term so far3
first occurrence of 2term 3
first occurrence of 3term 9

First 20 terms

(20)

first 20 terms of the Gijswijt sequence1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 2, 2, 3, 2, 1
largest term so far3
first occurrence of 2term 3
first occurrence of 3term 9

First 30 terms

(30)

first 30 terms of the Gijswijt sequence1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 2, 2, 3, 2, 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1
largest term so far3
first occurrence of 2term 3
first occurrence of 3term 9

What is the Gijswijt sequence?

The Gijswijt sequence is a string of whole numbers built by one simple, self-describing rule: each new term is the largest number k such that the sequence so far ends with k back-to-back repetitions of some block. In other words, when you are about to write the next term, you look back at everything you have written and ask how many identical chunks are stacked at the end. That count becomes the next number. The sequence is named after Dion Gijswijt, who defined it in 2006.

The rule is easier to see than to describe. A block can be any run of terms, including a single term, and the repetitions must sit directly next to each other at the end of the sequence. If the last two terms are identical, that alone gives k of at least 2, because the one-term block repeats twice. If the ending is not repeated at all, the largest such k is 1, so a 1 is written. The next term is always at least 1, and it can be larger only when a longer repeated pattern closes the sequence.

Working the first ten terms by hand shows how the rule behaves. Begin with a single 1. The sequence ends with one copy of the block "1", and no block repeats twice, so the next term is 1. Now the sequence is 1, 1: the block "1" repeats twice at the end, so the next term is 2. That gives 1, 1, 2. The ending "2" appears only once, so the next term is 1, and then the ending "1" appears once, so another 1 follows. The sequence is now 1, 1, 2, 1, 1, and the block "1, 1" repeats twice at the end, so the next term is 2. The ending then reads 1, 1, 2, 1, 1, 2, and the two-term block "1, 2" repeats twice, so the next term is 2 again. One more 2 follows for the same reason, and then the ending holds three copies of the block "2", so the next term is 3. The first ten terms are therefore 1, 1, 2, 1, 1, 2, 2, 2, 3, 1.

Those first ten terms already show the sequence's odd character. The first 2 appears at term 3, and the first 3 does not arrive until term 9. Growth stays extremely slow: in the first 30 terms the largest value is only 3. The first 4 does not appear until term 218, which is why the Gijswijt sequence is famous for growing astonishingly slowly. A calculator for the Gijswijt sequence makes it practical to extend the terms far beyond what you would want to check by hand, while the rule itself stays short enough to state in a sentence.

Rule to remember: the next term is the largest k such that the sequence so far ends with k back-to-back copies of some block.

How each term is found

To find the next term of the Gijswijt sequence, you look only at what has already been written and ask a single question: how many times in a row does the sequence so far repeat some block, right up to its end? The new term is the largest such count. Working this out by hand means testing every possible block length that could end at the current position and counting how many complete, identical copies of that block sit back to back there.

Start with the sequence 1, 1, 2, 1, 1, 2, 2, 2, 3, 1. Suppose you want the term after the first two entries, 1, 1. Test the shortest block first: a block of length one ending at the current position is just the final 1, and there is only one copy of it, so k is at least 1. Now test a block of length two: the last two entries are 1, 1, which is two back-to-back copies of the block 1. That gives k = 2, and no longer block can fit, so the third term is 2. This is why the first 2 appears at term 3.

The same procedure scales up. At each step you check block lengths from one upward, and for each length you count complete repetitions ending at the current position. A block of length two might repeat three times; a block of length three might repeat twice; a longer block might repeat only once. The answer is the biggest repetition count you find across all those checks. Because a single copy of a block always counts as one repetition, the next term is never less than 1.

This is exactly how the first 3 is produced at term 9, and why, in the first 30 terms, the largest value is only 3. Longer and longer blocks have to line up perfectly before a higher number can appear. The first 4 does not show up until term 218, which is why the Gijswijt sequence is famous for growing astonishingly slowly. The sequence is named after Dion Gijswijt, who defined it in 2006.

A calculator automates this block-by-block check: for the current position it tries each candidate block length, counts the complete repetitions that end there, and keeps the maximum. That makes it easy to extend the Gijswijt sequence term by term without manually testing every block length yourself.

  • Identify the current end of the sequence.
  • For each possible block length ending at that position, count how many complete, identical copies appear back to back.
  • Take the largest count as the next term.
The next term is the largest k such that the sequence so far ends with k back-to-back repetitions of some block.

Why it grows so slowly

The rule behind the Gijswijt sequence is easy to state: each new term is the largest k such that the sequence so far ends with k back-to-back repetitions of some block. That sounds like a recipe for fast growth, but it is not. To write a large number, the sequence must first build a long run of identical blocks, and long runs of identical blocks are rare. Every time a new term is added, it changes the end of the sequence, and the next term must be earned from scratch by whatever repetition now sits at the end.

You can see the hesitation in the early terms. The sequence starts 1, 1, 2, 1, 1, 2, 2, 2, 3, 1. The first 2 appears at term 3 and the first 3 at term 9. Across the first 30 terms the largest value is only 3. A value of 3 requires three identical blocks in a row at the end, and even that modest demand takes several terms to satisfy. Higher values demand longer and longer stacks of matching blocks, and each added term disturbs the pattern that the next term depends on.

The headline fact shows how severe the slowdown becomes. The first 4 does not appear until term 218. That is why the Gijswijt sequence is famous for growing astonishingly slowly. A value of 4 needs four back-to-back copies of some block at the end of the sequence, and the sequence takes more than two hundred terms to arrange that. The jump from 3 to 4 is not a small step in effort; it is a much longer wait, and later values are rarer still.

The table below lists the first 30 terms, where the largest value stays at 3. Reading down the column, you can watch the sequence return to 1 again and again, rebuilding its short runs before it can produce another 2 or 3. Those repeated restarts are the visible sign of the same mechanism that delays the first 4 until term 218: repetition has to be assembled at the end of the sequence, and it is easy to break. The Gijswijt sequence, defined by Dion Gijswijt in 2006, therefore grows slowly not because its rule is complicated but because its rule is strict.

TermValue
11
21
32
41
51
62
72
82
93
101
111
122
131
141
152
162
172
183
191
201
212
221
231
242
252
262
273
281
291
302
The first 4 does not appear until term 218 — the clearest sign of how slowly the Gijswijt sequence grows.

Gijswijt vs other self-describing sequences

The Gijswijt sequence is easy to confuse with better-known self-describing sequences, so it helps to see what makes it different. Its rule is unusual: each new term is the largest k such that the sequence so far ends with k back-to-back repetitions of some block. That single rule produces the opening 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, and it is the reason the Gijswijt sequence is often grouped with sequences that seem to describe their own structure.

The most striking contrast is with the Recamán sequence, which is built from subtraction and addition steps and is famous for its dramatic leaps and its long-standing open questions. The Gijswijt sequence moves in the opposite direction. Its values creep upward with painful slowness. The first 2 appears at term 3 and the first 3 at term 9. In the first 30 terms the largest value is only 3. The first 4 does not appear until term 218, which is why the sequence is famous for growing astonishingly slowly. A reader who expects the rapid swings of Recamán will be surprised by how long Gijswijt lingers on small numbers.

Look-and-say style sequences offer another useful comparison. Those sequences typically read off the previous term and describe it aloud, so the terms can grow in length very quickly. The Gijswijt sequence does not describe a previous term in that way. Instead, every new term depends on how the entire sequence so far ends, specifically on the longest run of repeated blocks at its tail. That makes it a self-referential sequence, but one whose self-reference is about repetition patterns rather than about counting digits.

Placing the Gijswijt sequence correctly matters when you use a calculator or compare terms. It is not a Recamán-style walk through the integers, and it is not a look-and-say expansion. It is a slow, pattern-driven sequence named after Dion Gijswijt, who defined it in 2006. Keeping those distinctions in mind makes the first 30 terms, the arrival of the first 4 at term 218, and the sequence's reputation for slow growth much easier to interpret.

  • Recamán sequence: built from subtraction and addition steps, with large jumps and open questions.
  • Look-and-say sequences: describe the previous term and can grow in length quickly.
  • Gijswijt sequence: each term is the largest k such that the sequence so far ends with k repeated blocks.
  • Growth contrast: first 2 at term 3, first 3 at term 9, largest value only 3 in the first 30 terms, first 4 at term 218.
Defined by Dion Gijswijt in 2006, the Gijswijt sequence is self-referential like look-and-say sequences, but its slow growth sets it apart from Recamán.

FAQs

What are the first 10 terms of the Gijswijt sequence?

The first 10 terms of the Gijswijt sequence are 1, 1, 2, 1, 1, 2, 2, 2, 3, 1. You can use the calculator on this page to confirm these values and to generate many more terms of the sequence.

When does the first 3 appear?

The first 3 appears at term 9. Before that point, every term is either 1 or 2. The 3 arrives only after the sequence builds up the repeated blocks that the rule requires, which is why it takes until term 9.

When does the first 4 appear?

The first 4 appears at term 218. The growth is famously slow: the sequence climbs from 3 to 4 only after more than two hundred terms. This slow climb is a defining feature of the Gijswijt sequence and a common source of surprise.

What is the largest of the first 30 terms?

The largest of the first 30 terms is 3. Within that early stretch, no term reaches 4, since the first 4 does not appear until term 218. The calculator can show you the first 30 terms and highlight the maximum.

How is each Gijswijt term defined?

Each term is the largest k for which the sequence so far ends in k consecutive repetitions of some block of terms. In other words, you look at the end of the sequence, find the longest run of identical repeated blocks, and that count becomes the next term.

Is the Gijswijt sequence bounded?

No. The sequence is known to be unbounded, but the values grow extremely slowly. Even though every value that appears is finite, the terms do not stay below any fixed limit forever. The first 4 at term 218 illustrates just how slowly the sequence climbs.

Sources

Related calculators

Recaman Sequence Calculator
Generate Recaman's sequence term a(n) by the subtract-if-possible rule, with the neighbouring terms and the largest value so far.
Aliquot Sequence Calculator
Trace an aliquot sequence to its fate: termination at 0, a perfect fixed point, or an amicable or sociable cycle.
Arithmetic Sequence Calculator
The nth term and the sum of the first n terms of an arithmetic sequence from the first term and common difference.