%I #37 Nov 08 2024 07:23:27
%S 1,1,0,-2,1,3,-5,1,6,-8,1,9,-11,1,12,-14,1,15,-17,1,18,-20,1,21,-23,1,
%T 24,-26,1,27,-29,1,30,-32,1,33,-35,1,36,-38,1,39,-41,1,42,-44,1,45,
%U -47,1,48,-50,1,51,-53,1,54,-56,1,57,-59,1,60,-62,1,63,-65
%N Expansion of (x + 1)*(3*x^2 + 2*x + 1)/(x^2 + x + 1)^2.
%H G. C. Greubel, <a href="/A239286/b239286.txt">Table of n, a(n) for n = 0..5000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (-2,-3,-2,-1).
%F a(n) = Sum_{k=ceiling((n-1)/2)..n} (-1)^(k+1)*C(k+1,n-k)*(k*n-1)/(k+1).
%F a(3n+1) = 1, a(3n) = 1 - 3n, a(3n+2) = 3n. - _Ralf Stephan_, Mar 17 2014
%t CoefficientList[Series[(x+1)*(3*x^2+2*x+1)/(x^2+x+1)^2, {x, 0, 50}], x] (* or *) LinearRecurrence[{-2,-3,-2,-1}, {1, 1, 0, -2}, 30] (* _G. C. Greubel_, May 26 2018 *)
%o (Maxima) a(n):=sum(((-1)^(k+1)*binomial(k+1,n-k)*(k*n-1))/(k+1), k,ceiling((n-1)/2),n);
%o (PARI) my(x='x+O('x^30)); Vec((x+1)*(3*x^2+2*x+1)/(x^2+x+1)^2) \\ _G. C. Greubel_, May 26 2018
%K sign,easy
%O 0,4
%A _Vladimir Kruchinin_, Mar 14 2014