OFFSET
0,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..795
MAPLE
with(combinat);
a:= proc(n) option remember;
if n<3 then fibonacci(n)
else a(n-1) + (n-2)*a(n-2) + a(n-3)
fi;
end:
seq(a(n), n=0..30); # G. C. Greubel, Oct 06 2019
MATHEMATICA
M = {{0, 1, 0}, {0, 0, 1}, {1, n, 1}}; v[0]= {0, 1, 1}; v[n_]:= v[n]= M.v[n-1]; Table[v[n][[1]], {n, 0, 30}]
a[n_]:= a[n]= If[n<3, Fibonacci[n], a[n-1] + (n-2)*a[n-2] + a[n-3]]; Table[a[n], {n, 0, 30}] (* G. C. Greubel, Oct 06 2019 *)
PROG
(PARI) my(m=30, v=concat([0, 1, 1], vector(m-3))); for(n=4, m, v[n]=v[n-1]+(n-3)*v[n-2]+v[n-3]); v \\ G. C. Greubel, Oct 06 2019
(Magma) I:=[0, 1, 1]; [n le 3 select I[n] else Self(n-1) + (n-3)*Self(n-2) + Self(n-3): n in [1..30]]; // G. C. Greubel, Oct 06 2019
(Sage)
@CachedFunction
def a(n):
if (n<3): return fibonacci(n)
else: return a(n-1) + (n-2)*a(n-2) + 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 Fibonacci(n);
else return a(n-1) + (n-2)*a(n-2) + a(n-3);
fi;
end;
List([0..30], n-> a(n) ); # G. C. Greubel, Oct 06 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Sep 01 2006
EXTENSIONS
Definition replaced by recurrence - the Assoc. Eds. of the OEIS, Mar 27 2010
Offset changed by G. C. Greubel, Oct 06 2019
STATUS
approved