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!)
A122049 a(n) = a(n-1) - (n-4)*a(n-4), with a(0)=0, a(1)=1, a(2)=2, a(3)=1. 1
0, 1, 2, 1, 1, 0, -4, -7, -11, -11, 13, 62, 150, 249, 119, -563, -2363, -5600, -7266, 1179, 38987, 134187, 264975, 242574, -537166, -3355093, -9184543, -14763745, -1871761, 82005564, 320803682, 719424797, 771834105, -1606327251, -11230437711, -33532606418 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

G. C. Greubel, Table of n, a(n) for n = 0..1000

FORMULA

a(n) = a(n-1) - (n-4)*a(n-4).

MAPLE

a:= proc (n) option remember;

      if n < 3 then n

    elif n = 3 then 1

    else a(n-1) - (n-4)*a(n-4)

      end if

    end proc:

seq(a(n), n = 0..30); # G. C. Greubel, Oct 04 2019

MATHEMATICA

a[0]=0; a[1]=1; a[2]=2; a[3]=1; a[n_]:= a[n]= a[n-1] - (n-4)*a[n-4]; Table[a[n], {n, 0, 40}]

PROG

(PARI) my(m=40, v=concat([0, 1, 2, 1], vector(m-4))); for(n=5, m, v[n] = v[n-1] - (n-5)*v[n-4] ); v \\ G. C. Greubel, Oct 04 2019

(Magma) I:=[0, 1, 2, 1]; [n le 4 select I[n] else Self(n-1) - (n-5)*Self(n-4): n in [1..40]]; // G. C. Greubel, Oct 04 2019

(Sage)

def a(n):

    if n<3: return n

    elif n==3: return 1

    else: return a(n-1) - (n-4)*a(n-4)

[a(n) for n in (0..40)] # G. C. Greubel, Oct 04 2019

(GAP) a:=[0, 1, 2, 1];; for n in [5..30] do a[n]:=a[n-1]-(n-5)*a[n-4]; od; a; # G. C. Greubel, Oct 04 2019

CROSSREFS

Cf. A122022.

Sequence in context: A246027 A077875 A198237 * A238802 A229892 A064879

Adjacent sequences:  A122046 A122047 A122048 * A122050 A122051 A122052

KEYWORD

sign

AUTHOR

Roger L. Bagula, Sep 13 2006

EXTENSIONS

Terms a(31) onward added by G. C. Greubel, Oct 04 2019

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 October 3 02:59 EDT 2022. Contains 357230 sequences. (Running on oeis4.)