OFFSET
0,3
COMMENTS
An Inventory sequence counting the occurrences of distinct terms. After every occurrence of a zero term the count of distinct terms seen so far is recorded, then the count of those seen just once, then twice, etc, until a zero term occurs again, whereupon the count is reset. The first reset occurs after a(0), the first zero term. (see A342585, A348016).
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..24999
EXAMPLE
a(0) must be 0 because at this point no distinct terms have been seen.
Following zero term a(0), we start again, a(1) = 1 since there is only one distinct term in the sequence so far; namely a(0) = 0.
a(2) = 2 because now there are two distinct terms (0,1) each of which have appeared just once.
a(3) = 0 since there are no distinct terms which have appeared twice.
Following zero term a(3) we start again; a(4) = 3, since there are now 3 distinct terms (0,1,2) in the sequence so far.
a(5) = 3 because only three distinct terms (1,2,3) have appeared just once.
a(6) = 2 since there are two terms (0, 3) which have occurred twice.
As an irregular table the sequence starts:
0;
1, 2, 0;
3, 3, 2, 0;
4, 2, 1, 2, 1, 0;
5, 2, 1, 0;
6, 3, 0;
7, 4, 1, 1, 0;
PROG
(Python)
from collections import Counter
def aupton(terms):
num, alst, inventory = 0, [0], Counter([0])
for n in range(2, terms+1):
if num == 0:
c = len(inventory)
else:
c = sum(inventory[i] == num for i in inventory)
num = 0 if c == 0 else num + 1
alst.append(c)
inventory.update([c])
return alst
print(aupton(83)) # Michael S. Branicky, Oct 06 2021
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
David James Sycamore, Sep 29 2021
EXTENSIONS
a(45) and beyond from Michael S. Branicky, Oct 06 2021
STATUS
approved