Problem 24: Lexicographic permutations