A372433 Binary weight (number of ones in binary expansion) of the n-th squarefree number.
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, 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, 5, 6, 4, 4, 5, 5, 6, 5, 6, 7, 2, 2, 3, 3, 3, 3, 3, 4, 4
Offset: 1
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
- MathOverflow, Are there primes of every Hamming weight?
- Wikipedia, Hamming weight.
Crossrefs
Programs
-
Mathematica
DigitCount[Select[Range[100],SquareFreeQ],2,1] Total[IntegerDigits[#,2]]&/@Select[Range[200],SquareFreeQ] (* Harvey P. Dale, Feb 14 2025 *)
-
Python
from math import isqrt from sympy import mobius def A372433(n): def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1)) m, k = n, f(n) while m != k: m, k = k, f(k) return int(m).bit_count() # Chai Wah Wu, Aug 02 2024