login
A385312
a(n) is the number of ternary strings of length n with at least one 0, at least two 1's and at least three 2's.
2
0, 0, 0, 0, 0, 0, 60, 455, 2268, 9366, 34800, 121077, 403392, 1304732, 4133220, 12900771, 39837684, 122064930, 371891592, 1128317489, 3412864056, 10299925992, 31033986588, 93394501983, 280818931020, 843832511150, 2534467085280, 7609793357805, 22843103816688, 68558705110836
OFFSET
0,7
FORMULA
a(n) = 3^n - 2^(n-2)*(binomial(n,2) + 4*n + 12) + 3*binomial(n,3) + 4*binomial(n,2) + 4*n + 3 for n>=4.
E.g.f.: (exp(x) - x^2/2 - x - 1)*(exp(x) - x - 1)*(exp(x) - 1).
G.f.: x^6*(60 - 325*x +673*x^2 - 678*x^3 + 348*x^4 - 72*x^5)/((1 - x)^4*(1 - 2*x)^3*(1 - 3*x)). - Stefano Spezia, Jun 25 2025
EXAMPLE
a(6) = 60 since the strings are the 60 permutations of 011222.
a(7) = 455 since the strings are the 210 permutations of 0011222, the 140 permutations of 0111222 and the 105 permutations of 0112222.
MATHEMATICA
LinearRecurrence[{13, -72, 222, -417, 489, -350, 140, -24}, {0, 0, 0, 0, 0, 0, 60, 455, 2268, 9366, 34800, 121077}, 30] (* Amiram Eldar, Jun 28 2025 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jun 25 2025
STATUS
approved