A077860 Expansion of 1/((1 - 2*x + 2*x^2)*(1-x)).
1, 3, 5, 5, 1, -7, -15, -15, 1, 33, 65, 65, 1, -127, -255, -255, 1, 513, 1025, 1025, 1, -2047, -4095, -4095, 1, 8193, 16385, 16385, 1, -32767, -65535, -65535, 1, 131073, 262145, 262145, 1, -524287, -1048575, -1048575, 1, 2097153, 4194305, 4194305, 1, -8388607, -16777215, -16777215
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (3,-4,2).
Programs
-
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
-
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 *)
-
Maxima
a(n):=sum((-1)^k*2^(n-k)*binomial(n-k-1,k),k,0,n); /* Vladimir Kruchinin, Jul 02 2015 */
-
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
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
a(n) = Sum_{k=0..floor(n/2)} (-1)^k*binomial(n+2,2*k+2). - Taras Goy, Jan 03 2025
E.g.f.: exp(x)*(1 + 2*sin(x)). - Stefano Spezia, Jan 03 2025