A123335 a(n) = -2*a(n-1) + a(n-2) for n>1, a(0)=1, a(1)=-1.
1, -1, 3, -7, 17, -41, 99, -239, 577, -1393, 3363, -8119, 19601, -47321, 114243, -275807, 665857, -1607521, 3880899, -9369319, 22619537, -54608393, 131836323, -318281039, 768398401, -1855077841, 4478554083, -10812186007, 26102926097, -63018038201, 152139002499
Offset: 0
Examples
G.f. = 1 - x + 3*x^2 - 7*x^3 + 17*x^4 - 41*x^5 + 99*x^6 + ... - _Michael Somos_, Apr 19 2022
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (-2,1).
Programs
-
Magma
[Round(1/2*((-1-Sqrt(2))^n+(-1+Sqrt(2))^n)): n in [0..30]]; // G. C. Greubel, Oct 12 2017
-
Maple
a:= n-> (M-> M[2, 1]+M[2, 2])(<<2|1>, <1|0>>^(-n)): seq(a(n), n=0..33); # Alois P. Heinz, Jun 22 2021
-
Mathematica
LinearRecurrence[{-2,1},{1,-1},40] (* Harvey P. Dale, Nov 03 2011 *)
-
PARI
x='x+O('x^50); Vec((1+x)/(1+2*x-x^2)) \\ G. C. Greubel, Oct 12 2017
-
PARI
{a(n) = real((-1 + quadgen(8))^n)}; /* Michael Somos, Apr 19 2022 */
Formula
a(n) = (-1)^n*A001333(n).
G.f.: (1+x)/(1+2*x-x^2).
G.f.: G(0)/2, where G(k) = 1 + 1/(1 - x*(2*k-1)/(x*(2*k+1) + 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Jun 19 2013
G.f.: 1/(1 + x/(1 + 2*x/(1 - x))). - Michael Somos, Apr 19 2022
E.g.f.: exp(-x)*cosh(sqrt(2)*x). - Stefano Spezia, Feb 01 2023
Extensions
Corrected by N. J. A. Sloane, Oct 05 2008
Comments