login
Triangle read by rows: T(n,0)=1, T(n,n)=(2*n-1)!!+1, T(n,k) = 2*(n-k) * T(n-1,k-1) + 2*(k+1)*T(n-1,k).
1

%I #8 Sep 10 2019 21:36:21

%S 1,1,2,1,10,4,1,44,44,16,1,182,440,216,106,1,736,3732,3488,1492,946,1,

%T 2954,28280,50296,28872,14336,10396,1,11828,199220,628608,590496,

%U 287520,174216,135136,1,47326,1337256,7021064,10933824,6993216,3589104,2510608,2027026

%N Triangle read by rows: T(n,0)=1, T(n,n)=(2*n-1)!!+1, T(n,k) = 2*(n-k) * T(n-1,k-1) + 2*(k+1)*T(n-1,k).

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

%F Sum_{k=0..n} T(n, k) = (2*k+1)!! = (2*k+1)*(2*k-1)*(2*k-3)*...

%e Triangle begins:

%e 1;

%e 1, 2;

%e 1, 10 4;

%e 1, 44, 44, 16;

%e 1, 182, 440, 216, 106;

%p T:=proc(n,k) if k=0 then 1 elif n=k then 1+(2*k)!/(k!*2^k) elif k>n then 0 else 2*(n-k)*T(n-1,k-1)+(2*k+2)*T(n-1,k) fi end: for n from 0 to 9 do [seq(T(n,k),k=0..n)] od;

%t T[n_, k_]:= T[n, k]= If[k==0, 1, If[k==n, (2*n-1)!! +1, 2*(n-k)*T[n-1, k-1] + 2*(k+1)*T[n-1, k]]]; Table[T[n, k], {n,0,9}, {k,0,n}]//Flatten (* _G. C. Greubel_, Sep 03 2019 *)

%o (PARI) T(n,k) = if(k==0, 1, if(k==n, (2*n)!/(2^n*n!) + 1, 2*(n-k)*T(n-1, k-1) + 2*(k+1)*T(n-1, k)));

%o for(n=0,9, for(k=0,n, print1(T(n,k), ", "))) \\ _G. C. Greubel_, Sep 03 2019

%o (Sage)

%o def T(n, k):

%o if (k==0): return 1

%o elif (k==n): return factorial(2*n)/(2^n*factorial(n)) + 1

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

%o [[T(n, k) for k in (0..n)] for n in (0..9)] # _G. C. Greubel_, Sep 03 2019

%o (GAP)

%o T:= function(n,k)

%o if k=0 then return 1;

%o elif k=n then return Factorial(2*n)/(2^n*Factorial(n)) + 1;

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

%o fi;

%o end;

%o Flat(List([0..9], n-> List([0..n], k-> T(n,k) ))); # _G. C. Greubel_, Sep 03 2019

%Y Cf. A060187.

%K easy,nonn,tabl

%O 0,3

%A _Miklos Kristof_, Nov 11 2004

%E Name corrected by _G. C. Greubel_, Sep 04 2019