Revision history [back]

Factoring out permutations of SN

I'm trying to remove certain permutations from S_N.

I want to remove all permutations that leave the first [0...k[ indices invariant (except for Identity element). So what I'm looking for is S_{1,.., N} / S_{k, .., N}.

I understand that I could do ( N= 10, k=5 )

SN = SymmetricGroup(range(10))
SkN = SymmetricGroup(range(5,10)
permutations = [sigma for sigma in SN if sigma not in SkN]


but this is extremely slow. My goal here is to speed up my code and I end up generating twice as much permutations and doing extreme list checking.

I'm pretty sure people were smart enough to implement a feature that gives me back a generator Squotient = SN/SkN, but I could not find this in the documentation. Any ideas?