%I #7 Feb 25 2021 02:38:37
%S 1,1,1,1,2,1,1,3,3,1,1,4,96,4,1,1,5,320,320,5,1,1,6,960,14580,960,6,1,
%T 1,7,2688,76545,76545,2688,7,1,1,8,7168,367416,4587520,367416,7168,8,
%U 1,1,9,18432,1653372,33030144,33030144,1653372,18432,9,1
%N Triangle T(n, k) = (n-k)^n * binomial(n, n-k) for n < 2*k, k^n * binomial(n, k) for n >= 2*k with T(n, 0) = T(n, n) = 1, read by rows.
%C Row sums are: 1, 2, 4, 8, 106, 652, 16514, 158482, 5336706, 69403916, 2915603362, ...
%H G. C. Greubel, <a href="/A167040/b167040.txt">Rows n = 0..50 of the triangle, flattened</a>
%F From _G. C. Greubel_, Feb 24 2021: (Start)
%F T(n, k) = (n-k)^n * binomial(n, n-k) for n < 2*k, k^n * binomial(n, k) for n >= 2*k with T(n, 0) = T(n, n) = 1.
%F T(n, k) = T(n, n-k). (End)
%e Triangle begins as:
%e 1;
%e 1, 1;
%e 1, 2, 1;
%e 1, 3, 3, 1;
%e 1, 4, 96, 4, 1;
%e 1, 5, 320, 320, 5, 1;
%e 1, 6, 960, 14580, 960, 6, 1;
%e 1, 7, 2688, 76545, 76545, 2688, 7, 1;
%e 1, 8, 7168, 367416, 4587520, 367416, 7168, 8, 1;
%e 1, 9, 18432, 1653372, 33030144, 33030144, 1653372, 18432, 9, 1;
%e 1, 10, 46080, 7085880, 220200960, 2460937500, 220200960, 7085880, 46080, 10, 1;
%t T[n_, k_]:= If[k==0 || k==n, 1, If[n>=2*k, k^n*Binomial[n, k], (n-k)^n*Binomial[n, n-k]]];
%t Table[T[n, k], {n, 0, 12}, {k, 0, n}]//Flatten (* modified by _G. C. Greubel_, Feb 24 2021 *)
%o (Sage)
%o @CachedFunction
%o def T(n, k):
%o if (k==0 or k==n): return 1
%o elif (n > 2*k-1): return k^n*binomial(n,k)
%o else: return (n-k)^n*binomial(n,n-k)
%o flatten([[T(n, k) for k in (0..n)] for n in (0..12)]) # _G. C. Greubel_, Feb 24 2021
%o (Magma)
%o function T(n,k)
%o if k eq 0 or k eq n then return 1;
%o elif n lt 2*k then return (n-k)^n*Binomial(n,n-k);
%o else return k^n*Binomial(n,k);
%o end if; return T;
%o end function;
%o [T(n,k): k in [0..n], n in [0..12]]; // _G. C. Greubel_, Feb 24 2021
%K nonn,tabl,easy
%O 0,5
%A _Roger L. Bagula_ and _Mats Granvik_, Oct 27 2009
%E Edited by _G. C. Greubel_, Feb 24 2021