login
Expansion of (1-x)/(1+2*x-2*x^2+x^3).
3

%I #32 Jun 03 2024 12:19:14

%S 1,-3,8,-23,65,-184,521,-1475,4176,-11823,33473,-94768,268305,-759619,

%T 2150616,-6088775,17238401,-48804968,138175513,-391199363,1107554720,

%U -3135683679,8877676161,-25134274400,71159584801,-201465394563,570384233128,-1614858840183,4571951541185

%N Expansion of (1-x)/(1+2*x-2*x^2+x^3).

%C |a(n)| equals the number of n-length ternary words avoiding runs of zeros of lengths 3i+2, (i=0,1,2,...). - _Milan Janjic_, Feb 26 2015

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

%F a(n) = -2*a(n-1)+2*a(n-2)-a(n-3), a(0)=1, a(1)=-3, a(2)=8.

%F a(n) = sum(m=1..n, sum(k=m..n, (sum(j=0..m, binomial(j,-3*m+k+2*j) *2^(-3*m+k+2*j)*(-1)^(j-m)*(-3)^(3*m-k-j)*binomial(m,j))) *binomial(n+m-k-1,m-1))), n>0, a(0)=1. - _Vladimir Kruchinin_, May 06 2011

%t a[n_] := a[n] = -2 a[n - 1] + 2 a[n - 2] - a[n - 3]; a[0] = 1; a[1] = -3; a[2] = 8; Table[Simplify[a[n]], {n, 0, 20}] (* _Rigoberto Florez_, Mar 22 2020 *)

%o (Maxima)

%o a(n):=sum(sum((sum(binomial(j,-3*m+k+2*j)*2^(-3*m+k+2*j)*(-1)^(j-m)*(-3)^(3*m-k-j)*binomial(m,j),j,0,m))*binomial(n+m-k-1,m-1),k,m,n),m,1,n); /* _Vladimir Kruchinin_, May 06 2011 */

%Y Cf. A077983 (partial sums).

%K sign

%O 0,2

%A _N. J. A. Sloane_, Nov 17 2002