

A227361


If n is even, then a(n) = n + bitsum(n), else a(n) = n  bitsum(n), where bitsum(n) is the count of binary 1's in n, A000120.


3



0, 0, 3, 1, 5, 3, 8, 4, 9, 7, 12, 8, 14, 10, 17, 11, 17, 15, 20, 16, 22, 18, 25, 19, 26, 22, 29, 23, 31, 25, 34, 26, 33, 31, 36, 32, 38, 34, 41, 35, 42, 38, 45, 39, 47, 41, 50, 42, 50, 46, 53, 47, 55, 49, 58, 50, 59, 53, 62, 54, 64, 56, 67, 57, 65, 63, 68, 64, 70, 66, 73, 67, 74, 70, 77, 71, 79, 73, 82, 74, 82, 78, 85, 79, 87, 81, 90, 82, 91, 85
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

I gathered together some interesting statistics for this seq A227361:
Within the first 200000001 members of this sequence, only 70 were repeated 4 times, and then only when n > 2 million. None were repeated 5 times.
The first value to become repeated 3 times is 50, occurring at indexes (n=) 46, 48, and 55.
The first value to become repeated 4 times is 2097170, occurring at indexes (n=) 2097150, 2097166, 2097168, and 2097175.
The total count of those only occurring once is 96226727, or about 48.11 %.
Total count of those repeated 2 times is 45055158.
Total count of those repeated 3 times is 4554221, or about 2.28 %.
Total count of those repeated 4 times is 70 (extremely low).
Repeatedly applying this BitStoneA(v) function to values in a recursive (nested) style has shown that only 21 starting values shall become zero. These are those values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 23, 27. All other values shall cycle forever in small loops.
274877906962 is the smallest number that occurs 5 times.  Donovan Johnson, Jul 27 2013


LINKS

Andres M. Torres, Table of n, a(n) for n = 0..10000


FORMULA

a(n) = n + (1)^n sum_{j = 1 .. floor(log_2(n)) + 1} (floor(n/2^j + 1/2))  floor(n/2^j)).  Alonso del Arte, Jul 08 2013, based on one of Hieronymus Fischer's formulas for A000120.


EXAMPLE

a(0) = 0 because 0 is even, so 0 + bitsum(0) = 0.
a(1) = 0 because 1 is odd, so 1  bitsum(1) = 0.
a(2) = 3 because 2 is even, so 2 + bitsum(2) = 3.
a(3) = 1 because 3 is odd, so 3  bitsum(3) = 1.


MATHEMATICA

Table[n + (1)^n DigitCount[n, 2, 1], {n, 0, 127}] (* Alonso del Arte, Jul 08 2013 *)


PROG

(Blitz3D code)
Each a(n) is generated simply as follows: a(n) = BitStoneA(n)
Function BitStoneA(n)
If (n Mod 2) ;; if is odd
Return nbitsum(n)
Else ;; if is even
Return n+bitsum(n)
End If
End Function
 Or, If n is even, then return n+A000120(n), else return nA000120(n), where A000120(n) = bitsum(n)
(PARI) a(n)=n+(1)^(n%2)*hammingweight(n) \\ Charles R Greathouse IV, Jul 09 2013


CROSSREFS

Cf. A000120, A055938, A010061, A010062.
Sequence in context: A097062 A324894 A200498 * A318726 A333871 A212641
Adjacent sequences: A227358 A227359 A227360 * A227362 A227363 A227364


KEYWORD

nonn,easy,base


AUTHOR

Andres M. Torres, Jul 08 2013


STATUS

approved



