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.

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.

This page as a plain text file.
%I A347564 #49 Jan 16 2022 13:05:21
%S A347564 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,
%T A347564 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,
%U A347564 17,9,1,4,0,18,9,0,19,10,1,5,1,2,0,20,10,0
%N 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.
%C A347564 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).
%H A347564 Michael S. Branicky, <a href="/A347564/b347564.txt">Table of n, a(n) for n = 0..24999</a>
%e A347564 a(0) must be 0 because at this point no distinct terms have been seen.
%e A347564 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.
%e A347564 a(2) = 2 because now there are two distinct terms (0,1) each of which have appeared just once.
%e A347564 a(3) = 0 since there are no distinct terms which have appeared twice.
%e A347564 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.
%e A347564 a(5) = 3 because only three distinct terms (1,2,3) have appeared just once.
%e A347564 a(6) = 2 since there are two terms (0, 3) which have occurred twice.
%e A347564 As an irregular table the sequence starts:
%e A347564 0;
%e A347564 1, 2, 0;
%e A347564 3, 3, 2, 0;
%e A347564 4, 2, 1, 2, 1, 0;
%e A347564 5, 2, 1, 0;
%e A347564 6, 3, 0;
%e A347564 7, 4, 1, 1, 0;
%o A347564 (Python)
%o A347564 from collections import Counter
%o A347564 def aupton(terms):
%o A347564     num, alst, inventory = 0, [0], Counter([0])
%o A347564     for n in range(2, terms+1):
%o A347564         if num == 0:
%o A347564             c = len(inventory)
%o A347564         else:
%o A347564             c = sum(inventory[i] == num for i in inventory)
%o A347564         num = 0 if c == 0 else num + 1
%o A347564         alst.append(c)
%o A347564         inventory.update([c])
%o A347564     return alst
%o A347564 print(aupton(83)) # _Michael S. Branicky_, Oct 06 2021
%Y A347564 Cf. A342585, A348016.
%K A347564 nonn,tabf
%O A347564 0,3
%A A347564 _David James Sycamore_, Sep 29 2021
%E A347564 a(45) and beyond from _Michael S. Branicky_, Oct 06 2021