OFFSET
0,3
COMMENTS
a(n) is the number of strings of length n defined on {0, 1, 2, 3} that contain zero or two 0's, zero or two 1's, zero or two 2's, and there are no restrictions on the number of 3's.
LINKS
Index entries for linear recurrences with constant coefficients, signature (7,-21,35,-35,21,-7,1).
FORMULA
E.g.f.: exp(x)*(1 + x^2/2)^3.
a(n) = 1 - 21*n + 44*n^2 - (261/8)*n^3 + (91/8)*n^4 - (15/8)*n^5 + (1/8)*n^6.
G.f.: (1 - 6*x + 18*x^2 - 32*x^3 + 51*x^4 - 54*x^5 + 112*x^6)/(1 - x)^7. - Stefano Spezia, Mar 15 2025
EXAMPLE
For example, a(4) = 37 since the strings are 3333 and the 6 permutations of each of the following strings: 0011, 0022, 1122, 0033, 1133, 2233.
MATHEMATICA
a[n_] := Total[{3, 18, 90} * Binomial[n, {2, 4, 6}]] + 1; Array[a, 34, 0] (* Amiram Eldar, Mar 15 2025 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Mar 15 2025
STATUS
approved
