OFFSET
1,2
LINKS
MATHEMATICA
Table[IntegerExponent[n, 2] + DigitCount[n^2, 2, 1], {n, 120}] (* Indranil Ghosh, Apr 27 2017 *)
PROG
(Scheme)
(PARI) a(n) = valuation(n, 2) + hammingweight(n^2); \\ Indranil Ghosh, Apr 27 2017
(Python)
import math
def a(n): return int(math.log(n - (n & n - 1), 2)) + bin(n**2)[2:].count("1") # Indranil Ghosh, Apr 27 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Apr 27 2017
STATUS
approved