OFFSET
0,3
FORMULA
a(n) ~ n! * (3*exp(1)/2 + exp(-1)/2). - Vaclav Kotesovec, Jun 05 2021
EXAMPLE
a(0) = 0;
a(1) = a(0)*1 + 1 = 0 + 1 = 1;
a(2) = (a(1)+2)* 2 = (1 + 2)*2 = 6;
a(3) = a(2)*3 + 3 = 6*3 + 3 = 21;
a(4) = (a(3)+4)* 4 = (21 + 4)*4 = 100.
MAPLE
a:= proc(n) a(n):= n*a(n-1) + n^(2-(n mod 2)) end: a(0):= 0:
seq(a(n), n=0..22); # Alois P. Heinz, May 21 2021
MATHEMATICA
a[0] = 0; a[n_] := a[n] = n * (a[n - 1] + If[OddQ[n], 1, n]); Array[a, 30, 0] (* Amiram Eldar, May 21 2021 *)
Table[n*(-1 + 3*E*Gamma[n, 1] + (n-1)*Subfactorial[n-2])/2, {n, 0, 30}] (* Vaclav Kotesovec, Jun 05 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Amrit Awasthi, May 21 2021
STATUS
approved