login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A232245 Sum of the number of ones in binary representation of n and n^2. 0
0, 2, 2, 4, 2, 5, 4, 6, 2, 5, 5, 8, 4, 7, 6, 8, 2, 5, 5, 8, 5, 9, 8, 7, 4, 8, 7, 10, 6, 9, 8, 10, 2, 5, 5, 8, 5, 9, 8, 11, 5, 8, 9, 11, 8, 12, 7, 9, 4, 8, 8, 9, 7, 12, 10, 12, 6, 10, 9, 12, 8, 11, 10, 12, 2, 5, 5, 8, 5, 9, 8, 11, 5, 9, 9, 13, 8, 11, 11, 10, 5, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

COMMENTS

The sequence is never 1 or 3, but seems to take on all other values. The fact it is never 3 can be used to prove if n^2 has exactly 4 1's then it must have an even number of 0's (A231898).

LINKS

Table of n, a(n) for n=0..81.

FORMULA

a(n) = A159918(n) + A000120(n).

EXAMPLE

5 is 101 and 25 is 11001, so a(5) = 2 + 3 = 5.

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)+", ");

CROSSREFS

Cf. A000120, A159918, A077436, A094694, A231898, A232243.

Sequence in context: A294097 A233520 A243271 * A121895 A139555 A241814

Adjacent sequences:  A232242 A232243 A232244 * A232246 A232247 A232248

KEYWORD

nonn,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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 24 11:38 EDT 2020. Contains 337318 sequences. (Running on oeis4.)