Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
6-liner: Generator, divmod, list.pop, math.factorial solution in Clear category for Reversed Permutation Index by Phil15
from math import factorial
def reversed_permutation_index(m, n):
L, n = list(range(m)), n - 1
while L:
k, n = divmod(n, factorial(len(L)-1))
yield L.pop(k)
Sept. 28, 2019
Comments: