cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A171916 Van Eck's sequence (cf. A181391) starting with a(1) = 6.

This page as a plain text file.
%I A171916 #15 Jan 09 2022 22:49:07
%S A171916 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 A171916 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 A171916 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 A171916 Van Eck's sequence (cf. A181391) starting with a(1) = 6.
%C A171916 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 A171916 (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 A171916 (Python)
%o A171916 from itertools import count, islice
%o A171916 def A171916gen(): # generator of terms
%o A171916     b, bdict = 6, {6:(1,)}
%o A171916     for n in count(2):
%o A171916         yield b
%o A171916         if len(l := bdict[b]) > 1:
%o A171916             b = n-1-l[-2]
%o A171916         else:
%o A171916             b = 0
%o A171916         if b in bdict:
%o A171916             bdict[b] = (bdict[b][-1],n)
%o A171916         else:
%o A171916             bdict[b] = (n,)
%o A171916 A171916_list = list(islice(A171916gen(),20)) # _Chai Wah Wu_, Dec 21 2021
%Y A171916 Cf. A181391, A171911, ..., A171918 (same but starting with 0, 1, ..., 8).
%K A171916 nonn
%O A171916 1,1
%A A171916 _N. J. A. Sloane_, Oct 22 2010
%E A171916 Name edited and cross-references added by _M. F. Hasler_, Jun 15 2019