OFFSET
0,5
COMMENTS
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
T. Mansour and M. Shattuck, Counting Peaks and Valleys in a Partition of a Set, J. Int. Seq. 13 (2010), 10.6.8, Lemma 2.1, k=2, 1 peak.
Index entries for linear recurrences with constant coefficients, signature (4,-6,6,-5,2,-1).
FORMULA
G.f.: z^3/(1-2*z+z^2-z^3)^2.
EXAMPLE
a(4) = 4 because we have 0100, 0101, 0010 and 1010.
a(5) = 10: 00010, 00100, 00101, 01000, 01001, 01011, 10010, 10100, 10101, 11010.
MAPLE
g:=z^3/(1-2*z+z^2-z^3)^2: gser:=series(g, z=0, 40): seq(coeff(gser, z, n), n=0..38);
MATHEMATICA
LinearRecurrence[{4, -6, 6, -5, 2, -1}, {0, 0, 0, 1, 4, 10}, 40] (* Jean-François Alcover, May 11 2019 *)
PROG
(PARI) a(n)=([0, 1, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1; -1, 2, -5, 6, -6, 4]^n*[0; 0; 0; 1; 4; 10])[1, 1] \\ Charles R Greathouse IV, May 13 2026
(PARI) Vec(x^3/(1-2*x+x^2-x^3)^2+O(x^99)) \\ Charles R Greathouse IV, May 13 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Emeric Deutsch, Apr 27 2006
STATUS
approved
