%I #27 Dec 04 2018 13:42:45
%S 2,4,7,13,25,49,97,193,385,769,1537,3073,6145,12289,24577,49153,98305,
%T 196609,393217,786433,1572865,3145729,6291457,12582913,25165825,
%U 50331649,100663297,201326593,402653185,805306369,1610612737,3221225473
%N a(1) = 2, a(2) = 4; a(n) = 2*a(n-1) - 1.
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2).
%F a(n) = A003945(n-1) + 1.
%F a(n) = 3*2^(n-2) + 1 for n>1. - _Ralf Stephan_, May 18 2007
%F a(n) = A004119(n-1), n>1. - _R. J. Mathar_, Jun 11 2010
%F G.f.: x*(2-2*x-x^2)/(1-3*x+2*x^2). a(n) = 3*a(n-1)-2*a(n-2), n>3. - _Colin Barker_, Jan 29 2012
%t a[1] = 2; a[2] = 4; a[n_] := a[n] = 2*a[n - 1] - 1; Table[a[n], {n, 1, 32}]
%t Join[{2},NestList[2#-1&,4,40]] (* or *) LinearRecurrence[{3,-2},{2,4,7},40] (* _Harvey P. Dale_, Dec 04 2018 *)
%o (PARI) Vec(x*(2-2*x-x^2)/(1-3*x+2*x^2) + O(x^50)) \\ _Michel Marcus_, Jan 29 2016
%Y Cf. A003945, A004119.
%K nonn,easy
%O 1,1
%A _Roger L. Bagula_, Mar 19 2005