%I #11 Sep 08 2022 08:45:52
%S 1,1,1,1,2,1,1,7,7,1,1,31,36,31,1,1,165,194,194,165,1,1,1031,1194,
%T 1218,1194,1031,1,1,7423,8452,8610,8610,8452,7423,1,1,60621,68042,
%U 69066,69200,69066,68042,60621,1,1,554249,614868,622284,623284,623284,622284,614868,554249,1
%N Triangle T(n,k) = 1 -A002627(k) -A002627(n-k) +A002627(n), read by rows.
%C Row sums are {1, 2, 4, 16, 100, 720, 5670, 48972, 464660, 4829372, 54711782, ...}.
%C Row sums s(n) appear to obey (2-n)*s(n) +(n+2)*(n-1)*s(n-2) -n*(2*n-1)*s(n-2) +n*(n-2)*s(n-3)=0. - _R. J. Mathar_, May 04 2013
%H G. C. Greubel, <a href="/A176305/b176305.txt">Rows n = 0..100 of triangle, flattened</a>
%F T(n,k) = T(n,n-k).
%e Triangle begins as:
%e 1;
%e 1, 1;
%e 1, 2, 1;
%e 1, 7, 7, 1;
%e 1, 31, 36, 31, 1;
%e 1, 165, 194, 194, 165, 1;
%e 1, 1031, 1194, 1218, 1194, 1031, 1;
%e 1, 7423, 8452, 8610, 8610, 8452, 7423, 1;
%e 1, 60621, 68042, 69066, 69200, 69066, 68042, 60621, 1;
%e 1, 554249, 614868, 622284, 623284, 623284, 622284, 614868, 554249, 1;
%p T:= proc(n, k) option remember;
%p if k=0 or k=n then 1
%p else 1 +floor(n!*(exp(1)-1)) -floor(k!*(exp(1)-1)) -floor((n-k)!*(exp(1)-1))
%p fi; end:
%p seq(seq(T(n, k), k=0..n), n=0..10); # _G. C. Greubel_, Nov 26 2019
%t (* First program *)
%t a[n_]:= a[n] = If[n==0,0,n*a[n-1] +1];
%t T[n_, k_]:= T[n, k] = 1 -(a[k] +a[n-k] -a[n]);
%t Table[T[n, k], {n,0,10}, {k,0,n}]//Flatten
%t (* Second program *)
%t T[n_, k_]:= T[n, k]= If[k==0 || k==n, 1, 1 +Floor[n!*(E-1)] -Floor[k!*(E-1)] - Floor[(n-k)!*(E-1)]]; Table[T[n, k], {n,0,10}, {k,0,n}]//Flatten (* _G. C. Greubel_, Nov 26 2019 *)
%o (PARI) T(n,k) = if(k==0 || k==n, 1, 1 +floor(n!*(exp(1)-1)) -floor(k!*(exp(1)-1)) -floor((n-k)!*(exp(1)-1)) ); \\ _G. C. Greubel_, Nov 26 2019
%o (Magma)b:= func< n | Factorial(n)*(Exp(1)-1)>;
%o function T(n,k)
%o if k eq 0 or k eq n then return 1;
%o else return 1 +Floor(b(n)) -Floor(b(k)) -Floor(b(n-k));
%o end if; return T; end function;
%o [T(n,k): k in [0..n], n in [0..10]]; // _G. C. Greubel_, Nov 26 2019
%o (Sage)
%o @CachedFunction
%o def b(n): return factorial(n)*(exp(1)-1);
%o def T(n, k):
%o if (k==0 or k==n): return 1
%o else: return 1 +floor(b(n)) -floor(b(k)) -floor(b(n-k))
%o [[T(n, k) for k in (0..n)] for n in (0..10)] # _G. C. Greubel_, Nov 26 2019
%K nonn,tabl
%O 0,5
%A _Roger L. Bagula_, Apr 14 2010