A352799 Inventory sequence of binary weights.
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, 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, 15, 15, 15, 4, 0, 14, 16, 15, 16, 5, 0, 15, 18, 17, 16, 6, 0, 16
Offset: 0
Keywords
Examples
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;
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..10000
- Michael De Vlieger, Log log scatterplot of a(n), n = 0..1128633, showing a(n) = 0 instead as 1/2 for visibility.
Programs
-
Mathematica
Block[{a, c, j, k, m}, a[1] = c[] = 0; j = c[0] = 1; Do[k = 0; While[c[k] > 0, j++; Set[m, c[k]]; Set[a[j], m]; c[If[m < 1, 0, DigitCount[m, 2, 1] ] ]++; k++]; j++; Set[a[j], 0]; c[0]++, 25]; Array[a, j] ] (* _Michael De Vlieger, Jun 25 2025 *)
-
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
Extensions
a(45) and beyond from Michael S. Branicky, Apr 03 2022
Comments