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.

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

This page as a plain text file.
%I A347299 #23 Nov 04 2023 13:30:18
%S A347299 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 A347299 28,28,30,30,33,33,34,35,35,37,37,39,39,42,42,43,44,47,47,47,49,49,49,
%U A347299 50,52,52,54,54
%N A347299 Lengths of successive rows when the Inventory Sequence A342585 is written as a triangle.
%C A347299 First differences of A343880, preceded by 1.
%H A347299 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 A347299 <a href="/index/In#inventory">Index entries for sequences related to the inventory sequence</a>
%t A347299 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 A347299 (* Faster code: *)
%t A347299 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 A347299 (Python)
%o A347299 from collections import Counter
%o A347299 def aupton(terms):
%o A347299     num, A342585lst, inventory, alst, rowlen = 0, [0], Counter([0]), [1], 0
%o A347299     while len(alst) < terms:
%o A347299         rowlen += 1
%o A347299         c = inventory[num]
%o A347299         if c == 0:
%o A347299             num = 0
%o A347299             alst.append(rowlen)
%o A347299             rowlen = 0
%o A347299         else:
%o A347299             num += 1
%o A347299         A342585lst.append(c)
%o A347299         inventory.update([c])
%o A347299     return alst
%o A347299 print(aupton(53)) # _Michael S. Branicky_, Aug 27 2021
%Y A347299 Cf. A342585, A343878, A343880.
%K A347299 nonn
%O A347299 1,2
%A A347299 _N. J. A. Sloane_, Aug 27 2021