login
a(n) = -a(n-1) + a(n-2) + a(n-3), with a(0)=0, a(1)=1, a(2)=-3.
5

%I #30 Sep 08 2022 08:45:10

%S 0,1,-3,4,-6,7,-9,10,-12,13,-15,16,-18,19,-21,22,-24,25,-27,28,-30,31,

%T -33,34,-36,37,-39,40,-42,43,-45,46,-48,49,-51,52,-54,55,-57,58,-60,

%U 61,-63,64,-66,67,-69,70,-72,73,-75,76,-78,79,-81,82,-84,85,-87,88,-90

%N a(n) = -a(n-1) + a(n-2) + a(n-3), with a(0)=0, a(1)=1, a(2)=-3.

%H Colin Barker, <a href="/A084056/b084056.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,1,1).

%F a(n) = (1/4) * ((1-6*n) * (-1)^n - 1).

%F G.f.: (x-2*x^2)/((1+x)*(1-x^2)).

%F a(n) = 2*a(n-2) - a(n-4) = -(-1)^n * A032766(n) = A001057(n) - 2*A001057(n-1). - _Ralf Stephan_, Aug 18 2013

%F a(n) = (2n - 1 - floor((n-1)/2)) * (-1)^(n-1). - _Wesley Ivan Hurt_, Nov 10 2013

%p A084056:=n->((1-6*n) * (-1)^n - 1)/4; seq(A084056(n), n=0..100); # _Wesley Ivan Hurt_, Nov 10 2013

%t Table[((1 - 6n)(-1)^n - 1)/4, {n,0,100}] (* _Wesley Ivan Hurt_, Nov 10 2013 *)

%t LinearRecurrence[{-1, 1, 1}, {0, 1, -3}, 101] (* _T. D. Noe_, Nov 11 2013 *)

%o (Magma) [((1-6*n)*(-1)^n-1)/4 : n in [0..100]]; // _Zaki Khandaker_, Jun 21 2015

%o (PARI) concat(0, Vec(x*(2*x-1)/((x-1)*(x+1)^2) + O(x^100))) \\ _Colin Barker_, Jun 21 2015

%Y Cf. A032766 (absolute values).

%K easy,sign

%O 0,3

%A _Paul Barry_, May 09 2003

%E Definition fixed by _Ralf Stephan_, Aug 18 2013