login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Triangle T(n,k) read by rows: coefficient [x^k] of the polynomial p(n,x) with p(0,x) = 1, p(1,x) = 2 - x, p(2,x) = 1 - 4*x + x^2 and p(n,x) = (2-x)*p(n-1,x) - p(n-2,x) if n>2.
9

%I #11 Mar 12 2020 18:59:15

%S 1,2,-1,1,-4,1,0,-8,6,-1,-1,-12,19,-8,1,-2,-15,44,-34,10,-1,-3,-16,84,

%T -104,53,-12,1,-4,-14,140,-258,200,-76,14,-1,-5,-8,210,-552,605,-340,

%U 103,-16,1,-6,3,288,-1056,1562,-1209,532,-134,18,-1,-7,20,363,-1848,3575,-3640,2170,-784,169,-20,1

%N Triangle T(n,k) read by rows: coefficient [x^k] of the polynomial p(n,x) with p(0,x) = 1, p(1,x) = 2 - x, p(2,x) = 1 - 4*x + x^2 and p(n,x) = (2-x)*p(n-1,x) - p(n-2,x) if n>2.

%C Row sums: A117373(n-1).

%H G. C. Greubel, <a href="/A136674/b136674.txt">Rows n = 0..100 of triangle, flattened</a>

%F T(n,k) = 2*T(n-1,k) - T(n-2,k) - T(n-1,k-1). - _R. J. Mathar_, Jan 12 2011

%e Triangle begins as:

%e 1;

%e 2, -1;

%e 1, -4, 1;

%e 0, -8, 6, -1;

%e -1, -12, 19, -8, 1;

%e -2, -15, 44, -34, 10, -1;

%e -3, -16, 84, -104, 53, -12, 1;

%e -4, -14, 140, -258, 200, -76, 14, -1;

%e -5, -8, 210, -552, 605, -340, 103, -16, 1;

%e -6, 3, 288, -1056, 1562, -1209, 532, -134, 18, -1;

%e -7, 20, 363, -1848, 3575, -3640, 2170, -784, 169, -20, 1;

%p A136674aux := proc(n) option remember; if n = 0 then 1; elif n= 1 then 2-x ; elif n= 2 then 1-4*x+x^2 ; else (2-x)*procname(n-1)-procname(n-2) ; end if; end proc:

%p A136674 := proc(n,k) coeftayl(A136674aux(n),x=0,k) ; end proc: # _R. J. Mathar_, Jan 12 2011

%t (* tridiagonal matrix code*)

%t T[n_, m_, d_]:= If[n==m, 2, If[n==d && m==d-1, -3, If[(n==m-1 || n==m+1), -1, 0]]];

%t M[d_]:= Table[T[n, m, d], {n,d}, {m,d}];

%t Join[{{1}}, Table[CoefficientList[Det[M[d] - x*IdentityMatrix[d]], x], {d, 1, 10}]]//Flatten

%t (* polynomial recursion: three initial terms necessary*)

%t p[x, 0]:= 1; p[x, 1]:= (2-x); p[x, 2]:= 1 -4*x +x^2;

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

%t Table[ExpandAll[p[x, n]], {n, 0, Length[g] -1}]

%t (* Third program *)

%t T[n_, k_]:= T[n, k]= If[k<0 || k>n, 0, If[k==n, (-1)^n, If[k==0, 3-n, 2*T[n-1, k] -T[n-2, k] -T[n-1, k-1] ]]]; Table[T[n, k], {n, 0, 10}, {k, 0, n}]//Flatten (* _G. C. Greubel_, Mar 12 2020 *)

%o (Sage)

%o @CachedFunction

%o def T(n, k):

%o if (k<0 or k>n): return 0

%o elif (k==n): return (-1)^n

%o elif (k==0): return 3-n

%o else: return 2*T(n-1,k) - T(n-2,k) - T(n-1,k-1)

%o [[T(n, k) for k in (0..n)] for n in (0..10)] # _G. C. Greubel_, Mar 12 2020

%K easy,tabl,sign

%O 0,2

%A _Roger L. Bagula_, Apr 05 2008