OFFSET
0,5
COMMENTS
Record the number of terms with binary weight zero, then successively record those with weights 1,2,... (including in the count the weights of new terms as they are recorded), until reaching a weight w for which there are zero terms with that weight, whereupon record a zero term. Repeat.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
EXAMPLE
a(0) = 0 because at the start there are no terms, therefore zero terms with binary weight zero.
a(1) = 1 because the first term (0) has binary weight zero and there is just one such term.
a(2) = 1 since a(1) = 1 has weight 1, and there is only one term with this weight.
a(3) = 0 since there are no terms with weight 2. Reset the count to zero weight and repeat.
a(4) = 2 because now there are 2 terms (a(0), a(3)) which have weight 0. And so on.
As an irregular triangle the sequence begins:
0;
1, 1, 0;
2, 3, 1, 0;
3, 4, 2, 0;
4, 7, 2, 1, 0;
5, 9, 4, 1, 0;
6, 11, 5, 2, 0;
PROG
(Python)
from collections import Counter
def w(n): return bin(n).count("1")
def aupton(nn):
num, alst, inventory = 0, [0], Counter([0])
for n in range(1, nn+1):
c = inventory[num]
num = 0 if c == 0 else num + 1
alst.append(c)
inventory.update([w(c)])
return alst
print(aupton(76)) # Michael S. Branicky, Apr 03 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Apr 03 2022
EXTENSIONS
a(45) and beyond from Michael S. Branicky, Apr 03 2022
STATUS
approved