OFFSET
0,3
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).
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
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 *)
PROG
(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
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
R. J. Mathar, Aug 11 2012
STATUS
approved