|
|
A005599
|
|
Running sum of every third term in the {+1,-1}-version of Thue-Morse sequence A010060.
(Formerly M0468)
|
|
5
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
REFERENCES
|
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 98.
Hofer, Roswitha. "Coquet-type formulas for the rarefied weighted Thue-Morse sequence." Discrete Mathematics 311.16 (2011): 1724-1734.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
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.
|
|
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);
|
|
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 *)
|
|
PROG
|
(Haskell)
a005599 n = a005599_list !! n
a005599_list = scanl (+) 0 $ f a106400_list
where f (x:_:_:xs) = x : f xs
(PARI) a(n) = sum(k=0, n-1, (-1)^hammingweight(3*k)); \\ Michel Marcus, Jul 03 2017
|
|
CROSSREFS
|
See A000120 for "wt" (the binary weight of n).
|
|
KEYWORD
|
nonn,easy,nice
|
|
AUTHOR
|
M. R. Schroeder
|
|
STATUS
|
approved
|
|
|
|