cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A005599 Running sum of every third term in the {+1,-1}-version of Thue-Morse sequence A010060.

Original entry on oeis.org

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, 21, 20, 19, 18, 19, 18, 19, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 30, 29, 30, 31, 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
Offset: 0

Views

Author

M. R. Schroeder

Keywords

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 98.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A000120 for "wt" (the binary weight of n).

Programs

  • Haskell
    a005599 n = a005599_list !! n
    a005599_list = scanl (+) 0 $ f a106400_list
       where f (x:::xs) = x : f xs
    -- Reinhard Zumkeller, May 26 2013
    
  • Maple
    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;
    f:=n->add( (-1)^wt(3*k),k=0..n-1);
    [seq(f(n),n=0..50)]; # N. J. A. Sloane, Jul 22 2012
    A005599 := proc(n)
            add( A106400(3*i),i=0..n-1) ;
    end proc: # R. J. Mathar, Jul 22 2012
  • Mathematica
    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 *)
  • PARI
    a(n) = sum(k=0, n-1, (-1)^hammingweight(3*k)); \\ Michel Marcus, Jul 03 2017

Formula

a(n) = Sum( (-1)^wt(3*k),k=0..n-1). See Allouche-Shallit for asymptotics. - From N. J. A. Sloane, Jul 22 2012
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.