Passing-base fraction for the Fermat test

ID: passing-base-fraction-for-the-fermat-test

Among the units modulo , the passing residue classes form the kernel of a group homomorphism . If each trial samples independently and uniformly from those units, with replacement, the probability that trials all pass is . This statement assumes that sampling rule; it does not describe arbitrary or dependent choices of bases.
For , the Chinese remainder theorem identifies the unit group with cyclic groups of orders and . The number of solutions of is , among units. Thus . The Carmichael numbers and have passing fractions and , so their conditional false-pass probability remains one regardless of the number of independent trials.
Figure 1.
All nonzero bases: coprime passes, coprime witnesses and factor-revealing nonunits
. Exact enumeration for four stipulated moduli. A greatest common divisor check separates nonunits before modular exponentiation. Counts are finite arithmetic results, not measured rates or a universal bound for a primality test. Details.
The Fermat test example uses selected bases; this diagram exhausts the specified finite base sets. Both make the same logical distinction: an exponent witness can prove compositeness, whereas a passing result needs further justification before it can support a claim of primality.

New to topics? Read the docs here!