OFFSET
0,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (9,-33,63,-66,36,-8).
FORMULA
a(n) = 2^n + n*2^(n-1) + binomial(n,2)*2^(n-2) - binomial(n,2) - n - 1.
E.g.f.: exp(x)*(exp(x) - 1)*(2 + 2*x + x^2)/2.
G.f.: x*(1 - 4*x + 7*x^2 - 8*x^3 + 5*x^4)/(1 - 3*x + 2*x^2)^3. - Stefano Spezia, Jan 31 2021
EXAMPLE
a(3) = 19 since the strings are composed of 000, the 6 permutations of 012, and the 3 permutations of 001, 002, 011 and 022. The total number of strings is then 1 + 6 + 3 + 3 + 3 + 3 = 19.
MATHEMATICA
CoefficientList[Series[Exp[x](Exp[x]-1)(2+2x+x^2)/2, {x, 0, 32}], x]Table[i!, {i, 0, 32}] (* Stefano Spezia, Jan 31 2021 *)
LinearRecurrence[{9, -33, 63, -66, 36, -8}, {0, 1, 5, 19, 61, 176}, 40] (* Harvey P. Dale, Mar 23 2022 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jan 30 2021
STATUS
approved