OFFSET
0,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,2,1,-1).
FORMULA
G.f.: (1 + x - x^2)/(1 - x - 2*x^2 - x^3 +x^4).
a(n) = a(n-1) +2*a(n-2) +a(n-3) -a(n-4). - Fung Lam, May 18 2014
EXAMPLE
a(3)=8 because we have: 111, 122, 131, 221, 223, 313, 322, 333.
MATHEMATICA
n=3; nn=30; CoefficientList[Series[1/(1-Sum[v[i]/(1+v[i]), {i, 1, n}])/.Join[Table[v[i]->z/(1-z^2), {i, 1, n, 2}], Table[v[i]->z^2/(1-z^2), {i, 2, n, 2}]], {z, 0, nn}], z]
(* Changing n=3 at the beginning of this code to n = k, (for k a positive integer) will return the number of n-length words on {1, 2, ..., k} where the maximal run lengths of odd integers are odd and the maximal run lengths of even integers are even. *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Geoffrey Critzer, May 16 2014
STATUS
approved