login
Coefficients of polynomial recursion p(n,x) = (x-1)*(p(n-1,x) - (x+1)*p(n-2,x)), p(0,x) = 1, p(1,x) = x+1.
1

%I #21 Dec 28 2023 11:33:53

%S 1,1,1,1,1,-1,-1,-1,0,2,0,-1,2,0,-4,0,2,-3,2,7,-4,-5,2,1,5,-5,-11,11,

%T 7,-7,-1,1,-8,12,16,-28,-8,20,0,-4,13,-25,-20,60,-2,-46,12,12,-3,-1,

%U -21,50,19,-120,38,92,-50,-24,15,2,-1

%N Coefficients of polynomial recursion p(n,x) = (x-1)*(p(n-1,x) - (x+1)*p(n-2,x)), p(0,x) = 1, p(1,x) = x+1.

%C Only coefficients of x^k for k <= degree of p(n,x) are included. With this then, since p(2,x) = 0, row 2 is empty.

%C The same polynomial coefficients may be obtained, without signs, with the use of the recurrence p(x, n) = (x+1)*p(x, n-1) - (x^2-1)*p(x, n-2), and p(x, 0) = 1, p(x, 1) = x-1.

%H Robert Israel, <a href="/A136487/b136487.txt">Table of n, a(n) for n = 0..10103</a>(rows 0 to 141, flattened)

%F T(n, k) = coefficient [x^k] ( p(x, n) ), where p(x,n) = (x-1)*p(x,n-1) - (x^2-1)*p(x,n-2), p(x,0) = 1, p(x,1) = x+1.

%F Sum_{k >= 0} T(n, k) = A130706(n).

%F From _Robert Israel_, Dec 03 2018: (Start)

%F T(n,k) = T(n-1,k-1) - T(n-1,k) - T(n-2,k-2) + T(n-2,k).

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

%F T(n,0) = (-1)^(n+1)*A000045(n-2) for n >= 3. (End)

%e First few rows are:

%e 1;

%e 1, 1;

%e {};

%e 1, 1, -1, -1;

%e -1, 0, 2, 0, -1;

%e 2, 0, -4, 0, 2;

%e -3, 2, 7, -4, -5, 2, 1;

%e 5, -5, -11, 11, 7, -7, -1, 1;

%e -8, 12, 16, -28, -8, 20, 0, -4;

%e 13, -25, -20, 60, -2, -46, 12, 12, -3, -1;

%e -21, 50, 19, -120, 38, 92, -50, -24, 15, 2, -1;

%p F:= proc(n) option remember; expand((1-x)*procname(n-1)+(1-x^2)*procname(n-2)) end proc:

%p F(0):= 1: F(1):= 1+x:

%p R:=proc(n) local V,j;

%p V:= F(n);

%p seq(coeff(V,x,j),j=0..degree(V))

%p end proc:

%p for i from 0 to 20 do R(i) od; # _Robert Israel_, Dec 03 2018

%t P[x,0]= 1; P[x,1]= x+1; P[x_,n_]:= P[x,n]= (x-1)*(P[x,n-1] - (x+1)*P[x,n-2]);

%t Table[CoefficientList[P[x,n],x],{n,0,10}]//Flatten

%o (Magma)

%o m:=12;

%o function p(n,x)

%o if n le 1 then return (x+1)^n;

%o else return (x-1)*(p(n-1,x) - (x+1)*p(n-2,x)); end if;

%o end function;

%o R<x>:=PowerSeriesRing(Integers(), m+2);

%o T:= func< n,k | Coefficient(R!( p(n,x) ), k) >;

%o [1,1,1] cat [T(n,k): k in [0..n], n in [3..m]]; // _G. C. Greubel_, Jul 31 2023

%o (SageMath)

%o def p(n,x):

%o if n<2: return (x+1)^n

%o else: return (x-1)*(p(n-1,x) - (x+1)*p(n-2,x))

%o def T(n):

%o P.<x> = PowerSeriesRing(QQ)

%o return P( p(n,x) ).list()

%o flatten([T(n) for n in range(13)]) # _G. C. Greubel_, Jul 31 2023

%Y Cf. A000045, A130706 (row sums).

%K tabf,sign

%O 0,10

%A _Roger L. Bagula_, Mar 21 2008

%E Edited by _Robert Israel_, Dec 03 2018