%I #22 Jan 08 2024 09:03:02
%S 0,1,0,1,2,3,2,3,2,3,2,3,4,5,4,5,6,7,6,7,8,9,8,9,8,9,8,9,10,11,10,11,
%T 10,11,10,11,12,13,12,13,12,13,12,13,14,15,14,15,16,17,16,17,18,19,18,
%U 19,18,19,18,19,20,21,20,21,22,23,22,23,24,25,24,25,24,25,24,25,26,27,26
%N a(0) = 0, a(n) = a(n-1) + (-1)^p(n) for n >= 1, where p(n) = highest power of 2 dividing n.
%H J.-P. Allouche and J. Shallit, <a href="http://www.math.jussieu.fr/~allouche/kreg2.ps">The Ring of k-regular Sequences, II</a>
%H J.-P. Allouche and J. Shallit, <a href="https://doi.org/10.1016/S0304-3975(03)00090-2">The ring of k-regular sequences, II</a>, Theoret. Computer Sci., 307 (2003), 3-29.
%H Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a>
%H Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a>
%F a(n) = (n+2*A065359(n))/3; a(n) is asymptotic to n/3. - _Benoit Cloitre_, Oct 04 2003
%F From _Ralf Stephan_, Oct 17 2003: (Start)
%F a(0)=0, a(2n) = -a(n) + n, a(2n+1) = -a(n) + n + 1.
%F a(n) = (1/2) * (A050292(n) + A065639(n)).
%F G.f.: (1/2) * 1/(1-x) * Sum_{k>=0} (-1)^k*t/(1-t^2) where t=x^2^k. (End)
%F a(0)=0 then a(n) = ceiling(n/2)-a(n-ceiling(n/2)). - _Benoit Cloitre_, May 03 2004
%o (PARI) a(n)=if(n<1,0,ceil(n/2)-a(n-ceil(n/2)))
%Y Cf. A087733.
%K nonn,easy
%O 0,5
%A _N. J. A. Sloane_, Oct 01 2003
%E More terms from _John W. Layman_ and _Robert G. Wilson v_, Oct 02 2003
|