A347738 A variant of the inventory sequence: record the number of terms >= 0 thus far in the sequence, then the number of terms >= 1 thus far, then the number of terms >= 2 thus far, and so on, until a zero is recorded; the inventory then starts again, recording the number of terms >= 0, etc.
0, 1, 1, 0, 4, 3, 2, 2, 1, 0, 10, 8, 6, 5, 5, 5, 3, 2, 2, 1, 1, 0, 22, 19, 15, 12, 11, 11, 9, 9, 10, 10, 9, 6, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 0, 46, 42, 35, 28, 24, 23, 21, 20, 21, 21, 19, 17, 16, 16, 17, 18, 18, 17, 15, 13, 11, 10, 7, 6, 5, 4, 4, 4, 4, 3, 3
Offset: 0
Examples
As an irregular triangle this begins: 0; 1, 1, 0; 4, 3, 2, 2, 1, 0; 10, 8, 6, 5, 5, 5, 3, 2, 2, 1, 1, 0; 22, 19, 15, 12, 11, 11, 9, 9, 10, 10, 9, 6, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 0; 46, ... (for row lengths see A003945)
Links
- Michael De Vlieger, Table of n, a(n) for n = 0..24573 (rows 0 <= k <= 12 when considered as an irregular triangle)
- Michael De Vlieger, log-log scatterplot of a(n) for 1 <= n <= 49150 (ignoring zeros).
Crossrefs
Programs
-
Mathematica
a[n_] := a[n] = Block[{t}, t = If[a[n - 1] == 0, 0, b[n - 1] + 1]; b[n] = t; Sum[If[a[j] >= t, 1, 0], {j, n - 1}]]; b[1] = a[1] = 0; Array[a, 77] (* Michael De Vlieger, Sep 12 2021, after Jean-François Alcover at A342585 *)
-
Python
def aupton(nn): num, gte_inventory, alst, bigc = 0, [1], [0], 0 while len(alst) < nn+1: c = gte_inventory[num] if num <= bigc else 0 num = 0 if c == 0 else num + 1 for i in range(min(c, bigc)+1): gte_inventory[i] += 1 for i in range(bigc+1, c+1): gte_inventory.append(1) bigc = len(gte_inventory) - 1 alst.append(c) return alst print(aupton(76)) # Michael S. Branicky, Sep 19 2021
Extensions
Offset changed to 0 by N. J. A. Sloane, Sep 12 2021
Comments