|
|
|
|
1, 1, 2, 4, 13, 57, 322, 2176, 17009, 150505, 1485466, 16170036, 192384877, 2483177809, 34554278858, 515620794592, 8212685046337, 139062777326001, 2494364438359954, 47245095998005060, 942259727190907181, 19737566982241851721, 433234326593362631602
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Partial sums of subfactorial or rencontres numbers, or derangements (number of permutations of n elements with no fixed points). The subsequence of primes begins: 2, 13, 192384877.
|
|
LINKS
|
|
|
FORMULA
|
G.f.: 1/U(0)/(1-x) where U(k) = 1 + x - x*(k+1)/(1 - x*(k+1)/U(k+1)); (continued fraction). - Sergei N. Gladkovskii, Oct 15 2012
G.f.: 1/(1 - x^2) + (1/(1 - x))*Sum_{k>=1} k^k*x^k/(1 + (k + 1)*x)^(k+1). - Ilya Gutkovskiy, Apr 13 2017
E.g.f.: exp(-t)/(1-t) - exp(t-2)*(coshIntegral(2-2*t) + sinhIntegral(2-2*t) - expIntegralEi(2)).
a(n+2) - (n+3)*a(n+1) + (n+2)*a(n) = (-1)^n. (End)
D-finite with recurrence a(n+3) - (n+3)*a(n+2) + (n+2)*a(n) = 0. - Emanuele Munarini, Aug 24 2017
|
|
EXAMPLE
|
a(3) = 1 + 0 + 1 + 2 = 4.
|
|
MATHEMATICA
|
a[0] = 1; a[n_] := a[n] = n*a[n - 1] + (-1)^n; Accumulate@ Array[a, 21, 0] (* Robert G. Wilson v, Apr 01 2011 *)
dr[{n_, a1_, a2_}]:={n+1, a2, n(a1+a2)}; Accumulate[Transpose[NestList[dr, {0, 0, 1}, 30]][[3]]] (* Harvey P. Dale, Jul 17 2014 *)
Table[Sum[Subfactorial[k], {k, 0, n}], {n, 0, 100}] (* Emanuele Munarini, Aug 24 2017 *)
|
|
PROG
|
(Maxima)
s[0]:1$
s[n]:=n*s[n-1]+(-1)^n$
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|