OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (5,-5,1).
FORMULA
From G. C. Greubel, Feb 25 2019: (Start)
G.f.: (1-3*x)/((1-x)*(1-4*x+x^2))
a(n) = 5*a(n-1) - 5*a(n-2) + a(n-3).
a(n) = 1 - (-i)^(n+1)*F(n, 4*i), where i = sqrt(-1) and F(n,x) is the Fibonacci polynomial. (End)
MATHEMATICA
a[0]=1; a[1]=2; a[n_]:=a[n] =4*a[n-1]-a[n-2] -2; Table[a[n], {n, 0, 25}]
LinearRecurrence[{5, -5, 1}, {1, 2, 5}, 30] (* G. C. Greubel, Feb 25 2019 *)
PROG
(Sage) [lucas_number1(n, 4, 1)+1 for n in range(26)] # Zerinvary Lajos, Jul 06 2008
(Sage) ((1-3*x)/((1-x)*(1-4*x+x^2))).series(x, 30).coefficients(x, sparse=False) # G. C. Greubel, Feb 25 2019
(PARI) my(x='x+O('x^30)); Vec((1-3*x)/((1-x)*(1-4*x+x^2))) \\ G. C. Greubel, Feb 25 2019
(Magma) I:=[1, 2, 5]; [n le 3 select I[n] else 5*Self(n-1) -5*Self(n-2) + Self(n-3): n in [1..30]]; // G. C. Greubel, Feb 25 2019
(GAP) a:=[1, 2, 5];; for n in [4..30] do a[n]:=5*a[n-1]-5*a[n-2]+a[n-3]; od; a; # G. C. Greubel, Feb 25 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Jul 30 2002
STATUS
approved