Here it is: for a given soluble group $G$, I want to test whether the number of Carter subgroups containing a given nilpotent subgroup $N$ of $G$ is congruent to $0$ or $1$ modulo a certain number $m(G)$, depending on $G$ and defined by $m(G) = \gcd\left\{p-1 : p \mid |G|,\, p \,\text{prime}\right\}$. Since I want $N$ to be arbitrary, I want this test for all nilpotent subgroups of $G$.
Of course, the question is pointless if $G$ is nilpotent, so I would also like to ask how to obtain a filtered list of all soluble but non-nilpotent groups up to a given order (say 100).
For reference, based on Max's suggestions:
LoadPackage("format”);;
count := function(G, N)
return
Number(ConjugacyClassSubgroups(G, CarterSubgroup(G)), x -> IsSubgroup(x, N));
end;;
grps := AllSmallGroups([1..100], IsNilpotentGroup, false, IsSolvableGroup, true);;
for i in [1..Length(grps)] do
G := grps[i];;
nilsubs := Filtered(List(ConjugacyClassesSubgroups(G),Representative),IsNilpotentGroup);;
for N in nilsubs do
if count(G,N) > 0 then
m := G -> Gcd(List(Set(Factors(Size(G))), p -> p-1));;
if count(G,N) mod m(G) > 1 then
Print(false);
fi;
fi;
od;
od;
The GAP package FORMAT allows computing things like Carter subgroups.
To compute all solvable but not nilpotent groups of order up to 100, you can use this:
So let's look at some examples
Since all Carter subgroups of a finite solvable group are conjugate, we can count how many of them contain $N$ quite easily:
Finally, you can compute the value mod $m(G)$ as follows:
UPDATE: Your comments indicate that what you really want to do is to test a conjecture which states that a certain number is always 0 or 1. The code you wrote based on my post does that; I edited it slightly to make it a bit faster.
UPDATE 2: Per your request, I changed the code to skip the case where the Carter subgroup is a Hall subgroup.