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.

A355916 Variant of Inventory Sequence A342585 where indices are also counted (long version).

This page as a plain text file.
%I A355916 #36 Sep 25 2022 21:35:03
%S A355916 0,0,2,0,0,1,4,0,1,1,1,2,0,3,6,0,4,1,2,2,1,3,2,4,0,5,8,0,6,1,5,2,2,3,
%T A355916 3,4,2,5,2,6,0,7,10,0,7,1,9,2,4,3,5,4,4,5,3,6,2,7,1,8,1,9,1,10,0,11,
%U A355916 12,0,11,1,11,2,6,3,7,4,5,5,5,6,4,7,2,8,2,9,2,10,3,11,1,12,0,13,14,0,13,1,15,2,8,3,9,4,8,5,6,6,5,7,5,8,4,9,3,10,4,11,2,12,2,13,1,14,1,15,0,16
%N A355916 Variant of Inventory Sequence A342585 where indices are also counted (long version).
%C A355916 Similar to A342585, except that when we take inventory, we write down what we are counting as a subscript on the count. So if we have found k copies of m so far, we write down k_m, and include both the k and m values when we next take inventory.
%C A355916 More than the usual number of terms are shown, in order to match A355917.
%H A355916 Rémy Sigrist, <a href="/A355916/b355916.txt">Table of n, a(n) for n = 1..10020</a>
%H A355916 Rémy Sigrist, <a href="/A355916/a355916.gp.txt">PARI program</a>
%H A355916 N. J. A. Sloane, <a href="/A355916/a355916.png">The first eight inventories</a>, with better alignment.
%e A355916 Initially we have no 0's, so the first inventory is 0_0. Just as in A342585, when we reach a count of zero, we take a new inventory.
%e A355916 Now we see two 0's, so we write down 2_0, followed by 0_1, since there are no 1's.
%e A355916 So the first two inventories are
%e A355916   0_0,
%e A355916   2_0, 0_1.
%e A355916 Now we see four 0's, so the next inventory starts 4_0, then 1_1, 1_2, and 0_3:
%e A355916   4_0, 1_1, 1_2, 0_3.
%e A355916 The first eight inventories are:
%e A355916   0_0,
%e A355916   2_0, 0_1,
%e A355916   4_0, 1_1, 1_2, 0_3,
%e A355916   6_0, 4_1, 2_2, 1_3, 2_4, 0_5,
%e A355916   8_0, 6_1, 5_2, 2_3, 3_4, 2_5, 2_6, 0_7,
%e A355916   10_0, 7_1, 9_2, 4_3, 5_4, 4_5, 3_6, 2_7, 1_8, 1_9, 1_10, 0_11,
%e A355916   12_0, 11_1, 11_2, 6_3, 7_4, 5_5, 5_6, 4_7, 2_8, 2_9, 2_10, 3_11, 1_12, 0_13,
%e A355916   14_0, 13_1, 15_2, 8_3, 9_4, 8_5, 6_6, 5_7, 5_8, 4_9, 3_10, 4_11, 2_12, 2_13, 1_14, 1_15, 0_16,
%e A355916 ...
%e A355916 The sequence is obtained by reading the inventories, with each count followed by its index: 0, 0, 2, 0, 0, 1, 4, 0, 1, 1, 1, 2, 0, 3, ...
%e A355916 If the indices are omitted, we get the short version, A355917. A355918 lists the highest index in each inventory.
%t A355916 nn = 9; c[_] = 0; a[1] = a[2] = 0; c[0] = 2; i = 3; Do[k = 0; While[c[k] > 0, Set[{a[i], a[i + 1]}, {c[k], k}]; c[a[i]]++; c[a[i + 1]]++; i += 2; k++]; Set[{a[i], a[i + 1]}, {c[k], k}]; c[a[i]]++; c[a[i + 1]]++; i += 2, {n, 2, nn}]; Array[a, i - 1] (* _Michael De Vlieger_, Sep 25 2022 *)
%o A355916 (PARI) See Links section.
%o A355916 (Python)
%o A355916 from collections import Counter
%o A355916 def aupton(terms):
%o A355916     num, alst, inventory = 0, [0, 0], Counter([0, 0])
%o A355916     for n in range(3, 3+terms//2):
%o A355916         c = [inventory[num], num]
%o A355916         num = 0 if c[0] == 0 else num + 1
%o A355916         alst.extend(c)
%o A355916         inventory.update(c)
%o A355916     return alst[:terms]
%o A355916 print(aupton(128)) # _Michael S. Branicky_, Sep 25 2022
%Y A355916 Cf. A342585, A355917, A355918.
%K A355916 nonn
%O A355916 1,3
%A A355916 _N. J. A. Sloane_, Sep 24 2022