A215458 a(n) = 4*a(n-1) - 7*a(n-2) + 8*a(n-3) - 4*a(n-4) starting 0, 1, 4, 7.
0, 1, 4, 7, 8, 11, 28, 71, 144, 259, 484, 991, 2072, 4187, 8236, 16247, 32544, 65587, 131572, 262543, 523688, 1047179, 2096956, 4196903, 8391600, 16775011, 33546244, 67105087, 134230328, 268455611, 536865868, 1073696471, 2147448384, 4295022739
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- H. C. Williams and R. K. Guy, Some fourth-order linear divisibility sequences, Intl. J. Number Theory 7 (5) (2011) 1255-1277; P1=4, P2=3, Q=2.
- Index entries for linear recurrences with constant coefficients, signature (4,-7,8,-4).
Programs
-
Magma
I:=[0,1,4,7]; [n le 4 select I[n] else 4*Self(n-1)-7*Self(n-2)+8*Self(n-3)-4*Self(n-4): n in [1..40]]; // Vincenzo Librandi, Dec 23 2012
-
Mathematica
CoefficientList[Series[-x (-1 + 2 x^2)/((x - 1) (2*x-1) (2 x^2 - x + 1)), {x, 0, 40}], x] (* Vincenzo Librandi, Dec 23 2012 *) LinearRecurrence[{4,-7,8,-4},{0,1,4,7},40] (* Harvey P. Dale, Mar 22 2019 *)
-
PARI
a(n)=([0,1,0,0; 0,0,1,0; 0,0,0,1; -4,8,-7,4]^n*[0;1;4;7])[1,1] \\ Charles R Greathouse IV, Jul 07 2017
-
Sage
a = lambda n: (2^n - lucas_number2(n, 1, 2) + 1) // 2 print([a(n) for n in range(34)]) # Peter Luschny, Jul 26 2017
Formula
G.f.: -x*(-1+2*x^2) / ( (x-1)*(2*x-1)*(2*x^2-x+1) ).
a(n) = A002248(n)/2.
a(n) = (2^n - (1/2 - (i * sqrt(7))/2)^n - (1/2 + (i * sqrt(7))/2)^n + 1)/2 where i = sqrt(-1). - Paul S. Vanderveen, Jul 08 2017
a(n) = 2^(n-1) - 2^(n/2) * cos(n * arctan(sqrt(7))) + 1/2. - Peter Luschny, Jul 26 2017