%I #20 Sep 08 2022 08:46:12
%S 1,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,
%T 2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,
%U -2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0,-1,-2,2,1,0
%N a(n) = 5 * floor( (n+2) / 5) - n with a(0) = 1.
%C Cycle period is 5, {0, -1, -2, 2, 1} after the first five terms. - _Robert G. Wilson v_, Aug 02 2018
%H G. C. Greubel, <a href="/A257145/b257145.txt">Table of n, a(n) for n = 0..2500</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (-1,-1,-1,-1).
%F Euler transform of length 5 sequence [-1, -2, 0, 0, 1].
%F a(5*n) = 0 for all n in Z except n=0.
%F a(n) = -a(-n) for all n in Z except n=0.
%F a(n) = a(n+5) for all n in Z except n=-5 or n=0.
%F Convolution inverse is A257143.
%F G.f.: (1 - x) * (1 - x^2)^2 / (1 - x^5).
%F G.f.: (1 - 2*x^2 + x^4) / (1 + x + x^2 + x^3 + x^4).
%F a(n) = -A117444(n), n>0. - _R. J. Mathar_, Oct 05 2017
%e G.f. = 1 - x - 2*x^2 + 2*x^3 + x^4 - x^6 - 2*x^7 + 2*x^8 + x^9 - x^11 + ...
%t a[ n_] := If[ n==0, 1, -Mod[ n, 5, -2]];
%t a[ n_] := If[ n==0, 1, Sign[n] SeriesCoefficient[ (1 - x) * (1 - x^2)^2 / (1 - x^5), {x, 0, Abs@n}]];
%t CoefficientList[Series[(1-x)*(1-x^2)^2/(1-x^5), {x,0,60}], x] (* _G. C. Greubel_, Aug 02 2018 *)
%t a[n_] := 5 Floor[(n + 2)/5] - n; Array[a, 77, 0] (* or *)
%t CoefficientList[ Series[(x - 1)^2 (x + 1)^2/(x^4 + x^3 + x^2 + x + 1), {x, 0, 76}], x] (* or *)
%t LinearRecurrence[{-1, -1, -1, -1}, {1, -1, -2, 2, 1, 0}, 76] (* _Robert G. Wilson v_, Aug 02 2018*)
%o (PARI) {a(n) = if( n==0, 1, (n+2) \ 5 * 5 - n)};
%o (PARI) {a(n) = if( n==0, 1, [0, -1, -2, 2, 1][n%5 + 1])};
%o (PARI) {a(n) = if( n==0, 1, sign(n) * polcoeff( (1 - x) * (1 - x^2)^2 / (1 - x^5) + x * O(x^abs(n)), abs(n)))};
%o (PARI) x='x+O('x^60); Vec((1-x)*(1-x^2)^2/(1-x^5)) \\ _G. C. Greubel_, Aug 02 2018
%o (Haskell)
%o a257145 0 = 1
%o a257145 n = div (n + 2) 5 * 5 - n -- _Reinhard Zumkeller_, Apr 17 2015
%o (Magma) m:=60; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!((1-x)*(1-x^2)^2/(1-x^5))); // _G. C. Greubel_, Aug 02 2018
%Y Cf. A257143, A253262, A117444.
%K sign,easy
%O 0,3
%A _Michael Somos_, Apr 16 2015
|