login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Lengths of successive rows when the Inventory Sequence A342585 is written as a triangle.
4

%I #23 Nov 04 2023 13:30:18

%S 1,3,4,6,6,8,9,9,11,12,13,13,15,15,17,17,18,19,20,22,22,25,25,25,27,

%T 28,28,30,30,33,33,34,35,35,37,37,39,39,42,42,43,44,47,47,47,49,49,49,

%U 50,52,52,54,54

%N Lengths of successive rows when the Inventory Sequence A342585 is written as a triangle.

%C First differences of A343880, preceded by 1.

%H Michael De Vlieger, <a href="/A347299/b347299.txt">Table of n, a(n) for n = 1..16384</a> (first 10000 terms from Hugo Pfoertner)

%H <a href="/index/In#inventory">Index entries for sequences related to the inventory sequence</a>

%t Prepend[Differences[#], First[#]] &@ Position[Block[{c, k, m}, c[0] = 1; {0}~Join~Reap[Do[k = 0; While[IntegerQ[c[k]], Set[m, c[k]]; Sow[m]; If[IntegerQ@ c[m], c[m]++, c[m] = 1]; k++]; Sow[0]; c[0]++, 52]][[-1, -1]]], 0][[All, 1]] (* _Michael De Vlieger_, Oct 12 2021 *)

%t (* Faster code: *)

%t Block[{c, m, k}, c[_] = 0; Reap[Do[k = 0; While[c[k] > 0, Set[m, c[k]]; c[m]++; k++]; Set[m, c[k]]; Sow[k + 1]; c[m]++, {i, 53}]][[-1, -1]]] (* _Michael De Vlieger_, Nov 13 2021 *)

%o (Python)

%o from collections import Counter

%o def aupton(terms):

%o num, A342585lst, inventory, alst, rowlen = 0, [0], Counter([0]), [1], 0

%o while len(alst) < terms:

%o rowlen += 1

%o c = inventory[num]

%o if c == 0:

%o num = 0

%o alst.append(rowlen)

%o rowlen = 0

%o else:

%o num += 1

%o A342585lst.append(c)

%o inventory.update([c])

%o return alst

%o print(aupton(53)) # _Michael S. Branicky_, Aug 27 2021

%Y Cf. A342585, A343878, A343880.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Aug 27 2021