A350855 a(0) = 1, a(n) = (n+1)*a(n-1) + (n-2).
1, 1, 3, 13, 67, 405, 2839, 22717, 204459, 2044597, 22490575, 269886909, 3508529827, 49119417589, 736791263847, 11788660221565, 200407223766619, 3607330027799157, 68539270528183999, 1370785410563679997, 28786493621837279955, 633302859680420159029, 14565965772649663657687
Offset: 0
Keywords
Examples
a(1) = (1+1)*a(0) + (1-2) = 2-1 = 1. a(2) = (2+1)*a(1) + (2-2) = 3.
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..449
Crossrefs
Cf. A020543.
Programs
-
Mathematica
Nest[Append[#1, (#2 + 1) #1[[-1]] + (#2 - 2)] & @@ {#, Length@ #} &, {1}, 20] (* Michael De Vlieger, Jan 19 2022 *) nxt[{n_,a_}]:={n+1,a(n+2)+n-1}; NestList[nxt,{0,1},30][[;;,2]] (* Harvey P. Dale, Feb 03 2025 *)
-
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
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