login
Expansion of x + (1-x)^2/(1-x^6).
2

%I #20 Sep 08 2022 08:45:24

%S 1,-1,1,0,0,0,1,-2,1,0,0,0,1,-2,1,0,0,0,1,-2,1,0,0,0,1,-2,1,0,0,0,1,

%T -2,1,0,0,0,1,-2,1,0,0,0,1,-2,1,0,0,0,1,-2,1,0,0,0,1,-2,1,0,0,0,1,-2,1

%N Expansion of x + (1-x)^2/(1-x^6).

%C Diagonal sums of A117906.

%H G. C. Greubel, <a href="/A117907/b117907.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 G.f.: (1 +x^2 +x^3 +x^4 +x^5 +x^6)/(1 +x +x^2 +x^3 +x^4 +x^5).

%F a(n) = floor((5*n-1)/3) mod 2 - 3*[(n mod 6) = 1], n >= 2, with a(0) = 1, a(1) = -1. - _G. C. Greubel_, Oct 20 2021

%t (* From _Harvey P. Dale_, Nov 29 2013 *)

%t CoefficientList[Series[x+(1-x)^2/(1-x^6), {x,0,90}], x]

%t Join[{1,-1}, LinearRecurrence[{-1,-1,-1,-1,-1}, {1,0,0,0,1}, 90]]

%t PadRight[{1,-1}, 90, {1,-2,1,0,0,0}] (* End *)

%o (Magma) R<x>:=PowerSeriesRing(Integers(), 90); Coefficients(R!( x + (1-x)^2/(1-x^6) )); // _G. C. Greubel_, Oct 20 2021

%o (Sage)

%o def A117907(n): return (-1)^n if (n<2) else (((5*n-1)//3)%2) - 3*bool(n%6==1)

%o [A117907(n) for n in (0..90)] # _G. C. Greubel_, Oct 20 2021

%Y Cf. A088911, A117906.

%K easy,sign

%O 0,8

%A _Paul Barry_, Apr 01 2006