Skip to main content
The National Cipher Challenge

Reply To: Programming

#98459
_madness_
Participant

@ByteInBits,
I wrote a function to do the main part:

def nth_permutation(n,objects):
    perm = []
    n -= 1
    while len(objects) > 0:
        m = int(n/factorial(len(objects)-1))
        n -= m * factorial(len(objects)-1)
        perm.append(objects[m])
        objects.pop(m)
    return perm
Report a problem