OFFSET
0,5
COMMENTS
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
M. C. Firengiz and A. Dil, Generalized Euler-Seidel method for second order recurrence relations, Notes on Number Theory and Discrete Mathematics, Vol. 20, 2014, No. 4, 21-32.
Index entries for linear recurrences with constant coefficients, signature (-2,1).
FORMULA
G.f.: 1 / (1 - x / (1 + x / (1 + x / (1 + x)))) = (1 + 3*x + x^2) / (1 + 2*x - x^2).
a(n + 3) = A077985(n). a(n) * a(n+2) - a(n+1)^2 = -(-1)^n.
a(n) = Sum_{k=0..n} A147746(n,k)*(-1)^(n-k). - Philippe Deléham, Aug 30 2012
G.f.: 1 + x + x^2/(1-x) - G(0)*x^2 /(2-2*x), where G(k)= 1 + 1/(1 - x*(2*k-1)/(x*(2*k+1) + 1/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 10 2013
a(n) = (-1)^n a(1-n) = A000129(-1-n) if n < 0. a(n-2) = 2*a(n-1) + a(n) if n<1 or n>2. - Michael Somos, Mar 19 2019
E.g.f.: exp(-x)*(4*cosh(sqrt(2)*x) + 3*sqrt(2)*sinh(sqrt(2)*x))/2 - 1. - Stefano Spezia, Oct 31 2024
EXAMPLE
G.f. = 1 + x + x^3 - 2*x^4 + 5*x^5 - 12*x^6 + 29*x^7 - 70*x^8 + 169*x^9 - 408*x^10 + ...
MATHEMATICA
CoefficientList[Series[(1 + 3 x + x^2)/(1 + 2 x - x^2), {x, 0, 40}], x] (* Vincenzo Librandi, Sep 09 2013 *)
a[ n_] := With[ {m = If[ n < 1, 1 - n, n], s = If[ n < 1, (-1)^n, 1]}, s SeriesCoefficient[ x (1 + 2 x) / (1 + 2 x - x^2), {x, 0, m}]]; (* Michael Somos, Mar 19 2019 *)
PROG
(PARI) {a(n) = my(m=n, s=1); if(n<1, m=1-n; s=(-1)^n); s * polcoeff( x * (1 + 2*x) / (1 + 2*x - x^2) + x * O(x^m), m)}; /* Michael Somos, Mar 19 2019 */
(Magma) [1, 1] cat [n le 2 select (n-1) else -2*Self(n-1)+Self(n-2): n in [1..35] ]; // Vincenzo Librandi, Sep 09 2013
CROSSREFS
KEYWORD
sign,easy,changed
AUTHOR
Michael Somos, Aug 28 2012
STATUS
approved