login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Inventory sequence of binary weights.
2

%I #19 Apr 18 2022 09:46:21

%S 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,7,12,7,4,0,8,

%T 14,7,6,0,9,14,9,7,0,10,14,11,10,0,11,14,12,12,0,12,14,15,13,1,0,13,

%U 15,15,15,4,0,14,16,15,16,5,0,15,18,17,16,6,0,16

%N Inventory sequence of binary weights.

%C 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.

%H Michael S. Branicky, <a href="/A352799/b352799.txt">Table of n, a(n) for n = 0..10000</a>

%e a(0) = 0 because at the start there are no terms, therefore zero terms with binary weight zero.

%e a(1) = 1 because the first term (0) has binary weight zero and there is just one such term.

%e a(2) = 1 since a(1) = 1 has weight 1, and there is only one term with this weight.

%e a(3) = 0 since there are no terms with weight 2. Reset the count to zero weight and repeat.

%e a(4) = 2 because now there are 2 terms (a(0), a(3)) which have weight 0. And so on.

%e As an irregular triangle the sequence begins:

%e 0;

%e 1, 1, 0;

%e 2, 3, 1, 0;

%e 3, 4, 2, 0;

%e 4, 7, 2, 1, 0;

%e 5, 9, 4, 1, 0;

%e 6, 11, 5, 2, 0;

%o (Python)

%o from collections import Counter

%o def w(n): return bin(n).count("1")

%o def aupton(nn):

%o num, alst, inventory = 0, [0], Counter([0])

%o for n in range(1, nn+1):

%o c = inventory[num]

%o num = 0 if c == 0 else num + 1

%o alst.append(c)

%o inventory.update([w(c)])

%o return alst

%o print(aupton(76)) # _Michael S. Branicky_, Apr 03 2022

%Y Cf. A000120, A342585, A347317, A347738, A345730, A347791, A348967.

%K nonn

%O 0,5

%A _David James Sycamore_, Apr 03 2022

%E a(45) and beyond from _Michael S. Branicky_, Apr 03 2022