OFFSET
0,2
LINKS
FORMULA
a(n) = 1-A146559(n+2). a(n)= 3*a(n-1) -4*a(n-2) +2*a(n-3). - R. J. Mathar, Jan 18 2011
G.f.: Q(0) where Q(k) = 1 + k*(2*x+1) + 8*x - 2*x*(k+1)*(k+5)/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Mar 14 2013
G.f.: G(0)/(2*(1-x)^2), where G(k)= 1 + 1/(1 - x*(k+1)/(x*(k+2) + 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 25 2013
a(n) = Sum_{k=0..n} ((-1)^k*2^(n-k)*binomial(n-k-1,k)). - Vladimir Kruchinin, Jul 02 2015
a(n) = 1 + 2^(1 + n/2)*sin((n*Pi)/4). - Jean-François Alcover, Jul 02 2015
a(n) = 1 + 2*Im((1 + i)^n), where i is the imaginary unit. - Daniel Suteu, Dec 21 2018
MATHEMATICA
Join[{a=1, b=3}, Table[c=2*b-2*a+1; a=b; b=c, {n, 100}]] (* Vladimir Joseph Stephan Orlovsky, Jan 17 2011 *)
CoefficientList[Series[1/((1-2x+2x^2)(1-x)), {x, 0, 60}], x] (* or *) LinearRecurrence[{3, -4, 2}, {1, 3, 5}, 60] (* Harvey P. Dale, Feb 01 2013 *)
PROG
(PARI) Vec(1/((1-2*x+2*x^2)*(1-x))+O(x^99)) \\ Charles R Greathouse IV, Sep 26 2012
(PARI) a(n) = 1 + 2*imag((1 + I)^n); \\ Daniel Suteu, Dec 21 2018
(Maxima) a(n):=sum((-1)^k*2^(n-k)*binomial(n-k-1, k), k, 0, n); /* Vladimir Kruchinin, Jul 02 2015 */
(Magma) I:=[1, 3, 5]; [n le 3 select I[n] else 3*Self(n-1)-4*Self(n-2)+2*Self(n-3): n in [1..60]]; // Vincenzo Librandi, Jul 02 2015
CROSSREFS
KEYWORD
sign,easy
AUTHOR
N. J. A. Sloane, Nov 17 2002
STATUS
approved