Van Eck Sequence Calculator

Sequence

First 20 terms of the Van Eck sequence0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3
Last term a(19)3
Zeros among the terms7
Largest term reached6
How this was calculated
  1. The Van Eck sequence looks back: each new term is the distance since the previous term last appeared, or 0 if it has never appeared before.
  2. Starting from 0, the look-back rule gives the opening run 0, 0, 1, 0, 2, 0, 2, 2, 1, 6.
  3. Generating 20 terms one look-back at a time ends at a(19) = 3, with the largest term 6.
  4. Zeros appear 7 times in these terms; despite the simple rule, the long-term behaviour of this sequence is still not fully understood.

The Van Eck Sequence Calculator generates the terms of the Van Eck sequence, the look-back sequence catalogued in the OEIS that begins 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3. The rule is simple: each new term is the distance back to the previous occurrence of the last term, or 0 if the last term has never appeared before. The calculator applies that rule term by term so you can see the sequence build up and check any position you are curious about. It also reports basic facts about the early terms, such as that among the first 10 terms zeros appear 4 times and the largest term is 6, and that among the first 30 terms the last term is a(29) = 14 and the largest term is 14.

The method is the accepted standard because it follows the defining rule exactly, with no shortcuts or approximations, so every term is reproduced just as the sequence defines it. The sequence was described by Jan R. van Eck, and despite the elementary rule, basic questions about its long-run behaviour remain open, which makes careful, term-by-term generation especially useful. This page shows the formula, step-by-step workings, worked examples and sources. One worked step: after 0, 0, 1, the last term 1 has never appeared before index 2's predecessors, so the next term is 0.

Worked examples

First 10 Van Eck terms

(10)

First 10 terms of the Van Eck sequence0, 0, 1, 0, 2, 0, 2, 2, 1, 6
Last term a(9)6
Zeros among the terms4
Largest term reached6

First 20 Van Eck terms

(20)

First 20 terms of the Van Eck sequence0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3
Last term a(19)3
Zeros among the terms7
Largest term reached6

First 30 Van Eck terms

(30)

First 30 terms of the Van Eck sequence0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 0, 3, 2, 9, 0, 4, 9, 3, 6, 14
Last term a(29)14
Zeros among the terms9
Largest term reached14

What is the Van Eck sequence?

The Van Eck sequence is a look-back sequence: each new term is decided entirely by what came before it, using one simple question. The rule is this: look at the last term written. If that term has appeared earlier in the sequence, the next term is the distance back to its previous occurrence — the number of positions you count backward to reach it. If the last term has never appeared before, the next term is 0. That is the whole rule. There is no arithmetic on the values themselves, no addition or multiplication, just a search backward through the terms already on the page.

The sequence begins 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3. Because the rule is so elementary, a short run is the clearest way to see it working. Start with 0. Nothing precedes it, so the last term has no earlier occurrence and the next term is 0 again. Now the last term is 0, and its previous occurrence is one position back, so the next term is 1. The sequence now reads 0, 0, 1.

The next step is the one worth slowing down for. After 0, 0, 1, the last term is 1. Looking back through the terms before it, 1 has never appeared, so the next term is 0. The sequence becomes 0, 0, 1, 0. Then the last term is 0, and its previous occurrence sits two positions back, so the next term is 2. Then 2 has not appeared before, so a 0 follows, and the run continues 0, 0, 1, 0, 2, 0. In the first 10 terms — 0, 0, 1, 0, 2, 0, 2, 2, 1, 6 — zeros appear 4 times and the largest term is 6. By the first 30 terms the last term is a(29) = 14, and the largest term is also 14.

Two features of this definition are easy to miss. First, the distance is measured in positions, not in how many times a value has occurred, so a term that appeared very recently produces a small next term. Second, the value 0 does double duty: it is the starting term and also the answer whenever the last term is new, which is why zeros are so common early on. The sequence was described by Jan R. van Eck, and it is catalogued in the OEIS as a look-back sequence. Despite the elementary rule, basic questions about its long-run behaviour remain open.

To use the calculator, enter how many terms you want and it will generate the sequence from the same rule described above, so you can watch the look-backs play out term by term.

The rule in one line: next term = the distance back to the previous occurrence of the last term, or 0 if the last term has never appeared before.

How the generator works

The Van Eck sequence is built one term at a time, and the only thing the generator must remember is where it last saw each value. Keep a record of the most recent index at which every number has appeared. Then each new step is a single lookup: take the last term, check its stored index, and compare that index with the current position. The gap between the two is the next term. If the last term has never appeared before, the next term is 0. After writing the new term, update the record so it points at the current position, and move on.

A worked step makes the bookkeeping concrete. Start with 0, 0, 1. The last term is 1, and 1 has not appeared before the position it occupies, so the rule returns 0 and the sequence continues 0, 0, 1, 0. The stored index for 1 is then updated to the position just used, so the next time a 1 is the last term the lookup will find it. This is why the procedure stays cheap as the sequence grows: no scanning backward through the whole history is required, only one lookup and one update per term.

The calculator applies this same procedure and reports three summary values for the run you request. The last term is the final number produced. The zero count is how many times 0 appears in the generated terms. The largest term is the biggest value reached. These summaries are easy to check against short runs. Among the first 10 terms (0, 0, 1, 0, 2, 0, 2, 2, 1, 6), zeros appear 4 times and the largest term is 6. Among the first 30 terms the last term is a(29) = 14 and the largest term is 14.

The opening of the Van Eck sequence, as catalogued in the OEIS, is 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3. Reading it alongside the rule shows how the memory of past positions shapes every step: a repeat produces a distance, a first appearance produces a zero. The sequence was described by Jan R. van Eck, and despite the elementary rule, basic questions about its long-run behaviour remain open.

Because the generator is defined entirely by that one lookup, you can reproduce any prefix by hand with a table of values and their latest positions, or let the calculator do the bookkeeping and read off the last term, the zero count and the largest term.

Each step is one lookup: find the last term's previous index, write the distance back to it, or write 0 if it has never appeared.

First 30 terms

A table is the easiest way to see how the Van Eck sequence unfolds, so here are the first 30 terms exactly as generated by the rule: 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 0, 3, 2, 9, 0, 4, 9, 3, 6, 14. Reading across the row, you can check each entry against the one before it and see the look-back rule at work without doing any arithmetic yourself.

The table below places the same 30 values in a grid so that individual terms are easier to locate and compare. Each row holds ten terms, which means the first row covers a(0) through a(9), the second covers a(10) through a(19), and the third covers a(20) through a(29). This layout makes it simple to spot where a value repeats and where a new value appears for the first time.

Even in this short opening stretch, some basic facts stand out. Among the first 10 terms (0, 0, 1, 0, 2, 0, 2, 2, 1, 6), zeros appear 4 times and the largest term is 6. Extending the view to all 30 terms, the last term is a(29) = 14 and the largest term is also 14. That 14 is the highest value reached anywhere in this opening segment, and it arrives right at the end of the list.

The rule producing these numbers is simple to state: each new term is the distance back to the previous occurrence of the last term, or 0 if the last term has never appeared before. A worked step shows how this plays out early on. After 0, 0, 1, the last term 1 has never appeared before index 2's predecessors, so the next term is 0. The sequence was described by Jan R. van Eck, and despite the elementary rule, basic questions about its long-run behaviour remain open. That contrast is part of what makes the opening 30 terms worth examining closely: the values are easy to generate by hand, yet the pattern they build is not fully understood.

IndexTermIndexTermIndexTermIndexTermIndexTerm
a(0)0a(1)0a(2)1a(3)0a(4)2
a(5)0a(6)2a(7)2a(8)1a(9)6
a(10)0a(11)5a(12)0a(13)2a(14)6
a(15)5a(16)4a(17)0a(18)5a(19)3
a(20)0a(21)3a(22)2a(23)9a(24)0
a(25)4a(26)9a(27)3a(28)6a(29)14
Among the first 30 terms, the largest term is 14 and the final term shown, a(29), is also 14.

Van Eck vs Recaman and look-and-say

The Van Eck sequence is often grouped with other self-referential sequences, but the family resemblance is loose. What these sequences share is a rule that refers to the sequence's own history: each term depends on what came earlier. What separates them is how they use that history. The Recaman sequence works by subtraction and addition — a term is reached by subtracting the previous term from the current index when the result is positive and unused, and otherwise by adding. The look-and-say sequence describes the previous term's runs aloud, turning a string of digits into a count of how many of each digit appear in a row. The Van Eck rule does neither arithmetic nor description. It asks a single question about distance.

Under the Van Eck rule, each new term is the distance back to the previous occurrence of the last term, or 0 if the last term has never appeared before. That is pure look-back distance: no addition, no subtraction, no counting of runs. A worked step shows how little machinery is needed. After 0, 0, 1, the last term 1 has never appeared before, so the next term is 0. The rule reads the past only to measure how far back a repeat sits.

The early terms make the contrast concrete. The Van Eck sequence starts 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3 — the look-back sequence catalogued in the OEIS. Among the first 10 terms (0, 0, 1, 0, 2, 0, 2, 2, 1, 6), zeros appear 4 times and the largest term is 6. Among the first 30 terms, the last term is a(29) = 14 and the largest term is 14. Those small, slowly climbing values are a consequence of the distance rule: a term can only be as large as the gap since the last repeat of the previous value.

The sequence was described by Jan R. van Eck, and despite the elementary rule, basic questions about its long-run behaviour remain open. That is the sharpest contrast with the look-and-say sequence, whose growth can be described in structured terms, and with Recaman's sequence, whose subtraction-and-addition rule has been studied through its own distinct questions. The Van Eck sequence asks you to remember positions rather than values, and that simple shift in what the rule looks at is what makes it a different object from its better-known cousins.

  • Recaman: subtract or add the previous term depending on whether the result is positive and unused.
  • Look-and-say: describe the runs of the previous term, for example as counts of repeated digits.
  • Van Eck: each new term is the distance back to the previous occurrence of the last term, or 0 if that term is new.
All three sequences depend on their own earlier terms, but only the Van Eck sequence is built purely on look-back distance.

FAQs

What is the Van Eck sequence?

It is the integer sequence where each term is how far back the previous term last appeared, or 0 if it never appeared: 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, ... Each new term looks at the number just before it and reports the gap since that number was last seen.

What are the first 10 terms of the Van Eck sequence?

The first 10 terms are 0, 0, 1, 0, 2, 0, 2, 2, 1, 6. Reading left to right, a(0) = 0 and a(9) = 6. The sequence starts with a 0 because the opening term has no earlier appearance to point back to.

Why does the Van Eck sequence have so many zeros?

A 0 appears whenever the previous term is brand new to the sequence, which happens often because the rule keeps introducing fresh values. Each time a number shows up for the first time, the next term records that it was never seen before by writing 0, so zeros recur throughout the sequence.

What is the 30th term of the Van Eck sequence?

Counting a(0) = 0 as the first term, the 30th term a(29) is 14. That means if you start the count at the initial 0 and move forward 29 more positions, the value you land on is 14. Position numbering matters here, so state your convention clearly.

Who created the Van Eck sequence?

It is named after Jan R. van Eck, who described it; it is catalogued in the OEIS. The OEIS entry gives the sequence a permanent reference number, making it easy to look up terms and related discussion. The name honors van Eck for describing the rule.

Is the Van Eck sequence periodic?

No periodicity is known, and its long-term behaviour is an open problem despite the simple rule. Mathematicians can state the sequence in one sentence, yet questions about how it behaves far out remain unresolved. That contrast between a simple definition and unknown long-term structure is part of its appeal.

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.