OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
MAPLE
a:= proc(n) option remember;
if n < 3 then n
else a(n-2)-(n-1)*a(n-3)
fi;
end proc;
seq(a(n), n = 0..30); # G. C. Greubel, Oct 06 2019
MATHEMATICA
a[0]=0; a[1]=1; a[2]=2; a[n_]:= a[n]= a[n-2] - (n-1)*a[n-3]; Table[a[n], {n, 0, 30}]
RecurrenceTable[{a[0]==0, a[1]==1, a[2]==2, a[n]==a[n-2]-(n-1)a[n-3]}, a, {n, 30}] (* Harvey P. Dale, Apr 29 2022 *)
PROG
(PARI) my(m=30, v=concat([0, 1, 2], vector(m-3))); for(n=4, m, v[n] = v[n-2] - (n-2)*v[n-3]); v \\ G. C. Greubel, Oct 06 2019
(Magma) I:=[0, 1, 2]; [n le 3 select I[n] else Self(n-2) - (n-2)*Self(n-3): n in [1..30]]; // G. C. Greubel, Oct 06 2019
(Sage)
def a(n):
if (n<3): return n
else: return a(n-2) - (n-1)* a(n-3)
[a(n) for n in (0..30)] # G. C. Greubel, Oct 06 2019
(GAP)
a:= function(n)
if n<3 then return n;
else return a(n-2) - (n-1)*a(n-3);
fi;
end;
List([0..30], n-> a(n) ); # G. C. Greubel, Oct 06 2019
CROSSREFS
KEYWORD
sign
AUTHOR
Roger L. Bagula, Sep 12 2006
EXTENSIONS
Edited by N. J. A. Sloane, Sep 12 2006
Offset changed by G. C. Greubel, Oct 06 2019
STATUS
approved