login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A122033 a(n) = 2*a(n-1) - 2*(n-2)*a(n-2), with a(0)=1, a(1)=2. 2

%I #30 Jan 01 2024 11:58:39

%S 1,2,4,4,-8,-40,-16,368,928,-3296,-21440,16448,461696,561536,-9957632,

%T -34515200,209783296,1455022592,-3803020288,-57076808704,22755112960,

%U 2214428956672,3518653394944,-85968709390336,-326758168158208,3301044295639040,22286480662872064

%N a(n) = 2*a(n-1) - 2*(n-2)*a(n-2), with a(0)=1, a(1)=2.

%H G. C. Greubel, <a href="/A122033/b122033.txt">Table of n, a(n) for n = 0..725</a>

%F 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

%F a(n) = 2*A062267(n-1) for n > 0. - _Michel Marcus_, Oct 05 2019

%F 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

%p a:= proc(n) option remember;

%p if n < 2 then n+1

%p else 2*(a(n-1) - (n-2)*a(n-2))

%p fi

%p end proc:

%p seq(a(n), n = 0..35); # _G. C. Greubel_, Oct 04 2019

%t 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 *)

%t nxt[{n_,a_,b_}]:={n+1,b,2b-2a(n-1)}; NestList[nxt,{1,1,2},30][[;;,2]] (* _Harvey P. Dale_, Jan 01 2024 *)

%o (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

%o (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

%o (Sage)

%o def a(n):

%o if n<2: return n+1

%o else: return 2*(a(n-1) - (n-2)*a(n-2))

%o [a(n) for n in (0..35)] # _G. C. Greubel_, Oct 04 2019

%o (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

%Y Cf. A000898, A121966, A328141.

%K sign,less

%O 0,2

%A _Roger L. Bagula_, Sep 13 2006

%E Edited by _N. J. A. Sloane_, Sep 17 2006

%E Corrected and offset changed by _G. C. Greubel_, Oct 04 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 23:26 EDT 2024. Contains 371917 sequences. (Running on oeis4.)