Given a ranked list (permutation) $R$ of $n$ elements, how many permutations of the same elements are there at Kendall-Tau distance $d$ from $R$ $(0 \le d \le \frac{n(n-1)}{2})$?
Example: If $R = abc$ then there are $2$ permutations at $d=1$ from $R$, namely: $bac$ and $acb$.
Generally, there is $1$ ranked list at distance $0$, $(n-1)$ lists at distance $1$, etc, but what is the formula for any $d$?
Following and improving on Julia's line of thought, here's the function to calculate the number of lists of length $n$ at Kendall-Tau distance $d$ from some permutation: