OFFSET
0,2
COMMENTS
a(n) is the number of words of length n defined on 4 letters where a chosen letter (for example, the first letter of the alphabet) is used at most three times.
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (12,-54,108,-81).
FORMULA
E.g.f.: (1 + x + x^2/2 + x^3/6)*exp(3*x).
G.f.: (1 - 8*x + 22*x^2 - 20*x^3)/(1 - 3*x)^4. - Stefano Spezia, May 22 2025
EXAMPLE
a(5) = 1008 since from the 1024 words defined on {0, 1, 2, 3} we subtract the 5 permutations of 00001, the 5 permutations of 00002, the 5 permutations of 00003, and 00000.
MATHEMATICA
LinearRecurrence[{12, -54, 108, -81}, {1, 4, 16, 64}, 30] (* or *)
A384198[n_] := 3^(n - 3)*(Binomial[n, 3] + 3*Binomial[n, 2] + 9*n + 27);
Array[A384198, 30, 0] (* Paolo Xausa, Jun 30 2025 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, May 21 2025
STATUS
approved
