A257145 a(n) = 5 * floor( (n+2) / 5) - n with a(0) = 1.
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, 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, -2, 2, 1, 0, -1, -2, 2, 1, 0, -1, -2, 2, 1, 0, -1, -2, 2, 1, 0
Offset: 0
Examples
G.f. = 1 - x - 2*x^2 + 2*x^3 + x^4 - x^6 - 2*x^7 + 2*x^8 + x^9 - x^11 + ...
Links
- G. C. Greubel, Table of n, a(n) for n = 0..2500
- Index entries for linear recurrences with constant coefficients, signature (-1,-1,-1,-1).
Programs
-
Haskell
a257145 0 = 1 a257145 n = div (n + 2) 5 * 5 - n -- Reinhard Zumkeller, Apr 17 2015
-
Magma
m:=60; R
:=PowerSeriesRing(Integers(), m); Coefficients(R!((1-x)*(1-x^2)^2/(1-x^5))); // G. C. Greubel, Aug 02 2018 -
Mathematica
a[ n_] := If[ n==0, 1, -Mod[ n, 5, -2]]; a[ n_] := If[ n==0, 1, Sign[n] SeriesCoefficient[ (1 - x) * (1 - x^2)^2 / (1 - x^5), {x, 0, Abs@n}]]; CoefficientList[Series[(1-x)*(1-x^2)^2/(1-x^5), {x,0,60}], x] (* G. C. Greubel, Aug 02 2018 *) a[n_] := 5 Floor[(n + 2)/5] - n; Array[a, 77, 0] (* or *) CoefficientList[ Series[(x - 1)^2 (x + 1)^2/(x^4 + x^3 + x^2 + x + 1), {x, 0, 76}], x] (* or *) LinearRecurrence[{-1, -1, -1, -1}, {1, -1, -2, 2, 1, 0}, 76] (* Robert G. Wilson v, Aug 02 2018*)
-
PARI
{a(n) = if( n==0, 1, (n+2) \ 5 * 5 - n)};
-
PARI
{a(n) = if( n==0, 1, [0, -1, -2, 2, 1][n%5 + 1])};
-
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)))};
-
PARI
x='x+O('x^60); Vec((1-x)*(1-x^2)^2/(1-x^5)) \\ G. C. Greubel, Aug 02 2018
Formula
Euler transform of length 5 sequence [-1, -2, 0, 0, 1].
a(5*n) = 0 for all n in Z except n=0.
a(n) = -a(-n) for all n in Z except n=0.
a(n) = a(n+5) for all n in Z except n=-5 or n=0.
Convolution inverse is A257143.
G.f.: (1 - x) * (1 - x^2)^2 / (1 - x^5).
G.f.: (1 - 2*x^2 + x^4) / (1 + x + x^2 + x^3 + x^4).
a(n) = -A117444(n), n>0. - R. J. Mathar, Oct 05 2017
Comments