%I #16 Sep 08 2022 08:45:18
%S 1,1,-1,-6,-11,-5,28,87,111,-46,-519,-1105,-812,2051,8003,12130,477,
%T -43213,-107764,-106273,133575,716562,1269265,492135,-3436796,
%U -10232533,-12529349,6701026,62284757,128290443,86849596,-256333913,-946668833
%N a(n) = a(n-1) - 2*a(n-2) - 3*a(n-3) - ... - (n-1)*a(1), with a(1) = a(2) = 1, a(3) = -1.
%H G. C. Greubel, <a href="/A106540/b106540.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-5,2).
%F a(n) = a(n-1) - Sum_{k=2..n-1} k*a(n-k), with a(1) = a(2) = 1, a(3) = -1.
%F G.f.: x*(1 - x)^2/(1 - 3*x + 5*x^2 - 2*x^3). - corrected by _R. J. Mathar_, Aug 22 2008
%F a(n) = 3*a(n-1) - 5*a(n-2) + 2*a(n-3). - _G. C. Greubel_, Sep 03 2021
%t LinearRecurrence[{3,-5,2}, {1,1,-1}, 40] (* _G. C. Greubel_, Sep 03 2021 *)
%o (Magma) I:=[1,1,-1]; [n le 3 select I[n] else 3*Self(n-1) - 5*Self(n-2) + 2*Self(n-3): n in [1..41]]; // _G. C. Greubel_, Sep 03 2021
%o (Sage)
%o def A106540_list(prec):
%o P.<x> = PowerSeriesRing(ZZ, prec)
%o return P( x*(1-x)^2/(1-3*x+5*x^2-2*x^3) ).list()
%o a=A106540_list(41); a[1:] # _G. C. Greubel_, Sep 03 2021
%Y Cf. A106541, A106542.
%K easy,sign
%O 1,4
%A _Alexandre Wajnberg_, May 08 2005
%E Extended beyond a(14) by _R. J. Mathar_, Aug 22 2008
|