OFFSET
1,1
COMMENTS
Van Eck's sequence is defined by a(n+1) = min { k > 0 | a(n-k) = a(n) } or 0 if this set is empty, i.e., a(n) does not appear earlier in the sequence. - M. F. Hasler, Jun 15 2019
PROG
(PARI) A171916_vec(N, a=6, i=Map())={vector(N, n, a=if(n>1, iferr(n-mapget(i, a), E, 0)+mapput(i, a, n), a))} \\ M. F. Hasler, Jun 15 2019
(Python)
from itertools import count, islice
def A171916gen(): # generator of terms
b, bdict = 6, {6:(1, )}
for n in count(2):
yield b
if len(l := bdict[b]) > 1:
b = n-1-l[-2]
else:
b = 0
if b in bdict:
bdict[b] = (bdict[b][-1], n)
else:
bdict[b] = (n, )
A171916_list = list(islice(A171916gen(), 20)) # Chai Wah Wu, Dec 21 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 22 2010
EXTENSIONS
Name edited and cross-references added by M. F. Hasler, Jun 15 2019
STATUS
approved