OFFSET
0,2
LINKS
Fung Lam, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,4,3,2).
FORMULA
G.f.: (1 + x)*(1 + x^2)*(1 + x + x^2)/(1 - x - 2*x^2 - 4*x^3 - 3*x^4 - 2*x^5).
EXAMPLE
a(3) = 21 because there are 27 length 3 words on {1,2,3} but we don't count: 111, 112, 113, 211, 222, 311.
MATHEMATICA
nn=20; CoefficientList[Series[1/(1-Sum[v[i]/(1+v[i])/.v[i]->(z-z^(i+1))/(1-z), {i, 1, 3}]), {z, 0, nn}], z]
(* replacing the 3 in this code with a positive integer k will return the number of words on {1, 2, ..., k} with no more than one consecutive 1 and no more than two consecutive 2's and ... no more than k consecutive k's *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Geoffrey Critzer and Alois P. Heinz, May 14 2014
STATUS
approved