A348416 For n >= 1; a(n) = gcd(n,w(n)) where w(n) is the binary weight of n, A000120(n).
1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 5, 1, 1, 2, 1, 4, 1, 1, 3, 1, 1, 2, 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 3, 1, 1, 3
Offset: 1
Examples
n = 6; gcd(6, A000120(6)) = 2, thus a(6) = 2.
Programs
-
Mathematica
Array[GCD[#, Total@ IntegerDigits[#, 2]] &, 105] (* Michael De Vlieger, Oct 19 2021 *)
-
PARI
a(n) = gcd(n, hammingweight(n)); \\ Michel Marcus, Oct 19 2021
Formula
a(n) = gcd(n, A000120(n)).
Comments