First time here? Check out the FAQ!
answered 2022-04-15 16:55:34 +0100
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)