OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1).
FORMULA
a(n) = A056594(n) + 2*n-2. - Zerinvary Lajos, Jul 06 2008
G.f.: x*(1+x)*(2*x^2-x+1)/((x^2+1)*(x-1)^2). - R. J. Mathar, Oct 08 2011
From Wesley Ivan Hurt, May 30 2016: (Start)
a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4.
a(n) = (4*n-4+i^(1-n)-i^(1+n))/2 where i = sqrt(-1).
E.g.f.: 2 + sin(x) + 2*(x - 1)*exp(x). - Ilya Gutkovskiy, May 30 2016
Sum_{n>=1} (-1)^(n+1)/a(n) = sqrt(2)*Pi/8 + log(2)/4. - Amiram Eldar, Dec 23 2021
MAPLE
MATHEMATICA
Table[(4n-4+I^(1-n)-I^(1+n))/2, {n, 80}] (* Wesley Ivan Hurt, May 30 2016 *)
LinearRecurrence[{2, -2, 2, -1}, {1, 2, 3, 6}, 70] (* Harvey P. Dale, Sep 15 2024 *)
PROG
(Sage) [lucas_number1(n, 0, 1)+2*n-2 for n in range(1, 56)] # Zerinvary Lajos, Jul 06 2008
(PARI) a(n)=(n-1)\4*8+[6, 1, 2, 3][n%4+1] \\ Charles R Greathouse IV, Jun 11 2015
(Magma) [n : n in [0..150] | n mod 8 in [1, 2, 3, 6]]; // Wesley Ivan Hurt, May 30 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved