OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..200
FORMULA
E.g.f.: (2*exp(x)-x-2)/(x-1)^2.
a(n) = (2*n+1)*a(n-1)-(n-1)*((n+2)*a(n-2)-(n-2)*a(n-3)) for n>=3, a(n) = n*(2*n-1) for n<3.
a(n) ~ n! * (2*exp(1)-3)*n. - Vaclav Kotesovec, Sep 12 2013
EXAMPLE
a(0) = 0: ().
a(1) = 1: (1).
a(2) = 6 = 4+2: (1,2), (2,1).
a(3) = 32 = 9+5+5+5+5+3: (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), (3,2,1).
MAPLE
a:= proc(n) option remember; `if`(n<3, n*(2*n-1),
(2*n+1)*a(n-1) -(n-1)*((n+2)*a(n-2)-(n-2)*a(n-3)))
end:
seq(a(n), n=0..30);
MATHEMATICA
a[n_] := With[{k = 2}, Sum[If[n==t, 1, (n!/(t+1)!)(t(n-t+1)+1-((t+1)(n-t)+1)/(t+2))] t^k, {t, 1, n}]];
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 09 2013
STATUS
approved