How to test number of containments in subgroups with GAP 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;

 A: 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:
gap> grps := AllSmallGroups([1..100], IsNilpotentGroup, false, IsSolvableGroup, true);;
gap> Length(grps);
463

So let's look at some examples
gap> LoadPackage("format");
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Loading  FORMAT 1.3 (Formations of Finite Soluble Groups)
by Bettina Eick (http://www.icm.tu-bs.de/~beick) and
   Charles R.B. Wright (http://www.uoregon.edu/~wright).
Homepage: http://www.uoregon.edu/~wright/RESEARCH/format/
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
true
gap> grps := AllSmallGroups([1..100], IsNilpotentGroup, false, IsSolvableGroup, true);;
gap> G := grps[100]; # some arbitrary group
<pc group of size 50 with 3 generators>
gap> N := NormalSubgroups(G)[3]; # some normal subgroup
Group([ f3 ])
gap> N := Group(G.1*G.3);; # some nilpotent subgroup
gap> IsNilpotentGroup(N);
true

Since all Carter subgroups of a finite solvable group are conjugate, we can count how many of them contain $N$ quite easily:
gap> count := function(G, N) return Number(ConjugacyClassSubgroups(G, CarterSubgroup(G)), x -> IsSubgroup(x, N)); end;;
gap> count(G,N);
1

Finally, you can compute the value mod $m(G)$ as follows:
gap> m := G -> Gcd(List(Set(Factors(Size(G))), p -> p-1));;
gap> count(G,N) mod m(G);
0


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.
LoadPackage("format");;
count := function(G, N) 
  return Number(ConjugacyClassSubgroups(G, CarterSubgroup(G)),
        x -> IsSubgroup(x, N)); 
end;;
m := G -> Gcd(List(Set(Factors(Size(G))), p -> p-1));;

grps := AllSmallGroups([1..100], IsNilpotentGroup, false, IsSolvableGroup, true);;

for i in [1..Length(grps)] do
  if i mod 50 = 0 then Print(i, " of ", Length(grps), "\n"); fi;
  G := grps[i];;

  # skip if Carter subgroup is a Hall subgroup
  H := CarterSubgroup(G);
  if Gcd(Size(H), Index(G, H)) = 1 then continue; fi;

  nilsubs := Filtered(List(ConjugacyClassesSubgroups(G),Representative),IsNilpotentGroup);;
  mG := m(G);
  for N in nilsubs do
    if count(G,N) mod mG > 1 then
      Print("Group ", IdGroup(G), " provides an example\n");
    fi;
  od;
od;

