A computing colleague asked me recently if I could devise an algorithm for obtaining the ith permutation in an alphabetical list.
Suppose that the n! permutations of n distinct letters A, B, C,..., N are listed in alphabetical order. The problem is: Given i (where i = 1,2,...,n!), find the ith permutation.