%I #18 Sep 08 2022 08:45:27
%S 0,1,2,1,1,-3,-2,-7,13,5,62,-99,17,-719,1106,-923,10453,-16407,24298,
%T -183655,303217,-621019,3792662,-6685359,16834061,-90123923,170597318,
%U -494141387,2423695393,-4929671655,15765512842,-72793142659,158725990837,-545758527919,2415313413266
%N a(n) = a(n-2) - (n-3)*a(n-3), with a(0)=0, a(1)=1, a(2)=2.
%H G. C. Greubel, <a href="/A122044/b122044.txt">Table of n, a(n) for n = 0..1000</a>
%F a(n) = a(n-2) - (n-3)*a(n-3), with a(0)=0, a(1)=1, a(2)=2. - _G. C. Greubel_, Oct 04 2019
%p a:= proc(n) option remember;
%p if n < 3 then n
%p else a(n-2)-(n-3)*a(n-3)
%p fi;
%p end proc:
%p seq(a(n), n = 0..35); # _G. C. Greubel_, Oct 04 2019
%t a[0]=0; a[1]=1; a[2]=2; a[n_]:= a[n]= a[n-2] - (n-3)*a[n-3]; Table[a[n], {n, 0, 35}]
%o (PARI) my(m=35, v=concat([0,1,2], vector(m-3))); for(n=4, m, v[n] = v[n-2] - (n-4)*v[n-3] ); v \\ _G. C. Greubel_, Oct 04 2019
%o (Magma) I:=[0,1,2]; [n le 3 select I[n] else Self(n-2) - (n-4)*Self(n-3): n in [1..35]]; // _G. C. Greubel_, Oct 04 2019
%o (Sage)
%o def a(n):
%o if n<3: return n
%o else: return a(n-2) - (n-3)*a(n-3)
%o [a(n) for n in (0..35)] # _G. C. Greubel_, Oct 04 2019
%o (GAP) a:=[0,1,2];; for n in [4..35] do a[n]:=a[n-2]-(n-4)*a[n-3]; od; a; # _G. C. Greubel_, Oct 04 2019
%Y Cf. A122021, A122048, A122050.
%K sign,easy
%O 0,3
%A _Roger L. Bagula_, Sep 13 2006
%E Edited by _N. J. A. Sloane_, Sep 17 2006
%E More terms from _Max Alekseyev_, Sep 13 2009