OFFSET
0,4
LINKS
Index entries for linear recurrences with constant coefficients, signature (7,-19,25,-16,4).
FORMULA
a(n) = 2^n + n*2^(n-1) - 2*binomial(n,2) - 2*n - 1.
E.g.f.: exp(x)*(exp(x) - 1 - x)*(1 + x).
G.f.: x^2*(1 - 3*x^2)/((1 - 2*x)^2*(1 - x)^3). - Stefano Spezia, Jan 31 2021
EXAMPLE
a(4) = 27 since the strings consist of 0000, the 4 permutations of 0001, the 4 permutations of 0002, the 6 permutations of 0022, and the 12 permutations of 0012. The total number of strings is then 1 + 4 + 4 + 6 + 12 = 27.
MATHEMATICA
CoefficientList[Series[Exp[x](Exp[x]-1-x)(1+x), {x, 0, 32}], x]Table[i!, {i, 0, 32}] (* Stefano Spezia, Jan 31 2021 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jan 30 2021
STATUS
approved