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.

A354856 a(1) = 1, a(n) = the number of times a(n-1) appears among the first n-2 terms.

This page as a plain text file.
%I A354856 #13 Jul 18 2022 19:26:59
%S A354856 1,0,0,1,1,2,0,2,1,3,0,3,1,4,0,4,1,5,0,5,1,6,0,6,1,7,0,7,1,8,0,8,1,9,
%T A354856 0,9,1,10,0,10,1,11,0,11,1,12,0,12,1,13,0,13,1,14,0,14,1,15,0,15,1,16,
%U A354856 0,16,1,17,0,17,1,18,0,18,1,19,0,19,1,20,0,20
%N A354856 a(1) = 1, a(n) = the number of times a(n-1) appears among the first n-2 terms.
%F A354856 a(4n+1..4n+4) = 1, n+1, 0, n+1 for n >= 1. - _Michael S. Branicky_, Jun 12 2022
%e A354856 a(10) = 3 because a(9) = 1 and 3 other 1s appear before that.
%o A354856 (Python)
%o A354856 from collections import Counter
%o A354856 from itertools import count, islice
%o A354856 def agen(): # generator of terms
%o A354856     anprev, an, inventory = None, 1, Counter()
%o A354856     for n in count(2):
%o A354856         yield an
%o A354856         anprev, an = an, inventory[an]
%o A354856         inventory[anprev] += 1
%o A354856 print(list(islice(agen(), 80))) # _Michael S. Branicky_, Jun 09 2022
%o A354856 (PARI) lista(nn) = my(va=vector(nn)); va[1] = 1; for (n=2, nn, my(vb = vector(n-2, k, va[k])); va[n] = #select(x->(x==va[n-1]), vb);); va; \\ _Michel Marcus_, Jun 13 2022
%Y A354856 Cf. A342585, A347317.
%K A354856 nonn
%O A354856 1,6
%A A354856 _Eric Fox_, Jun 09 2022
%E A354856 a(54) and beyond from _Michael S. Branicky_, Jun 12 2022