// p5g3r917.m
print "\nConstruct Khukhro's 3-generator 5-group counterexample to the Hughes",
  "\nconjecture, and then repeatedly factor out complements to c^5 in",
  "\nthe centre of the group, to obtain smaller counterexamples";

d := 3; p := 5; cl := 8; // ngens; prime; class
P := pQuotient( FreeGroup(d), p, cl : Exponent := p );
printf "\nB(3,5 : 8) has order %o^%o\n", p, FactoredOrder(P)[1][2];
G<a,b,c> := pCoveringGroup(P); 
printf "\nThe p-covering group G has order %o^%o and class %o",
  p, FactoredOrder(G)[1][2], pClass(G);
print "\nG is generated by a, b and c; and c has order", Order(c),
  "\n[b,a] has order", Order( (b,a) ), "; [c,a] has order", Order( (c,a) ),
  "; [c,b] has order", Order( (c,b) ),
  "\ngamma_2(G) is the normal closure of < [b,a], [c,a], [c,b] >,",
  "\nand gamma_2(G) has class at most 4, so gamma_2(G) has exponent 5";

print "\nNow compute suitable 5th powers of elements outside <c>G'";
load twB35c5; // should be already computed by gettestwords.m
S := [ x^p : x in testwords ];
H<a,b,c> := quo< G | S >; 
printf "The quotient group, H, has order %o^%o",
  p, FactoredOrder(H)[1][2];
print "\nH is generated by a, b and c; and c^5 =", c^p,
  "\nH is Khukhro's 3-generator anti-Hughes 5-group";
CurrentQ := H;

//Repeatedly factor out complements for c^5 in the centre
Z := Centre(CurrentQ);
while Order(Z) ne p do
  rank := FactoredOrder(Z)[1][2];
  printf "Z, its centre, has order %o^%o", p, rank;
  print "\nNow build a complement for c^5 in Z\n";
  ZGens := [ CurrentQ!Z.i : i in [1..rank] ];
  _, index := Max( Eltseq( c^p ) ); 
  ComplGens := [ ZGens[i] * (CurrentQ.index)^-Eltseq(ZGens[i])[index]
                     : i in [1..rank] ];
  NextQ<a,b,c> := quo< CurrentQ | ComplGens >; 
  printf "Factor it out to get an anti-Hughes group of order %o^%o",
        p, FactoredOrder(NextQ)[1][2];
        "\ngenerated by a, b and c; and c^5 =", c^p;
  CurrentQ := NextQ;
  Z := Centre(CurrentQ);
end while;

printf "The centre is generated by %o and has order %o^%o",
       CurrentQ!(Z.1), p, FactoredOrder(Z)[1][2];
printf "\nSo this method reduces to an anti-Hughes group with order %o^%o",
       p, FactoredOrder(CurrentQ)[1][2];
print "\nwhich is as far as we can reduce the group (by this method!)";

