A105968 a(n) = 4*a(n-1) - a(n-2) - 2*(-1)^n, a(0) = 1, a(1) = 4.
1, 4, 13, 50, 185, 692, 2581, 9634, 35953, 134180, 500765, 1868882, 6974761, 26030164, 97145893, 362553410, 1353067745, 5049717572, 18845802541, 70333492594, 262488167833, 979619178740, 3655988547125, 13644335009762, 50921351491921, 190041070957924
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (3,3,-1).
Programs
-
GAP
a:=[1,4,13];; for n in [4..30] do a[n]:=3*a[n-1]+3*a[n-2]-a[n-3]; od; a; # G. C. Greubel, Jan 15 2020
-
Magma
I:=[1,4,13]; [n le 3 select I[n] else 3*Self(n-1) +3*Self(n-2) -Self(n-3): n in [1..30]]; // G. C. Greubel, Jan 15 2020
-
Maple
seq( simplify((4*ChebyshevU(n,2) -5*ChebyshevU(n-1,2) -(-1)^n)/3), n = 0..30); # G. C. Greubel, Jan 15 2020
-
Mathematica
Table[(4*ChebyshevU[n, 2] -5*ChebyshevU[n-1, 2] -(-1)^n)/3, {n,0,30}] (* G. C. Greubel, Jan 15 2020 *) nxt[{n_,a_,b_}]:={n+1,b,4b-a-2(-1)^(n+1)}; NestList[nxt,{1,1,4},30][[;;,2]] (* or *) LinearRecurrence[ {3,3,-1},{1,4,13},30] (* Harvey P. Dale, Apr 03 2024 *)
-
PARI
Vec((1-x)*(1+2*x)/((1+x)*(1-4*x+x^2)) + O(x^30)) \\ Colin Barker, May 25 2015
-
SageMath
[(4*chebyshev_U(n,2) -5*chebyshev_U(n-1,2) -(-1)^n)/3 for n in (0..30)] # G. C. Greubel, Jan 15 2020
Formula
G.f.: (1-x)*(1+2*x)/((1+x)*(1-4*x+x^2)).
a(n) = 3*a(n-1) + 3*a(n-2) - a(n-3). - Colin Barker, May 25 2015
a(n) = ( 4*ChebyshevU(n,2) - 5*ChebyshevU(n-1,2) - (-1)^n )/3. - G. C. Greubel, Jan 15 2020
E.g.f.: (exp(2*x)*(4*cosh(sqrt(3)*x) + sqrt(3)*sinh(sqrt(3)*x)) - cosh(x) + sinh(x))/3. - Stefano Spezia, Sep 19 2023
Comments