OFFSET
0,3
COMMENTS
This is a divisibility sequence.
LINKS
FORMULA
Euler transform of length 3 sequence [-1, 2, -1].
a(n) = -b(n) where b() is multiplicative with b(2^e) = -(2^e) if e>0, b(p^e) = p^e otherwise.
E.g.f.: 1 - x * exp(-x).
G.f.: (1 + x + x^2) / (1 + 2*x + x^2).
G.f.: (1 - x) * (1 - x^3) / (1 - x^2)^2.
G.f.: 1 / (1 + x / (1 + x / (1 - x / (1 + x)))).
G.f.: 1 - x / (1 + x)^2 = 1 - x /(1 - x)^2 + 4*x^2 / (1 - x^2)^2.
Convolution inverse of A106510.
A060576(n) = Sum_{k=0..n} binomial(n, k) * a(k).
A028310(n) = Sum_{k=0..n} binomial(n+1, k+1) * a(k).
a(n) = A038608(n), n>0. - R. J. Mathar, May 25 2020
EXAMPLE
G.f. = 1 - x + 2*x^2 - 3*x^3 + 4*x^4 - 5*x^5 + 6*x^6 - 7*x^7 + 8*x^8 + ...
MATHEMATICA
a[ n_] := If[ n < 1, Boole[n == 0], (-1)^n n];
a[ n_] := SeriesCoefficient[ (1 + x + x^2) / (1 + 2*x + x^2), {x, 0, n}];
LinearRecurrence[{-2, -1}, {1, -1, 2}, 60] (* Harvey P. Dale, Mar 30 2019 *)
PROG
(PARI) {a(n) = if( n<1, n==0, (-1)^n * n)};
(PARI) {a(n) = if( n<0, 0, polcoeff( (1 + x + x^2) / (1 + 2*x + x^2) + x * O(x^n), n))};
(Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!((1 + x+x^2)/(1+2*x+x^2))); // G. C. Greubel, Jul 29 2018
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Michael Somos, Dec 28 2016
STATUS
approved