login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A121956 a(n) = a(n-1) + (n-2)*a(n-2) + a(n-3) starting a(0)=0, a(1)=a(2)=1. 1
0, 1, 1, 2, 5, 12, 34, 99, 315, 1042, 3661, 13354, 51006, 201561, 826987, 3498286, 15277665, 68578942, 316519868, 1497639547, 7263576113, 36035247374, 182804409181, 946808180148, 5004540429504, 26963932982089, 148019711470333 (list; graph; refs; listen; history; text; internal format)
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

Sequence in context: A196545 A032292 A151408 * A176638 A131467 A000103

Adjacent sequences:  A121953 A121954 A121955 * A121957 A121958 A121959

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

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 3 22:11 EST 2020. Contains 338920 sequences. (Running on oeis4.)