OFFSET
1,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..800
MAPLE
with(combinat);
a:= proc(n) option remember;
if n < 4 then fibonacci(n-1)
else (n-2)*a(n-2) + a(n-3)
fi;
end proc;
seq(a(n), n = 1..30); # G. C. Greubel, Oct 07 2019
MATHEMATICA
M[n_] = {{0, 1, 0}, {0, 0, 1}, {1, n, 0}}; v[1]= {0, 1, 1}; v[n_]:= v[n]= M[n].v[n-1]; Table[v[n][[1]], {n, 30}]
RecurrenceTable[{a[1]==0, a[2]==a[3]==1, a[n]==(n-2)a[n-2]+a[n-3]}, a, {n, 30}] (* Harvey P. Dale, Oct 10 2013 *)
PROG
(PARI) my(m=30, v=concat([0, 1, 1], vector(m-3))); for(n=4, m, v[n] = (n-2)*v[n-2] + v[n-3]); v \\ G. C. Greubel, Oct 07 2019
(Magma) I:=[0, 1, 1]; [n le 3 select I[n] else (n-2)*Self(n-2) + Self(n-3): n in [1..30]]; // G. C. Greubel, Oct 07 2019
(Sage)
def a(n):
if (n<4): return fibonacci(n-1)
else: return (n-2)*a(n-2) + a(n-3)
[a(n) for n in (1..30)] # G. C. Greubel, Oct 07 2019
(GAP)
a:= function(n)
if n<4 then return Fibonacci(n-1);
else return (n-2)*a(n-2) + a(n-3);
fi;
end;
List([1..30], n-> a(n) ); # G. C. Greubel, Oct 07 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Sep 01 2006
EXTENSIONS
Definition replaced by recurrence - The Assoc. Editors of the OEIS, Oct 14 2009
STATUS
approved