A138188 Expansion of (1 - 2*x - 2*x^2 - x^3)/(1 + x + x^2 - x^3 - x^4 - x^5).
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
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (-1,-1,1,1,1).
Programs
-
Magma
R
:=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 -
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 *)
-
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
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
Comments