Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This can be done via reduced words:

P = Permutation([4, 8, 3, 1, 9, 2, 6, 7, 5])
r = P.reduced_word()
q = [(i,i+1) for i in r]
assert prod(Permutation(str(i)) for i in q[::-1]) == P
print(q)