OFFSET
0,12
LINKS
Dumitru Damian, Table of n, a(n) for n = 0..10000
EXAMPLE
a(5): 5 = 101_2, 25 = 11001_2, so a(5) = 3 - 2 = 1.
a(23): 23 = 10111_2, 529 = 10001001_2, so a(23) = 3 - 4 = -1.
PROG
(JavaScript)
function bitCount(n) {
var i, c, s;
c=0;
s=n.toString(2);
for (i=0; i<s.length; i++)
if (s.charAt(i)==1)
c++;
return c;
}
for (i=0; i<100; i++) document.write(bitCount(i*i)-bitCount(i)+", ");
(Python)
def A232243(n): return (n**2).bit_count()-n.bit_count()
print(list(A232243(n) for n in range(10**2))) # Dumitru Damian, Mar 04 2023
(PARI) a(n) = hammingweight(n^2) - hammingweight(n); \\ Michel Marcus, Mar 05 2023
CROSSREFS
KEYWORD
sign,base
AUTHOR
Jon Perry, Nov 20 2013
STATUS
approved