Van Eck sequence
From Fōrmulæ wiki
This page is a solution to the task Van Eck sequence in the Rosetta Code, written in Fōrmulæ.
Description (from Rosetta Code)
The sequence is generated by following this pseudocode:
A: The first term is zero. Repeatedly apply: If the last term is *new* to the sequence so far then: B: The next term is zero. Otherwise: C: The next term is how far back this last term occured previousely.
Using A:
Using B:
Using C:
Using B:
Using C: (zero last occured two steps back  before the one)
Using B:
Using C: (two last occured two steps back  before the zero)
Using C: (two last occured one step back)
Using C: (one last appeared six steps back)
etc. Task

Program
Use cases
Let us store the complete sequence:
The first ten terms of the sequence:
Terms 991  to  1000 of the sequence: