|
|
A121959
|
|
a(n) = (n-3)*a(n-1) + a(n-4), with a(1)=0, a(2)=1, a(3)=2, a(4)=3.
|
|
1
|
|
|
0, 1, 2, 3, 6, 19, 78, 393, 2364, 16567, 132614, 1193919, 11941554, 131373661, 1576616546, 20497209017, 286972867792, 4304724390541, 68877166865202, 1170932333917451, 21077068983381910, 400468615408646831
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
MAPLE
|
a:= proc(n) option remember;
if n<5 then n-1
else (n-3)*a(n-1) + a(n-4)
fi;
end:
|
|
MATHEMATICA
|
(* First program *)
M = {{0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, n}}; v[1] = {0, 1, 2, 3};
v[n_] := v[n]= M.v[n-1]; Table[Floor[v[n][[1]]], {n, 30}]
Det[M - x*IdentityMatrix[4]]
(* Second program *)
a[n_]:= a[n] = If[n<5, n-1, (n-3)*a[n-1] + a[n-4]]; Table[a[n], {n, 30}] (* G. C. Greubel, Oct 05 2019 *)
|
|
PROG
|
(PARI) my(m=30, v=concat([0, 1, 2, 3], vector(m-4))); for(n=5, m, v[n]=(n-3)*v[n-1] +v[n-4]); v \\ G. C. Greubel, Oct 05 2019
(Magma) I:=[0, 1, 2, 3]; [n le 4 select I[n] else (n-3)*Self(n-1) + Self(n-4): n in [1..30]]; // G. C. Greubel, Oct 05 2019
(Sage)
def a(n):
if (n<5): return n-1
else: return (n-3)*a(n-1) + a(n-4)
(GAP)
a:= function(n)
if n<5 then return n-1;
else return (n-3)*a(n-1) + a(n-4);
fi;
end;
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Definition replaced with recurrence by the Assoc. Eds. of the OEIS, Mar 27 2010
|
|
STATUS
|
approved
|
|
|
|