login

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

Binary weight (number of ones in binary expansion) of the n-th squarefree number.
25

%I #14 Aug 03 2024 01:52:49

%S 1,1,2,2,2,3,2,3,3,3,4,2,3,3,3,4,3,4,4,5,2,2,3,3,3,4,3,3,4,4,5,4,4,5,

%T 4,4,5,5,5,2,2,3,3,3,4,3,3,4,4,5,3,4,4,4,5,4,5,5,5,6,3,4,4,5,4,4,5,5,

%U 5,6,4,4,5,5,6,5,6,7,2,2,3,3,3,3,3,4,4

%N Binary weight (number of ones in binary expansion) of the n-th squarefree number.

%H MathOverflow, <a href="http://mathoverflow.net/questions/22629">Are there primes of every Hamming weight?</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Hamming_weight">Hamming weight</a>.

%F a(n) = A000120(A005117(n)).

%F a(n) + A372472(n) = A372475(n) = A070939(A005117(n)).

%t DigitCount[Select[Range[100],SquareFreeQ],2,1]

%o (Python)

%o from math import isqrt

%o from sympy import mobius

%o def A372433(n):

%o def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))

%o m, k = n, f(n)

%o while m != k:

%o m, k = k, f(k)

%o return int(m).bit_count() # _Chai Wah Wu_, Aug 02 2024

%Y Restriction of A000120 to A005117.

%Y For prime instead of squarefree we have A014499, zeros A035103.

%Y Counting zeros instead of ones gives A372472, cf. A023416, A372473.

%Y For binary length instead of weight we have A372475.

%Y A003714 lists numbers with no successive binary indices.

%Y A030190 gives binary expansion, reversed A030308.

%Y A048793 lists positions of ones in reversed binary expansion, sum A029931.

%Y A145037 counts ones minus zeros in binary expansion, cf. A031443, A031444, A031448, A097110.

%Y A371571 lists positions of zeros in binary expansion, sum A359359.

%Y A371572 lists positions of ones in binary expansion, sum A230877.

%Y A372515 lists positions of zeros in reversed binary expansion, sum A359400.

%Y A372516 counts ones minus zeros in binary expansion of primes, cf. A177718, A177796, A372538, A372539.

%Y Cf. A039004, A049093, A049094, A059015, A069010, A070939, A073642, A211997, A368494, A372474.

%K nonn,base

%O 1,3

%A _Gus Wiseman_, May 04 2024