login
A138188
Expansion of (1 - 2*x - 2*x^2 - x^3)/(1 + x + x^2 - x^3 - x^4 - x^5).
3
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, -19, 0, 19, -21, 0, 21, -23, 0, 23, -25, 0, 25, -27, 0, 27, -29, 0, 29, -31, 0, 31, -33, 0, 33, -35, 0, 35, -37, 0, 37, -39, 0, 39, -41, 0, 41
OFFSET
0,2
COMMENTS
Partial sums of A138187.
Partial sums are A138189.
FORMULA
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
a(n) = (2*floor((n+5)/3)-1)*sign((n + 1) mod 3)*(-1)^(n mod 3). - Wesley Ivan Hurt, Jan 02 2022
MATHEMATICA
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 *)
PROG
(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
(Sage)
def A138188(n):
if (n%3==0): return 2*(n//3) +1
elif (n%3==1): return -(2*(n//3) +3)
else: return 0
[A138188(n) for n in (0..100)] # G. C. Greubel, Jun 16 2021
CROSSREFS
Sequence in context: A222794 A127749 A198431 * A229704 A372865 A014715
KEYWORD
easy,sign
AUTHOR
Paul Barry, Mar 04 2008
STATUS
approved