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.

A171913 Van Eck sequence (cf. A181391) starting with a(1) = 3.

This page as a plain text file.
%I A171913 #26 Dec 21 2021 12:20:27
%S A171913 3,0,0,1,0,2,0,2,2,1,6,0,5,0,2,6,5,4,0,5,3,20,0,4,6,9,0,4,4,1,20,9,6,
%T A171913 8,0,8,2,22,0,4,11,0,3,22,6,12,0,5,28,0,3,8,16,0,4,15,0,3,7,0,3,3,1,
%U A171913 33,0,5,18,0,3,7,11,30,0,5,8,23,0,4,23,3,11,10,0,6,39,0,3,7,18,22
%N A171913 Van Eck sequence (cf. A181391) starting with a(1) = 3.
%C A171913 A van Eck sequence is defined recursively 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 12 2019
%F A171913 a(n+1) = A181391(n) up to the first occurrence of a(1) = 3 in A181391. - _M. F. Hasler_, Jun 15 2019
%t A171913 t = {3};
%t A171913 Do[
%t A171913 d = Quiet[Check[Position[t, Last[t]][[-2]][[1]], 0]];
%t A171913 If[d == 0, x = 0, x = Length[t] - d];
%t A171913 AppendTo[t, x], 100]
%t A171913 t  (* _Horst H. Manninger_, Sep 08 2020 *)
%o A171913 (PARI) A171913_vec(N, a=3, 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 A171913 (Python)
%o A171913 from itertools import count, islice
%o A171913 def A171913gen(): # generator of terms
%o A171913     b, bdict = 3, {3:(1,)}
%o A171913     for n in count(2):
%o A171913         yield b
%o A171913         if len(l := bdict[b]) > 1:
%o A171913             b = n-1-l[-2]
%o A171913         else:
%o A171913             b = 0
%o A171913         if b in bdict:
%o A171913             bdict[b] = (bdict[b][-1],n)
%o A171913         else:
%o A171913             bdict[b] = (n,)
%o A171913 A171913_list = list(islice(A171913gen(),20)) # _Chai Wah Wu_, Dec 21 2021
%Y A171913 Cf. A181391, A171911, ..., A171918 (same but starting with 0, 1, ..., 8).
%K A171913 nonn
%O A171913 1,1
%A A171913 _N. J. A. Sloane_, Oct 22 2010
%E A171913 Name edited and cross-references added by _M. F. Hasler_, Jun 15 2019