A352085 a(n) is the quotient wt(m^2) / wt(m), where wt = binary weight = A000120 and m = A352084(n).
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2
Offset: 1
Examples
For n=19, A352084(19) = 42_10 = 101010_2 => wt(42) = 3 ones; then 42^2 = 1764_10 = 11011100100_2 => wt(1764) = 6 ones, so that a(19) = wt(42^2) / wt(42) = 6/3 = 2.
Links
- Martin Ehrenstein, Table of n, a(n) for n = 1..10000
- Diophante, A1730 - Des chiffres à sommer pour un entier (in French).
Programs
-
Mathematica
Select[Total[IntegerDigits[#^2, 2]]/Total[IntegerDigits[#, 2]] & /@ Range[300], IntegerQ] (* Amiram Eldar, Mar 05 2022 *)
-
PARI
lista(nn) = my(list = List(), q); for (n=1, nn, if (denominator(q=hammingweight(n^2)/hammingweight(n)) == 1, listput(list, q));); Vec(list); \\ Michel Marcus, Mar 05 2022
-
Python
from itertools import count, islice def agen(): # generator of terms for m in count(1): q, r = divmod(bin(m**2).count('1'), bin(m).count('1')) if r == 0: yield q print(list(islice(agen(), 100))) # Michael S. Branicky, Mar 05 2022
Extensions
More terms from Michel Marcus, Mar 05 2022
Comments