T(n,k) is also the number of permutations with Kendall tau distance ("bubble-sort distance") to the identity permutation being at most k. This is the number of swaps performed by the bubble-sort algorithm to sort the sequence.

The above only gives T(n,k) for k<=n(n-1)/2, but T(n,k)=n! for all k>=n(n-1)/2.