Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #15 Jan 09 2022 22:49:07
%S 6,0,0,1,0,2,0,2,2,1,6,10,0,6,3,0,3,2,9,0,4,0,2,5,0,3,9,8,0,4,9,4,2,
%T 10,22,0,7,0,2,6,26,0,4,11,0,3,20,0,3,3,1,41,0,5,30,0,3,7,21,0,4,18,0,
%U 3,7,7,1,16,0,6,30,16,4,12,0,6,6,1,11,35,0,6,5,29,0,4,13,0,3,25,0
%N Van Eck's sequence (cf. A181391) starting with a(1) = 6.
%C 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
%o (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
%o (Python)
%o from itertools import count, islice
%o def A171916gen(): # generator of terms
%o b, bdict = 6, {6:(1,)}
%o for n in count(2):
%o yield b
%o if len(l := bdict[b]) > 1:
%o b = n-1-l[-2]
%o else:
%o b = 0
%o if b in bdict:
%o bdict[b] = (bdict[b][-1],n)
%o else:
%o bdict[b] = (n,)
%o A171916_list = list(islice(A171916gen(),20)) # _Chai Wah Wu_, Dec 21 2021
%Y Cf. A181391, A171911, ..., A171918 (same but starting with 0, 1, ..., 8).
%K nonn
%O 1,1
%A _N. J. A. Sloane_, Oct 22 2010
%E Name edited and cross-references added by _M. F. Hasler_, Jun 15 2019