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.

A361287 A variant of the inventory sequence A342585: now a row ends when the number of occurrences of the largest term in the sequence thus far has been recorded.

This page as a plain text file.
%I A361287 #51 Mar 20 2023 16:33:20
%S A361287 0,1,1,1,3,0,1,2,4,1,1,1,2,7,2,1,1,0,0,1,4,10,3,2,2,0,0,1,0,0,1,8,12,
%T A361287 5,2,2,1,0,1,1,0,1,0,1,11,17,7,2,2,1,0,2,1,0,1,1,1,0,0,0,0,1,17,23,10,
%U A361287 2,2,1,0,2,1,0,2,1,1,0,0,0,0,2,0,0,0,0,0
%N A361287 A variant of the inventory sequence A342585: now a row ends when the number of occurrences of the largest term in the sequence thus far has been recorded.
%H A361287 Samuel Harkness, <a href="/A361287/b361287.txt">Table of n, a(n) for n = 0..12000</a>
%F A361287 a(n) is the number of all a(k) == b(n) 0 <= k < n and b(0) = 0 and b(n) = b(n-1)+1 if an a(k) > b(n) exists for 0 <= k < n, and 0 otherwise.
%e A361287 The triangle begins:
%e A361287   0;
%e A361287   1, 1;
%e A361287   1, 3, 0, 1;
%e A361287   2, 4, 1, 1, 1;
%e A361287   2, 7, 2, 1, 1, 0, 0, 1;
%e A361287   4, 10, 3, 2, 2, 0, 0, 1, 0, 0, 1;
%e A361287   8, 12, 5, 2, 2, 1, 0, 1, 1, 0, 1, 0, 1;
%e A361287  11, 17, 7, 2, 2, 1, 0, 2, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1;
%e A361287  17, 23, 10, 2, 2, 1, 0, 2, 1, 0, 2, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1;
%e A361287 ...
%e A361287 a(0)=0 because we begin each row by recording the number of zeros in the sequence. As yet, there are none. 0 is still the largest term in the sequence, so we begin the next row.
%e A361287 a(1)=1 because there is one 0. a(2)=1 because there is one 1. 1 is the largest term thus far, so we begin the next row.
%e A361287 a(3)=1 (there is still one zero); a(4)=3 (there are three 1s); a(5)=0 (no 2s); the row ends with a(6)=1 because there is one 3 and three is the largest term thus far.
%t A361287 len = 84; K = {0}; While[Length@K <= len, i = 0; While[i <= Max@K, AppendTo[K, Count[K, i]]; i++]]; Print[Take[K, len + 1]] (* _Samuel Harkness_, Mar 12 2023 *)
%o A361287 (Python)
%o A361287 from collections import Counter
%o A361287 from itertools import count, islice
%o A361287 def agen(): # generator of terms
%o A361287     an, b, m, inventory = 0, 0, 0, Counter([0])
%o A361287     for n in count(1):
%o A361287         yield an
%o A361287         an = inventory[b]
%o A361287         m = max(m, an)
%o A361287         b = b + 1 if m > b else 0; inventory.update([an])
%o A361287 print(list(islice(agen(), 85))) # _Michael S. Branicky_, Mar 07 2023
%Y A361287 Cf. A342585, A347317.
%K A361287 nonn,tabf
%O A361287 0,5
%A A361287 _Robert Dober_, Mar 07 2023
%E A361287 More terms from _Alois P. Heinz_, Mar 07 2023