A347317 An alternative version of the inventory sequence A342585: now a row only ends when a 0 is reached that would not be followed by any further terms.
0, 1, 1, 0, 2, 2, 2, 0, 3, 2, 4, 1, 1, 0, 4, 4, 4, 1, 4, 0, 5, 5, 4, 1, 6, 2, 1, 0, 6, 7, 5, 1, 6, 3, 3, 1, 0, 7, 9, 5, 3, 6, 4, 4, 2, 0, 1, 0, 9, 10, 6, 4, 9, 4, 5, 2, 0, 3, 1, 0, 11, 11, 7, 5, 10, 6, 6, 3, 0, 3, 2, 2, 0
Offset: 0
Examples
The triangle begins: 0; 1, 1, 0; 2, 2, 2, 0; 3, 2, 4, 1, 1, 0; 4, 4, 4, 1, 4, 0; 5, 5, 4, 1, 6, 2, 1, 0; 6, 7, 5, 1, 6, 3, 3, 1, 0; 7, 9, 5, 3, 6, 4, 4, 2, 0, 1, 0; 9, 10, 6, 4, 9, 4, 5, 2, 0, 3, 1, 0; 11, 11, 7, 5, 10, 6, 6, 3, 0, 3, 2, 2, 0; ...
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..25000
Programs
-
Mathematica
Block[{c, k, m, r = 0}, c[0] = 1; {0}~Join~Reap[Do[k = 0; While[k <= r, If[IntegerQ@ c[k], Set[m, c[k]], Set[c[k], 0]; Set[m, 0]]; If[m > r, r = m]; Sow[m]; If[IntegerQ@ c[m], c[m]++, c[m] = 1]; k++]; Sow[0]; c[0]++, 9]][[-1, -1]]] (* Michael De Vlieger, Oct 12 2021 *)
-
Python
from collections import Counter def aupton(terms): num, alst, inventory = 0, [0], Counter([0]) for n in range(2, terms+1): c = inventory[num] if c == 0 and num > max(inventory): num = 0 else: num += 1 alst.append(c); inventory.update([c]) return alst print(aupton(73)) # Michael S. Branicky, Sep 09 2021
Comments