vector := function(g, h) local ind, s, list, dc, i, t; ind := Index(g, h); s := Size(DoubleCosets(g, h, h)); list := []; dc := DoubleCosetRepsAndSizes(g, h, h); for i in [1..s] do t := Index(h, Intersection(h, h^dc[i][1])); Add(list, t); od; Sort(list); return Reversed(list); end;; prob := function(list) local length, prod, i, t; length := Length(list); prod := 1; for i in [1..length] do t := list[i]; prod := prod*Factorial(t)/(t^t); od; return prod; end;; tp := function(g) local auxlist, subreps, h; auxlist := []; subreps := Filtered(List(ConjugacyClassesSubgroups(g), Representative), x-> not IsNormal(g, x)); if Size(subreps) = 0 then return 1; fi; for h in subreps do Add(auxlist, prob(vector(g, h))); od; Sort(auxlist); return auxlist[1]; end;; tp_with_vector := function(g) local auxlist, subreps, h; auxlist := []; subreps := Filtered(List(ConjugacyClassesSubgroups(g), Representative), x-> not IsNormal(g, x)); if Size(subreps) = 0 then return 1; fi; for h in subreps do Add(auxlist, [prob(vector(g, h)), vector(g, h)]); od; Sort(auxlist); return auxlist[1]; end;;