Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #19 Sep 08 2022 08:45:33
%S 1,-3,0,3,-5,0,5,-7,0,7,-9,0,9,-11,0,11,-13,0,13,-15,0,15,-17,0,17,
%T -19,0,19,-21,0,21,-23,0,23,-25,0,25,-27,0,27,-29,0,29,-31,0,31,-33,0,
%U 33,-35,0,35,-37,0,37,-39,0,39,-41,0,41
%N Expansion of (1 - 2*x - 2*x^2 - x^3)/(1 + x + x^2 - x^3 - x^4 - x^5).
%C Partial sums of A138187.
%C Partial sums are A138189.
%H G. C. Greubel, <a href="/A138188/b138188.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,-1,1,1,1).
%F a(n) = 2*floor(n/3) + 1 if (n mod 3) = 0, -(2*floor(n/3) + 3) if (n mod 3) = 1 and 0 if (n mod 3) = 2. - _G. C. Greubel_, Jun 16 2021
%F a(n) = (2*floor((n+5)/3)-1)*sign((n + 1) mod 3)*(-1)^(n mod 3). - _Wesley Ivan Hurt_, Jan 02 2022
%t a[n_]:= a[n]= If[Mod[n, 3]==0, 2*Floor[n/3] +1, If[Mod[n, 3]==1, -(2*Floor[n/3] +3), 0]]; Table[a[n], {n, 0, 100}] (* _G. C. Greubel_, Jun 16 2021 *)
%o (Magma) R<x>:=PowerSeriesRing(Integers(), 100); Coefficients(R!( (1-2*x-2*x^2-x^3)/(1+x+x^2-x^3-x^4-x^5) )); // _G. C. Greubel_, Jun 16 2021
%o (Sage)
%o def A138188(n):
%o if (n%3==0): return 2*(n//3) +1
%o elif (n%3==1): return -(2*(n//3) +3)
%o else: return 0
%o [A138188(n) for n in (0..100)] # _G. C. Greubel_, Jun 16 2021
%Y Cf. A138187, A138189.
%K easy,sign
%O 0,2
%A _Paul Barry_, Mar 04 2008