# Testing for Schmidt groups with GAP

I've written the following simple code to test (with GAP) whether a finite group $G$ is a Schmidt group, that is, a group which is not nilpotent but each of its proper subgroups is.

IsSchmidtGroup := function(G)
local M,i; i:=0;;
if Length(Factors(Order(G))) = 1 then
return false;
elif Length(Factors(Order(G))) > 2 then
return false;
elif IsNilpotentGroup(G) then
return false;
else
for M in ConjugacyClassesMaximalSubgroups(G) do
if IsNilpotentGroup(M) then
i:=i+1;
fi;
od;
if Length(ConjugacyClassesMaximalSubgroups(G)) = i then
return true;
else
return false;
fi;
fi;
end;


The purpose of the first if is to discard $p$-groups. It is known that a Schmidt group has exactly two prime divisors, so the second if takes care of that. The third one asks if the group is nilpotent, despite having exactly two prime divisors for its order. The final part actually tests if each maximal subgroup of $G$ is nilpotent (clearly, this is equivalent to $G$ being a Schmidt group).

BUT: I'm doing something wrong here, since the I've asked for IsSchmidtGroup(S), S being the symmetric group of order 6, and I get an error.

I have a further, unrelated, question. I'm thinking I should ask it here, because it is quite specific and I don't believe anyone would benefit in any way from reading it (but I'm happy to ask it separately). I define the following function in GAP, which takes a group $G$ and returns the probability that two subgroups of $G$ permute:

spd := function(G)
local allsubs, subreps, count, H, K;
subreps := Flat(List(ConjugacyClassesSubgroups(G),Representative));
allsubs := Flat(List(ConjugacyClassesSubgroups(G),Elements));
count:=0;
for H in subreps do;
for K in allsubs do;
if ArePermutableSubgroups(H,K) then
count := count+Index(G,Normalizer(G,H));
fi;
od;
od;
return Float(count/(Size(allsubs)^2));
end;


Ok, but now I want to define a new function, call it spd_sect, which assigns to each group $G$ the minimum of $\mathrm{spd}(S)$ as $S$ runs over all sections of $G$ (and then look at their difference in certain cases). I was thinking something along the lines of:

spd_sect := function(G)
local subreps, s, H, K; s:=1.0;;
subreps := Flat(List(ConjugacyClassesSubgroups(G),Representative));
for H in subreps do;
for K in NormalSubgroups(H) do;
if spd(FactorGroup(H,K)) < s then s:=spd(FactorGroup(H,K)); fi;
od;
od;
return s;
end;


Does this look ok?

ConjugacyClassesMAximalSubgroups returns classes of subgroups, not the actual subgroups. So you should replace the for' loop by

for M in List(ConjugacyClassesMaximalSubgroups(G),Representative) do


or

for M in MaximalSubgroupClassReps(G) do


Also (simplifying the logic), instead of counting, your loop could simply use

if not IsNilpotentGroup(M) then return false;fi;


and at the end of the loop return true;`