%I #11 Sep 08 2022 08:45:27
%S 0,1,2,1,1,0,-4,-7,-11,-11,13,62,150,249,119,-563,-2363,-5600,-7266,
%T 1179,38987,134187,264975,242574,-537166,-3355093,-9184543,-14763745,
%U -1871761,82005564,320803682,719424797,771834105,-1606327251,-11230437711,-33532606418
%N a(n) = a(n-1) - (n-4)*a(n-4), with a(0)=0, a(1)=1, a(2)=2, a(3)=1.
%H G. C. Greubel, <a href="/A122049/b122049.txt">Table of n, a(n) for n = 0..1000</a>
%F a(n) = a(n-1) - (n-4)*a(n-4).
%p a:= proc (n) option remember;
%p if n < 3 then n
%p elif n = 3 then 1
%p else a(n-1) - (n-4)*a(n-4)
%p end if
%p end proc:
%p seq(a(n), n = 0..30); # _G. C. Greubel_, Oct 04 2019
%t a[0]=0; a[1]=1; a[2]=2; a[3]=1; a[n_]:= a[n]= a[n-1] - (n-4)*a[n-4]; Table[a[n], {n,0,40}]
%o (PARI) my(m=40, v=concat([0,1,2,1], vector(m-4))); for(n=5, m, v[n] = v[n-1] - (n-5)*v[n-4] ); v \\ _G. C. Greubel_, Oct 04 2019
%o (Magma) I:=[0,1,2,1]; [n le 4 select I[n] else Self(n-1) - (n-5)*Self(n-4): n in [1..40]]; // _G. C. Greubel_, Oct 04 2019
%o (Sage)
%o def a(n):
%o if n<3: return n
%o elif n==3: return 1
%o else: return a(n-1) - (n-4)*a(n-4)
%o [a(n) for n in (0..40)] # _G. C. Greubel_, Oct 04 2019
%o (GAP) a:=[0,1,2,1];; for n in [5..30] do a[n]:=a[n-1]-(n-5)*a[n-4]; od; a; # _G. C. Greubel_, Oct 04 2019
%Y Cf. A122022.
%K sign
%O 0,3
%A _Roger L. Bagula_, Sep 13 2006
%E Terms a(31) onward added by _G. C. Greubel_, Oct 04 2019