%I #63 Sep 08 2022 08:46:17
%S 1,-1,2,-3,4,-5,6,-7,8,-9,10,-11,12,-13,14,-15,16,-17,18,-19,20,-21,
%T 22,-23,24,-25,26,-27,28,-29,30,-31,32,-33,34,-35,36,-37,38,-39,40,
%U -41,42,-43,44,-45,46,-47,48,-49,50,-51,52,-53,54,-55,56,-57,58,-59
%N a(n) = (-1)^n * n if n>0, a(0) = 1.
%C This is a divisibility sequence.
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (-2,-1).
%F Euler transform of length 3 sequence [-1, 2, -1].
%F a(n) = -b(n) where b() is multiplicative with b(2^e) = -(2^e) if e>0, b(p^e) = p^e otherwise.
%F E.g.f.: 1 - x * exp(-x).
%F G.f.: (1 + x + x^2) / (1 + 2*x + x^2).
%F G.f.: (1 - x) * (1 - x^3) / (1 - x^2)^2.
%F G.f.: 1 / (1 + x / (1 + x / (1 - x / (1 + x)))).
%F G.f.: 1 - x / (1 + x)^2 = 1 - x /(1 - x)^2 + 4*x^2 / (1 - x^2)^2.
%F a(n) = (-1)^n * A028310(n). a(2*n) = A004277(n). a(2*n + 1) = - A005408(n).
%F Convolution inverse of A106510.
%F A060576(n) = Sum_{k=0..n} binomial(n, k) * a(k).
%F A028310(n) = Sum_{k=0..n} binomial(n+1, k+1) * a(k).
%F a(n) = A038608(n), n>0. - _R. J. Mathar_, May 25 2020
%e 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 + ...
%t a[ n_] := If[ n < 1, Boole[n == 0], (-1)^n n];
%t a[ n_] := SeriesCoefficient[ (1 + x + x^2) / (1 + 2*x + x^2), {x, 0, n}];
%t LinearRecurrence[{-2,-1},{1,-1,2},60] (* _Harvey P. Dale_, Mar 30 2019 *)
%o (PARI) {a(n) = if( n<1, n==0, (-1)^n * n)};
%o (PARI) {a(n) = if( n<0, 0, polcoeff( (1 + x + x^2) / (1 + 2*x + x^2) + x * O(x^n), n))};
%o (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
%Y Cf. A004277, A005408, A028310, A060576, A106510.
%K sign,easy
%O 0,3
%A _Michael Somos_, Dec 28 2016