|
|
A257145
|
|
a(n) = 5 * floor( (n+2) / 5) - n with a(0) = 1.
|
|
4
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Cycle period is 5, {0, -1, -2, 2, 1} after the first five terms. - Robert G. Wilson v, Aug 02 2018
|
|
LINKS
|
|
|
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.
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).
|
|
EXAMPLE
|
G.f. = 1 - x - 2*x^2 + 2*x^3 + x^4 - x^6 - 2*x^7 + 2*x^8 + x^9 - x^11 + ...
|
|
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*)
|
|
PROG
|
(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
(Haskell)
a257145 0 = 1
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|