The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A232243 a(n) = wt(n^2) - wt(n), where wt(n) = A000120(n) is the binary weight function. 2
0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 1, 3, 2, -1, 0, 2, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 1, 3, 2, 3, 1, 2, 3, 3, 2, 4, -1, -1, 0, 2, 2, 1, 1, 4, 2, 2, 0, 2, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 1, 3, 2, 3, 1, 3, 3, 5, 2, 3, 3, 0, 1, 3, 2, 4, 3, 3, 3, 2, 2, 5, 4, 0, -1, 1, -1, -1, 0, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,12
COMMENTS
A077436 lists n for which a(n) = 0.
A094694 lists n for which a(n) < 0.
LINKS
FORMULA
a(n) = A159918(n) - A000120(n).
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
Sequence in context: A363857 A219558 A279210 * A034876 A091393 A359735
KEYWORD
sign,base
AUTHOR
Jon Perry, Nov 20 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 8 00:48 EDT 2024. Contains 373206 sequences. (Running on oeis4.)