Generating permutations of numbers 1..n in lexicographical order