Revision history [back]

Same as the answer of lisbeth, but we restrict to conjugacy classes of subgroups. And use the fact that they come in the order of their orders. So if we pass the order eight we have a verdict. Sample code checking if the group G below has a subgroup isomorphic to Q8:

Q8 = QuaternionGroup()

def hasQ8isomorphicSubgroup(G, verbose=False):

for H in G.conjugacy_classes_subgroups():
if H.order() < 8:    continue
if H.order() > 8:    break
if verbose:
print(f"Subgroup of order 8 with structure {H.structure_description()}")
if H.is_isomorphic(Q8):
return True    # or we can return H
return False


Then we have for instance:

sage: G = PSL(2, 17)
....: hasQ8isomorphicSubgroup(G)
False

sage: G = PSL(2, 17)
....: hasQ8isomorphicSubgroup(G, verbose=True)
Subgroup of order 8 with structure C8
Subgroup of order 8 with structure D4
Subgroup of order 8 with structure D4
False


Some other example:

sage: G = PSL(3, 7)
sage: hasQ8isomorphicSubgroup(G, verbose=True)
Subgroup of order 8 with structure Q8
True