OFFSET
0,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Martin Burtscher, Igor Szczyrba, RafaĆ Szczyrba, Analytic Representations of the n-anacci Constants and Generalizations Thereof, Journal of Integer Sequences, Vol. 18 (2015), Article 15.4.5.
Index entries for linear recurrences with constant coefficients, signature (1,1,1).
FORMULA
a(0)=3; a(1)=1; a(2)=1; thereafter a(n) = a(n-1) + a(n-2) + a(n-3).
From R. J. Mathar, Aug 22 2008: (Start)
O.g.f.: (3-2*x-3*x^2)/(1-x-x^2-x^3).
MATHEMATICA
a[0]=3; a[1]=1; a[2]=1; a[n_]:= a[n]=a[n-1]+a[n-2]+a[n-3]; Table[a[n], {n, 0, 40}]
LinearRecurrence[{1, 1, 1}, {3, 1, 1}, 40] (* Vincenzo Librandi, Oct 17 2012 *)
PROG
(Magma) I:=[3, 1, 1]; [n le 3 select I[n] else Self(n-1)+Self(n-2) +Self(n-3): n in [1..40]]; // Vincenzo Librandi, Oct 17 2012
(PARI) a(n)=([0, 1, 0; 0, 0, 1; 1, 1, 1]^n*[3; 1; 1])[1, 1] \\ Charles R Greathouse IV, Mar 22 2016
(PARI) my(x='x+O('x^40)); Vec((3-2*x-3*x^2)/(1-x-x^2-x^3)) \\ G. C. Greubel, Apr 22 2019
(Sage) ((3-2*x-3*x^2)/(1-x-x^2-x^3)).series(x, 40).coefficients(x, sparse=False) # G. C. Greubel, Apr 22 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula and Gary W. Adamson, Aug 11 2008
EXTENSIONS
Edited by N. J. A. Sloane, Oct 17 2012
STATUS
approved