login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A122033
a(n) = 2*a(n-1) - 2*(n-2)*a(n-2), with a(0)=1, a(1)=2.
2
1, 2, 4, 4, -8, -40, -16, 368, 928, -3296, -21440, 16448, 461696, 561536, -9957632, -34515200, 209783296, 1455022592, -3803020288, -57076808704, 22755112960, 2214428956672, 3518653394944, -85968709390336, -326758168158208, 3301044295639040, 22286480662872064
OFFSET
0,2
LINKS
FORMULA
a(n) = 2*a(n-1) - 2*(n-2)*a(n-2), with a(0)=1, a(1)=2. - G. C. Greubel, Oct 04 2019
a(n) = 2*A062267(n-1) for n > 0. - Michel Marcus, Oct 05 2019
E.g.f.: 1 + exp(1)*sqrt(Pi)*( erf(1) - erf(1-x) ), where erf(x) is the error function. - G. C. Greubel, Oct 05 2019
MAPLE
a:= proc(n) option remember;
if n < 2 then n+1
else 2*(a(n-1) - (n-2)*a(n-2))
fi
end proc:
seq(a(n), n = 0..35); # G. C. Greubel, Oct 04 2019
MATHEMATICA
a[n_]:= a[n]= If[n<2, n+1, a[n-1]-(n-2)*a[n-2]]; Table[a[n], {n, 0, 30}] (* modified by G. C. Greubel, Oct 04 2019 *)
nxt[{n_, a_, b_}]:={n+1, b, 2b-2a(n-1)}; NestList[nxt, {1, 1, 2}, 30][[;; , 2]] (* Harvey P. Dale, Jan 01 2024 *)
PROG
(PARI) my(m=35, v=concat([1, 2], vector(m-2))); for(n=3, m, v[n] = 2*(v[n-1] - (n-3)*v[n-2] ) ); v \\ G. C. Greubel, Oct 04 2019
(Magma) I:=[1, 2]; [n le 2 select I[n] else 2*(Self(n-1)-(n-3)*Self(n-2)): n in [1..35]]; // G. C. Greubel, Oct 04 2019
(Sage)
def a(n):
if n<2: return n+1
else: return 2*(a(n-1) - (n-2)*a(n-2))
[a(n) for n in (0..35)] # G. C. Greubel, Oct 04 2019
(GAP) a:=[1, 2];; for n in [3..35] do a[n]:=2*(a[n-1]-(n-3)*a[n-2]); od; a; # G. C. Greubel, Oct 04 2019
CROSSREFS
KEYWORD
sign,less
AUTHOR
Roger L. Bagula, Sep 13 2006
EXTENSIONS
Edited by N. J. A. Sloane, Sep 17 2006
Corrected and offset changed by G. C. Greubel, Oct 04 2019
STATUS
approved