OFFSET
0,7
LINKS
Index entries for linear recurrences with constant coefficients, signature (13,-72,222,-417,489,-350,140,-24).
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
