login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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:
seq(a(n), n=1..30); # G. C. Greubel, Oct 05 2019
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)
[a(n) for n in (1..30)] # G. C. Greubel, Oct 05 2019
(GAP)
a:= function(n)
if n<5 then return n-1;
else return (n-3)*a(n-1) + a(n-4);
fi;
end;
List([1..30], n-> a(n) ); # G. C. Greubel, Oct 05 2019
CROSSREFS
Sequence in context: A018290 A364645 A182250 * A075633 A141048 A326030
KEYWORD
nonn
AUTHOR
Roger L. Bagula, Sep 02 2006
EXTENSIONS
Definition replaced with recurrence by the Assoc. Eds. of the OEIS, Mar 27 2010
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 8 06:05 EDT 2024. Contains 372319 sequences. (Running on oeis4.)