OFFSET
0,3
FORMULA
a(n) ~ (6-2e)*(n+1)!.
E.g.f.: (exp(x)*(4*x-x^2-5)+6)/(x-1)^2. - Alois P. Heinz, Jan 19 2022
EXAMPLE
a(1) = (1+1)*a(0) + (1-2) = 2-1 = 1.
a(2) = (2+1)*a(1) + (2-2) = 3.
MATHEMATICA
Nest[Append[#1, (#2 + 1) #1[[-1]] + (#2 - 2)] & @@ {#, Length@ #} &, {1}, 20] (* Michael De Vlieger, Jan 19 2022 *)
PROG
(PARI) a(n) = if (n, (n+1)*a(n-1) + (n-2), 1); \\ Michel Marcus, Jan 19 2022
(Python)
terms = [1]
for n in range(1, 20):
terms.append((n+1)*terms[-1]+n-2)
print(terms) # Gleb Ivanov, Jan 19 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Amrit Awasthi, Jan 19 2022
STATUS
approved