login
A347564
Record the number of distinct terms seen thus far, then the number of distinct terms seen only once, then twice, and so on until recording a zero; whereupon repeat the count.
3
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, 8, 4, 0, 9, 5, 1, 2, 0, 10, 5, 0, 11, 6, 1, 3, 1, 0, 12, 6, 0, 13, 7, 1, 3, 0, 14, 7, 0, 15, 8, 1, 4, 1, 1, 1, 0, 16, 8, 0, 17, 9, 1, 4, 0, 18, 9, 0, 19, 10, 1, 5, 1, 2, 0, 20, 10, 0
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
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
Sequence in context: A094112 A333303 A326926 * A105569 A068455 A329098
KEYWORD
nonn,tabf
AUTHOR
EXTENSIONS
a(45) and beyond from Michael S. Branicky, Oct 06 2021
STATUS
approved