OFFSET
0,3
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
FORMULA
If n = 2^(g(n)e0) + 2^(g(n)e1) +... then a(n) = 2^e0 + 2^e1 +...
EXAMPLE
577 = 2^0 + 2^6 + 2^9, GCD(0,6,9) = 3, a(577) = 2^(0/3)+2^(6/3)+2^(9/3) = 13.
MATHEMATICA
A064895[n_] := With[{e = Flatten[Position[Reverse[IntegerDigits[n, 2]], 1]] - 1}, Total[2^(e/Max[Apply[GCD, e], 1])]];
Array[A064895, 100, 0] (* Paolo Xausa, Feb 13 2024 *)
PROG
(PARI) a(n) = { my (b=vector(hammingweight(n))); for (i=1, #b, n-=2^b[i]=valuation(n, 2); ); b /= max(1, gcd(b)); sum(i=1, #b, 2^b[i]); } \\ Rémy Sigrist, Oct 16 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Marc LeBrun, Oct 11 2001
STATUS
approved