%I M0468 #63 May 23 2024 11:56:22
%S 0,1,2,3,4,5,6,7,6,7,8,9,10,11,12,11,12,13,14,15,16,17,18,19,18,19,20,
%T 21,20,19,18,19,18,19,20,21,22,23,24,25,24,25,26,27,28,29,30,29,30,31,
%U 32,33,34,35,36,35,36,35,34,33,34,35,36,35,36,37,38,39,40,41,42,43,42,43,44,45,46,47,48,47,48,49,50
%N Running sum of every third term in the {+1,-1}-version of Thue-Morse sequence A010060.
%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 98.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Reinhard Zumkeller, <a href="/A005599/b005599.txt">Table of n, a(n) for n = 0..10000</a>
%H J. Coquet, <a href="http://dx.doi.org/10.1007/BF01393827">A summation formula related to the binary digits</a>, Invent. Math. 73 (1983) 107-115.
%H P. Flajolet et al., <a href="http://algo.inria.fr/flajolet/Publications/FlGrKiPrTi94.pdf">Mellin Transforms And Asymptotics: Digital Sums</a>, Theoret. Computer Sci. 23 (1994), 291-314.
%H P. J. Grabner and H.-K. Hwang, <a href="http://algo.stat.sinica.edu.tw/hk/files/2005_07/pdf/Digital_sums_and_divide-and-conquer_recurrences.pdf">Digital sums and divide-and-conquer recurrences: Fourier expansions and absolute convergence</a>, Constructive Approximation, Jan. 2005, Volume 21, Issue 2, pp 149-179.
%H Roswitha Hofer, <a href="https://doi.org/10.1016/j.disc.2011.04.008">Coquet-type formulas for the rarefied weighted Thue-Morse sequence</a> Discrete Mathematics 311.16 (2011): 1724-1734.
%H D. J. Newman, <a href="http://dx.doi.org/10.1090/S0002-9939-1969-0244149-8">On the number of binary digits in a multiple of three</a>, Proc. Amer. Math. Soc., 21 (1969), 719-721.
%H Simon Plouffe, <a href="https://arxiv.org/abs/0911.4975">Approximations de séries génératrices et quelques conjectures</a>, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
%H Simon Plouffe, <a href="/A000051/a000051_2.pdf">1031 Generating Functions</a>, Appendix to Thesis, Montreal, 1992
%H M. R. Schroeder & N. J. A. Sloane, <a href="/A005599/a005599.pdf">Correspondence, 1991</a>
%F a(n) = Sum( (-1)^wt(3*k),k=0..n-1). See Allouche-Shallit for asymptotics. - From _N. J. A. Sloane_, Jul 22 2012
%F The generating function -(2*z^4+z^3+z+1)*(z^3-z^2-1)/(z^6+z^5+z^4+z^3+z^2+z+1)/(z-1)^2 proposed in the Plouffe thesis is wrong.
%p A000120 := proc(n) local w,m,i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end: wt := A000120;
%p f:=n->add( (-1)^wt(3*k),k=0..n-1);
%p [seq(f(n),n=0..50)]; # _N. J. A. Sloane_, Jul 22 2012
%p A005599 := proc(n)
%p add( A106400(3*i),i=0..n-1) ;
%p end proc: # _R. J. Mathar_, Jul 22 2012
%t wt[n_] := DigitCount[n, 2, 1]; a[n_] := Sum[(-1)^wt[3*k], {k, 0, n-1}]; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Feb 03 2014, after _N. J. A. Sloane_ *)
%o (Haskell)
%o a005599 n = a005599_list !! n
%o a005599_list = scanl (+) 0 $ f a106400_list
%o where f (x:_:_:xs) = x : f xs
%o -- _Reinhard Zumkeller_, May 26 2013
%o (PARI) a(n) = sum(k=0, n-1, (-1)^hammingweight(3*k)); \\ _Michel Marcus_, Jul 03 2017
%Y See A000120 for "wt" (the binary weight of n).
%Y Cf. A010060, A106400.
%K nonn,easy,nice
%O 0,3
%A M. R. Schroeder