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.

A309363 Van Eck's sequence (cf. A181391), but outputting 2 for a new number, not 0.

This page as a plain text file.
%I A309363 #20 Dec 21 2021 12:19:30
%S A309363 0,2,2,1,2,2,1,3,2,3,2,2,1,6,2,3,6,3,2,4,2,2,1,10,2,3,8,2,3,3,1,8,5,2,
%T A309363 6,18,2,3,8,7,2,4,22,2,3,7,6,12,2,5,17,2,3,8,15,2,4,15,3,6,13,2,6,3,5,
%U A309363 15,8,13,7,23,2,9,2,2,1,44
%N A309363 Van Eck's sequence (cf. A181391), but outputting 2 for a new number, not 0.
%C A309363 After the initial value, the sequence is extended by a(n+1) = min { k > 0: a(n-k) = a(n) } or 2 if no such k exists, i.e., if a(n) did not appear earlier.
%C A309363 Although the sequence has properties that are superficially similar to the original A181391, there is an important difference. Using a positive number m instead of 0 to mark a new value means there is no 1-to-1 correspondence between the occurrence of a new value and the occurrence of m. - _Jan Ritsema van Eck_, Aug 14 2019
%H A309363 Rémy Sigrist, <a href="/A309363/b309363.txt">Table of n, a(n) for n = 1..25000</a>
%o A309363 (Python)
%o A309363 from itertools import count, islice
%o A309363 def A309363gen(): # generator of terms
%o A309363     b, bdict = 0, {0:(1,)}
%o A309363     for n in count(2):
%o A309363         yield b
%o A309363         if len(l := bdict[b]) > 1:
%o A309363             b = n-1-l[-2]
%o A309363         else:
%o A309363             b = 2
%o A309363         if b in bdict:
%o A309363             bdict[b] = (bdict[b][-1],n)
%o A309363         else:
%o A309363             bdict[b] = (n,)
%o A309363 A309363_list = list(islice(A309363gen(),20)) # _Chai Wah Wu_, Dec 21 2021
%Y A309363 Cf. A181391, A171911, ..., A171918 (same but starting with 0, 1, 2, ..., 8 and returning 0 when a new term appears).
%K A309363 nonn
%O A309363 1,2
%A A309363 _Nicholas FitzGerald_, Jul 25 2019