Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #27 Mar 03 2024 04:01:23
%S 1,2,4,8,15,28,52,96,176,320,576,1024,1792,3072,5120,8192,12288,16384,
%T 16384,0,-65536,-262144,-786432,-2097152,-5242880,-12582912,-29360128,
%U -67108864,-150994944,-335544320,-738197504,-1610612736,-3489660928,-7516192768,-16106127360,-34359738368
%N Expansion of (1 - 2*x -x^4)/(1 - 2*x)^2 in powers of x.
%H G. C. Greubel, <a href="/A008936/b008936.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (4,-4).
%F From _Michael Somos_, Aug 19 2014: (Start)
%F a(n) = 2^n for all n<4.
%F a(n) = 2^n - (n-3) * 2^(n-4) for all n>=4.
%F a(n) = 4*(a(n-1) - a(n-2)) for all n in Z except n=4.
%F a(n) = 2*a(n-1) - 2^(n-4).
%F 0 = a(n)*(-8*a(n+1) + 8*a(n+2) - 2*a(n+3)) + a(n+1)*(+4*a(n+1) - 4*a(n+2) + a(n+3)) for all n in Z. (End)
%F E.g.f.: ( -3 -4*x -2*x^2 + (19 - 2*x)*exp(2*x) )/16. - _G. C. Greubel_, Sep 13 2019
%e G.f. = 1 + 2*x + 4*x^2 + 8*x^3 + 15*x^4 + 28*x^5 + 52*x^6 + 96*x^7 + 176*x^8 + ...
%p A008936 := proc(n) option remember; if n <= 3 then 2^n else 2*A008936(n-1)-2^(n-4); fi; end;
%t a[ n_]:= 2^n - 2^(n-4) Max[0, n-3]; (* _Michael Somos_, Aug 19 2014 *)
%t Table[If[n < 4, 2^n, 2^(n-4)*(19 - n)], {n,0,40}] (* _G. C. Greubel_, Sep 13 2019 *)
%o (PARI) {a(n) = 2^n - 2^(n-4) * max(n-3, 0)}; /* _Michael Somos_, Jan 12 2000 */
%o (PARI) Vec((1-2*x-x^4)/(1-2*x)^2 +O(x^40)) \\ _Charles R Greathouse IV_, Sep 26 2012
%o (Magma) [n lt 4 select 2^n else 2^(n-4)*(19-n): n in [0..40]]; // _G. C. Greubel_, Sep 13 2019
%o (Sage) [1,2,4,8]+[2^(n-4)*(19 - n) for n in (4..40)] # _G. C. Greubel_, Sep 13 2019
%o (GAP) a:=[1,2];; for n in [3..40] do a[n]:=4*(a[n-1]-a[n-2]); od; a; # _G. C. Greubel_, Sep 13 2019
%K sign,easy
%O 0,2
%A _N. J. A. Sloane_, Alejandro Teruel (teruel(AT)usb.ve)
%E Better description from _Michael Somos_, Jan 12 2000
%E More terms added by _G. C. Greubel_, Sep 13 2019