nth_permutation.py