My code works by finding the number of elements in the normalizer subgroup of a known Sylow p-subgroup of some group, so that I can find the number of Sylow p-subgroups of some group. For example:
A = GroupElements[SymmetricGroup[4]];
B = GroupElements[DihedralGroup[4]];
norm = {};
For[i = 1, i <= GroupOrder[SymmetricGroup[4]], i++, conj = {};
For[j = 1, j <= GroupOrder[DihedralGroup[4]], j++,
AppendTo[conj,
PermutationProduct[A[[i]], B[[j]], InversePermutation[A[[i]]]]]];
If[ContainsExactly[conj, B], AppendTo[norm, A[[i]]]]]
np = Length[A]/Length[Union[norm]]
The above code outputs 3, which is the correct answer to the question "how many Sylow 2-subgroups does S4 have?". Replacing the groups also gives the correct solution for Sylow 3-subgroups in S4, and Sylow 3- and 5-subgroups in A5. However, when I switch to trying to find the number of Sylow 2-subgroups of A5, and I change the groups to A5 and D2 (or Z2 x Z2), I get the wrong answer with the following code:
Alt5 = GroupElements[AlternatingGroup[5]];
V = GroupElements[DihedralGroup[2]];
norm = {};
For[i = 1, i <= GroupOrder[AlternatingGroup[5]], i++, conj = {};
For[j = 1, j <= GroupOrder[DihedralGroup[2]], j++,
AppendTo[conj,
PermutationProduct[Alt5[[i]], V[[j]],
InversePermutation[Alt5[[i]]]]]]; Print[conj];
If[ContainsExactly[conj, V], AppendTo[norm, Alt5[[i]]]]]
np = Length[Alt5]/Length[Union[norm]]
This code outputs 15, when the correct answer should be 5.