Van Eck's Sequence — Definition, Formula & Example
Van Eck's sequence is a self-referential list of whole numbers that starts with 0. Each new term tells you how many steps back the previous term last appeared, or is 0 if the previous term has never appeared before.
Van Eck's sequence (OEIS A181391) is defined by and, for : if there is an index with , then for the largest such ; otherwise . Its first terms are
Key Formula
Where:
- = The current term, at position n (positions start at 0)
- = The most recent earlier position where the value appeared
- = The gap between the current position and that earlier appearance
Worked Example
Problem: The first eight terms of Van Eck's sequence are through : 0, 0, 1, 0, 2, 0, 2, 2. Find , , and .
Step 1: Look at . Before position 7, the value 2 last appeared at position 6. The gap is the difference of the positions.
Step 2: Now look at . Before position 8, the value 1 last appeared at position 2.
Step 3: Now look at . The value 6 has never appeared before, so the next term is 0.
Answer: The next three terms are , , and , so the sequence continues 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0.
Why It Matters
Van Eck's sequence shows how a one-line rule can produce behavior no one fully understands. It is proven that 0 appears infinitely often and that the sequence is unbounded, so it diverges. Whether every positive integer eventually appears is still an open question. It is also a standard programming exercise: storing the last position of each value in a dictionary lets you generate millions of terms quickly.
Common Mistakes
Mistake: Measuring the gap back to the first time a value appeared instead of the most recent time.
Correction: Always use the latest earlier position. At , the value 2 appeared at positions 4 and 6. The correct gap is , not . Also count positions from 0, not 1.
