Let’s call the sequence V so that V(n) is the n-th term of the sequence.
Let’s define V(1) = 0
In order to figure out the next term V(n + 1) you check whether there exists m < n such that V(m) = V(n) (in other words, whether V(n) has appeared before in the sequence)
If such m exists, then V(n + 1) = n − m (in other words, count down how many steps ago such number appears).
If no such m exists, then V(n + 1) = 0.
The resulting sequence is called Van Eck’s sequence, named after Jan Ritsema van Eck, who first submitted it to The On-Line Encyclopedia of Integer Sequences at A181391.
Ony a few facts are known about this sequence (Sloane and others 2013):
- It contains infinitely many zeroes,
- After n terms, there are sometimes terms around n
- As per the definition, it is obvious that V(n) cannot be larger than n
Other than that not much is known. It is conjectured that every positive integer appears at least once in the sequence, but a definitive proof does not exist at the time.
Andy’s Brevity Quest 2019 (229 w) → Across The Universe
Sloane, Neil JA, and others. 2013. “The on-Line Encyclopedia of Integer Sequences.” Ann. Math. Inform 41: 219–34.