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.

A352799 Inventory sequence of binary weights.

This page as a plain text file.
%I A352799 #27 Jul 01 2025 23:33:30
%S A352799 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 A352799 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 A352799 15,15,15,4,0,14,16,15,16,5,0,15,18,17,16,6,0,16
%N A352799 Inventory sequence of binary weights.
%C A352799 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 A352799 Michael S. Branicky, <a href="/A352799/b352799.txt">Table of n, a(n) for n = 0..10000</a>
%H A352799 Michael De Vlieger, <a href="/A352799/a352799.png">Log log scatterplot of a(n)</a>, n = 0..1128633, showing a(n) = 0 instead as 1/2 for visibility.
%e A352799 a(0) = 0 because at the start there are no terms, therefore zero terms with binary weight zero.
%e A352799 a(1) = 1 because the first term (0) has binary weight zero and there is just one such term.
%e A352799 a(2) = 1 since a(1) = 1 has weight 1, and there is only one term with this weight.
%e A352799 a(3) = 0 since there are no terms with weight 2. Reset the count to zero weight and repeat.
%e A352799 a(4) = 2 because now there are 2 terms (a(0), a(3)) which have weight 0. And so on.
%e A352799 As an irregular triangle the sequence begins:
%e A352799   0;
%e A352799   1,  1, 0;
%e A352799   2,  3, 1, 0;
%e A352799   3,  4, 2, 0;
%e A352799   4,  7, 2, 1, 0;
%e A352799   5,  9, 4, 1, 0;
%e A352799   6, 11, 5, 2, 0;
%t A352799 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 *)
%o A352799 (Python)
%o A352799 from collections import Counter
%o A352799 def w(n): return bin(n).count("1")
%o A352799 def aupton(nn):
%o A352799     num, alst, inventory = 0, [0], Counter([0])
%o A352799     for n in range(1, nn+1):
%o A352799         c = inventory[num]
%o A352799         num = 0 if c == 0 else num + 1
%o A352799         alst.append(c)
%o A352799         inventory.update([w(c)])
%o A352799     return alst
%o A352799 print(aupton(76)) # _Michael S. Branicky_, Apr 03 2022
%Y A352799 Cf. A000120, A342585, A347317, A347738, A345730, A347791, A348967, A353092.
%K A352799 nonn
%O A352799 0,5
%A A352799 _David James Sycamore_, Apr 03 2022
%E A352799 a(45) and beyond from _Michael S. Branicky_, Apr 03 2022