I want to construct the group $C_p:C_3$ in GAP, where $p$ is prime and $p\equiv 1 \pmod 3$.
Originally, I come up with this
for p in [1..1000] do
if IsPrime(p) and (p mod 3)=1 then
N:=CyclicGroup(IsPermGroup,p);
G:=CyclicGroup(IsPermGroup,3);
AutN:=AutomorphismGroup(N);
for i in [1..Size(AutN)] do
f:=GroupHomomorphismByImages(G,AutN,
GeneratorsOfGroup(G),[Elements(AutN)[i]]);
if f<>fail then
NG:=SemidirectProduct(G,f,N);
Print(IdGroup(NG),"\n");
fi;
od;
fi;#IsPrime and p mod 3 =1
od;#p
which works fine, but then I had a thought.
At present, this will also find the direct product, which is the case f: G -> Aut(N) is the trivial homomorphism. I could get rid of this by explicitly excluding it, or alternatively, if the identity element of AutN
is always Elements(AutN)[1]
I could just run the i
loop from [2..p-1]
.
We will also find each non-trivial semidirect product twice, because the map sending the generator of Cp to the automorphism x, and the map sending the generator of Cp to x^-1, will give isomorphic semidirect products.
So I revised the code a little but am still unsure of how to get rid of the non-trivial semidirect product twice and now it does not work in GAP.
for p in [1..1000] do
if IsPrime(p) and (p mod 3)=1 then
N:=CyclicGroup(IsPermGroup,p);
G:=CyclicGroup(IsPermGroup,3);
AutN:=AutomorphismGroup(N);
for i in [2..p-1] do
f:=GroupHomomorphismByImages(G,AutN,
GeneratorsOfGroup(G),[Elements(AutN)[i]]);
if f<>fail then
NG:=SemidirectProduct(G,f,N);
Print(IdGroup(NG),"\n");
fi;
od;
fi;#IsPrime and p mod 3=1
od;#p
Any ideas?
Best Answer
To make your code output every non-trivial semi-direct product exactly once, insert after the line Print(IdGroup(NG),"\n"); the command of GAP break; But better yet, instead of the loop, use the command RootsMod( 1, 3, p);