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.

Original entry on oeis.org

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, 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, 2, 2, 1, 0, 2, 1, 0, 2, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Robert Dober, Mar 07 2023

Keywords

Examples

			The triangle begins:
  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, 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, 2, 2, 1, 0, 2, 1, 0, 2, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1;
...
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.
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.
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.
		

Crossrefs

Programs

  • Mathematica
    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 *)
  • Python
    from collections import Counter
    from itertools import count, islice
    def agen(): # generator of terms
        an, b, m, inventory = 0, 0, 0, Counter([0])
        for n in count(1):
            yield an
            an = inventory[b]
            m = max(m, an)
            b = b + 1 if m > b else 0; inventory.update([an])
    print(list(islice(agen(), 85))) # Michael S. Branicky, Mar 07 2023

Formula

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.

Extensions

More terms from Alois P. Heinz, Mar 07 2023