OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..10000
Hassan Tarfaoui, Concours Général 1990 - Exercice 1 (in French).
FORMULA
a(n) = Sum_{k=0..n} A010060(k)^2.
a(n+1) = A115382(2n, n).
a(n)/n -> 1/2; a(n) = number of odious numbers <= n, see A000069. - Reinhard Zumkeller, Aug 26 2007, corrected by M. F. Hasler, May 22 2017.
a(n) = Sum_{i=1..n} (S2(n) mod 2), where S2 = binary weight; lim a(n)/n = 1/2. More generally, consider a(n) = Sum_{i=1..n} (F(Sk(n)) mod m), where Sk(n) is sum of digits of n, n in base k; F(t) is an arithmetic function; m integer. How does lim a(n)/n depend on F(t)? - Ctibor O. Zizka, Feb 25 2008
a(n) = n + 1 - A159481(n). - Reinhard Zumkeller, Apr 16 2009
a(n) = floor((n+1)/2)+(1+(-1)^n)*(1-(-1)^A000120(n))/4. - Vladimir Shevelev, May 27 2009
G.f.: (1/(1 - x)^2 - Product_{k>=1} (1 - x^(2^k)))/2. - Ilya Gutkovskiy, Apr 03 2019
a(n) = A026430(n+1) - n - 1. - Michel Dekking, Sep 17 2019
a(2n+1) = n+1 (see Hassan Tarfaoui link, Concours Général 1990). - Bernard Schott, Jan 21 2022
MATHEMATICA
Accumulate[Nest[Flatten[#/.{0->{0, 1}, 1->{1, 0}}]&, {0}, 7]] (* Peter J. C. Moses, Apr 15 2013 *)
Accumulate[ThueMorse[Range[0, 100]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 02 2017 *)
PROG
(PARI) a(n)=n\2 + (n%2 || hammingweight(n+1)%2==0) \\ Charles R Greathouse IV, Mar 22 2013
(Python)
def A115384(n): return (n>>1)+(n&1|((n+1).bit_count()&1^1)) # Chai Wah Wu, Mar 01 2023
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Jan 21 2006
EXTENSIONS
Edited by M. F. Hasler, May 22 2017
STATUS
approved