login
A355916
Variant of Inventory Sequence A342585 where indices are also counted (long version).
6
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, 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, 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
OFFSET
1,3
COMMENTS
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.
More than the usual number of terms are shown, in order to match A355917.
LINKS
Rémy Sigrist, PARI program
N. J. A. Sloane, The first eight inventories, with better alignment.
EXAMPLE
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.
Now we see two 0's, so we write down 2_0, followed by 0_1, since there are no 1's.
So the first two inventories are
0_0,
2_0, 0_1.
Now we see four 0's, so the next inventory starts 4_0, then 1_1, 1_2, and 0_3:
4_0, 1_1, 1_2, 0_3.
The first eight inventories are:
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, 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,
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,
...
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, ...
If the indices are omitted, we get the short version, A355917. A355918 lists the highest index in each inventory.
MATHEMATICA
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 *)
PROG
(PARI) See Links section.
(Python)
from collections import Counter
def aupton(terms):
num, alst, inventory = 0, [0, 0], Counter([0, 0])
for n in range(3, 3+terms//2):
c = [inventory[num], num]
num = 0 if c[0] == 0 else num + 1
alst.extend(c)
inventory.update(c)
return alst[:terms]
print(aupton(128)) # Michael S. Branicky, Sep 25 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 24 2022
STATUS
approved