OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (5,-10,10,-5,1).
FORMULA
a(n) = n*(-9+17*n-8*n^2+2*n^3)/2.
G.f.: x*(1+4*x+x^2+18*x^3)/(1-x)^5.
EXAMPLE
a(0) = 0: no word of length 4 is possible for an empty alphabet.
a(1) = 1: aaaa for alphabet {a}.
a(2) = 9: aaaa, aaab, aaba, aabb, abaa, abab, baaa, baab, bbbb for alphabet {a,b}.
a(3) = 36: aaaa, aaab, aaac, aaba, aabb, aabc, aaca, aacb, aacc, abaa, abab, abac, abca, acaa, acab, acac, acba, baaa, baab, baac, baca, bbbb, bbbc, bbcb, bbcc, bcaa, bcbb, bcbc, caaa, caab, caac, caba, cbaa, cbbb, cbbc, cccc for alphabet {a,b,c}.
MAPLE
a:= n-> n*(-9+(17+(-8+2*n)*n)*n)/2:
seq(a(n), n=0..40);
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alois P. Heinz, Jun 08 2012
STATUS
approved