A072110 a(n) = 4*a(n-1) - a(n-2) - 2, with a(0)=1, a(1)=2.
1, 2, 5, 16, 57, 210, 781, 2912, 10865, 40546, 151317, 564720, 2107561, 7865522, 29354525, 109552576, 408855777, 1525870530, 5694626341, 21252634832, 79315912985, 296011017106, 1104728155437, 4122901604640, 15386878263121
Offset: 0
Keywords
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).
Programs
-
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
-
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
-
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 *)
-
PARI
my(x='x+O('x^30)); Vec((1-3*x)/((1-x)*(1-4*x+x^2))) \\ G. C. Greubel, Feb 25 2019
-
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
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)