# Computing the class-preserving automorphism group of finite $p$-groups

Let $$G$$ be a finite non-abelian $$p$$-group, where $$p$$ is a prime. An automorphism $$\alpha$$ of $$G$$ is called a class-preserving if for each $$x\in G$$, there exists an element $$g_x\in G$$ such that $$\alpha(x)=g_x^{-1}xg_x$$. An automorphism $$\alpha$$ of $$G$$ is called a $$2$$nd class-preserving if for each $$x\in G$$, there exists an element $$g_x\in G'=[G,G]$$ such that $$\alpha(x)=g_x^{-1}xg_x$$. Let $$\mathrm{Aut_c}(G)$$ and $$\mathrm{Aut_c^2}(G)$$ respectively denote the group of all class-preserving and $$2$$nd class-preserving automorphisms of $$G$$.

I have made a GAP program to find the structure of $$\mathrm{Aut_c}(G)$$ but I failed to make a GAP program to find the structure of $$\mathrm{Aut_c^2}(G)$$. The GAP program to find the structure of $$\mathrm{Aut_c}(G)$$ is following:

ClassPreservingAuts:= function(G)

local A,I,cc,gens,auts,a,ok,i,hom;

A:=AutomorphismGroup(G);

I:=InnerAutomorphismsAutomorphismGroup(A);

hom:=NaturalHomomorphismByNormalSubgroup(A,I);

cc:=ConjugacyClasses(G);

gens:=[];

auts:=Group([One(A)]);

$$\sharp$$ check for class preserving

for a in Elements(A) do

ok:=true;

$$\sharp$$ run through classes

i:=0;

while i$$<$$Length(cc) and ok=true do

i:=i+1;

if not (Representative(cc[i])^a in cc[i]) then

ok:=false;

fi;

od;

$$\sharp$$ a is class preserving

if ok=true and not (a in auts) then

auts:= Group(gens);

$$\sharp$$inng:=Image(hom(x));

$$\sharp$$gens:=GeneratorsOfGroup(inng);

fi;

od;

return auts;

return auts/I;

return Size(auts)/Size(I);

end;

My question is the following:

Can anybody help me to make a GAP program to find the structure of $$\mathrm{Aut_c^2}(G)$$?

• Cross posted to math.stackexchange.com/questions/3076661 There is a GAP forum mailing list, and you could ask there. – Derek Holt Jan 17 at 7:43
• Couldn't you adapt your program for Aut_c(G) by only including those automorphisms where g_x is in the commutator? – tj_ Jan 18 at 10:27
• I'm voting to close this question as off-topic because this is better suited for a GAP forum as Derek Holt suggests. – Neil Hoffman Jan 18 at 20:21
• First note that for a subgroup $U \le G$ the relation $g \sim h :\Leftrightarrow \exists u \in U: g=uhu^{-1}$ defines an equivalence relation on $G$ (I don't know if it has a name). In your case take $U:=G'$ the commutator. Then the following should work: (1) Replace cc:=ConjugacyClasses(G) by a set of $R$ of representatives for $\sim$ (2) Replace Representative(cc[i])^a in cc[i]) by a check if $a(g)$ and $g$ are in the same equivalence class for $g \in R$. -- These tasks are supported in GAP by the functions EquivalenceClasses and EquivalenceClassOfElement. – tj_ Jan 25 at 7:13