Combinatorica`
Combinatorica`

NumberOfPermutationsByInversions

NumberOfPermutationsByInversions[n,k]

gives the number of permutations of length n with exactly k inversions.

NumberOfPermutationsByInversions[n]

gives a table of the number of length-n permutations with k inversions, for all k.

Details