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)
;; Each a(n) is generated simply as follows: a(n) = BitStoneA(n)
Function BitStoneA(n)
If (n Mod 2) ;; if is odd
Return n-bitsum(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 n-A000120(n), where A000120(n) = bitsum(n)
(PARI) a(n)=n+(-1)^(n%2)*hammingweight(n) \\ Charles R Greathouse IV, Jul 09 2013
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Andres M. Torres, Jul 08 2013
STATUS
approved