Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #33 Sep 08 2022 08:46:15
%S 1,6,-3,-16,1,22,-3,-32,1,38,-3,-48,1,54,-3,-64,1,70,-3,-80,1,86,-3,
%T -96,1,102,-3,-112,1,118,-3,-128,1,134,-3,-144,1,150,-3,-160,1,166,-3,
%U -176,1,182,-3,-192,1,198,-3,-208,1,214,-3,-224,1,230,-3,-240,1,246,-3,-256,1,262,-3
%N Expansion of (1 + 5*x - 7*x^2 - 3*x^3)/((1 - x)*(1 + x^2)^2).
%H G. C. Greubel, <a href="/A267831/b267831.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,-2,2,-1,1).
%F G.f.: (1 + 5*x - 7*x^2 - 3*x^3)/((1 - x)*(1 + x^2)^2).
%F a(n) = Sum_{k = 0..n} (-1)^(1/2 - sin((2*k + 1)*Pi/4)/sqrt(2))*(4*k + 1).
%F a(n) = -8*floor((n - 3)/4)^2 - 21*floor((n - 3)/4) - 8*floor((n - 2)/4)^2 + 8*floor((n - 1)/4)^2 + 8*floor(n/4)^2 - 17*floor((n - 2)/4) + 13*floor((n - 1)/4) + 9*floor(n/4) - 16.
%F a(n) = -1 + (2 + (1 + 4*n)*(1 - (-1)^n)/2)*(-1)^((n-1)*n/2). Therefore: a(4*k) = 1, a(4*k+1) = 2*(8*k+3), a(4*k+2) = -3, a(4*k+3) = -16*(k+1). [_Bruno Berselli_, Jan 21 2016]
%e a(0) = (0 + 1) = 1;
%e a(1) = (0 + 1) + (2 + 3) = 6;
%e a(2) = (0 + 1) + (2 + 3) - (4 + 5) = -3;
%e a(3) = (0 + 1) + (2 + 3) - (4 + 5) - (6 + 7) = -16;
%e a(4) = (0 + 1) + (2 + 3) - (4 + 5) - (6 + 7) + (8 + 9) = 1;
%e a(5) = (0 + 1) + (2 + 3) - (4 + 5) - (6 + 7) + (8 + 9) + (10 + 11) = 22, etc.
%t Table[Sum[(-1)^(1/2 - Sin[(2 k + 1) (Pi/4)]/Sqrt[2]) (4 k + 1), {k, 0, n}], {n, 0, 70}]
%t Table[-8 Floor[(n - 3)/4]^2 - 21 Floor[(n - 3)/4] - 8 Floor[(n - 2)/4]^2 + 8 Floor[(n - 1)/4]^2 + 8 Floor[n/4]^2 - 17 Floor[(n - 2)/4] + 13 Floor[(n - 1)/4] + 9 Floor[n/4] - 16, {n, 0, 70}]
%t Table[-1 + (2 + (1 + 4 n) (1 - (-1)^n)/2) (-1)^((n - 1) n/2), {n, 0, 70}] (* _Bruno Berselli_, Jan 21 2016 *)
%t LinearRecurrence[{1, -2, 2, -1, 1}, {1, 6, -3, -16, 1}, 70] (* _Vincenzo Librandi_, Jan 21 2016 *)
%o (Sage) [-1+(2+(1+4*n)*(1-(-1)^n)/2)*(-1)^((n-1)*n/2) for n in (0..70)]; # _Bruno Berselli_, Jan 21 2016
%o (Magma) &cat [[1,2*(8*n+3),-3,-16*(n+1)]: n in [0..17]]; // _Bruno Berselli_, Jan 21 2016
%o (Magma) I:=[1,6,-3,-16,1]; [n le 5 select I[n] else Self(n-1)-2*Self(n-2)+2*Self(n-3)-Self(n-4)+Self(n-5): n in [1..70]]; // _Vincenzo Librandi_, Jan 21 2016
%o (PARI) Vec((1 + 5*x - 7*x^2 - 3*x^3)/((1 - x)*(1 + x^2)^2) + O(x^70)) \\ _Michel Marcus_, Oct 29 2017
%Y Cf. A000217, A001477, A042948, A004767, A021913, A083392.
%K sign,easy
%O 0,2
%A _Ilya Gutkovskiy_, Jan 21 2016