For a prime number and nonnegative integers , Wilson theorem gives by replacing the last factors of with . For odd , have the same parity; for , both signs have the same residue class. Thus , including the endpoint cases .
Fermat's little theorem says that for a prime and , ; equivalently for every integer . The Wilson theorem says for a prime (and, conversely, this congruence characterizes primes among integers greater than one).
For , is a square root of minus one modulo a prime. If is odd and , Fermat's little theorem gives
so is even and . Conversely, put . Pairing with in the factorial gives . For , is even, so the Wilson theorem yields . Thus
and in the latter case supplies a solution.
For the multiplicative order assertion, divide by : , . Since and , it follows that . Minimality of the positive order excludes , hence and
In particular by Fermat's little theorem. Negative , if included, are handled by the same division using the modular inverse of .
A Fermat number in the paper has . If a prime divides , it is odd and . Squaring gives , so the order divides . It does not divide , since modulo an odd prime. Every divisor of is a power of two, so the only possibility is
If two different Fermat numbers shared a prime factor, the same element modulo that prime would have two different orders. This is impossible, proving pairwise coprimality. Also , so for every such prime is modulo . No prime modulo can occur.
A prime modulo need not occur: take . It is prime, , and . Since the order divides , the first congruence excludes every divisor of and the second excludes ; hence the order is . This is not a power of two, so is not a prime divisor of a Fermat number. The index restriction matters: the conventional extra number is outside the paper's positive- family.
The geometric sum gives
Since , its factorization at the nonidentity th roots of unity yields
Each factor is a unit, and Wilson theorem gives . Set . Then is a principal unit and
The minus sign comes from the product of the nonzero elements of the residue field, not from an arbitrary choice of uniformizer.
The Fermat-Euler theorem states that for an integer and a positive integer with ,
where the Euler totient function counts the residue classes coprime to . For , choose a reduced residue system . Multiplication by the unit modulo n preserves coprimality and is injective on these residue classes: implies , because has a multiplicative inverse modulo . It therefore permutes the reduced residue system, giving
The product is also a unit modulo n, so it can be cancelled. This proves the Fermat-Euler theorem. For every modular congruence is automatic; one may use .
For a prime number , the Euler totient function has value . Thus whenever . Multiplying by , and treating separately, gives the all-integer version of Fermat's little theorem:
Finally, Wilson theorem states that for every prime number , . Its converse is also true: an integer is prime exactly when . For the converse, any proper divisor would divide both and , contradicting that congruence.
Suppose . Then is a unit modulo n for modulus , and Fermat's little theorem implies
Since is an odd prime number, and are distinct residue classes. Therefore is even, and .
Conversely, put . Pair each integer with in the factorial. Wilson theorem yields
When , is even, so satisfies . This proves the first supplementary law for quadratic reciprocity without assuming a primitive root. Hence
The two solutions are and modulo : their difference is nonzero, and factoring shows that a degree-two polynomial over the field of residues modulo has no further roots.
Split the factorial at , using :
By Wilson theorem, this is . Therefore . If the prime number is odd, then is even, so and
For , the signs and are identical modulo , and the two possibilities also give the same result. The empty product convention includes the endpoint cases. This is the complementary factorial congruence.
Bezout identity gives integers with whenever , so . If are inverses, multiplying by an inverse gives . Multiplying Bezout identities for and shows that .
Wilson theorem states that for prime . Pair the nonzero residues with their unique multiplicative inverses. The only self-inverse residues are , whose product is , proving the theorem.
Counting one factor of for every multiple of , another for every multiple of , and so on proves Legendre formula
Now , so . Also , while , so .
Finally,
For , , so the second factor is a -adic unit. If , then
Lagrange theorem for polynomial congruences says that a nonzero polynomial of degree over the finite field has at most roots. To prove it, use mathematical induction on . A constant nonzero polynomial has no roots. If , polynomial division in the field gives with . Every root other than is a root of , so the induction hypothesis gives at most roots.
Every nonzero residue class modulo has a unique multiplicative inverse. In the product , pair each class with its inverse. The unpaired classes satisfy , hence . By the theorem these are exactly and , and therefore
This is Wilson theorem.
Now write . By Fermat's little theorem, every nonzero class is a root of
The second factor has degree and hence at most roots. Since their union contains all nonzero classes, has at least roots; Lagrange's theorem gives at most . Thus has exactly solutions.
For prime , the nonzero residues pair with their distinct inverses except for and , so Wilson theorem gives
If composite has a factorization with , both factors occur in . If , the distinct factors and occur and their product is divisible by ; the excluded case is exactly . Thus .
The Fermat-Euler theorem states when . For prime , , giving Fermat's little theorem for ; the form also covers .
If , induction and the binomial theorem show
Indeed, write and raise to the th power; every nonleading binomial term gains enough powers of .
Fix and choose any odd prime . Put
Fermat's theorem gives , and is odd, so . Also , hence . For odd ,
is composite. This generalized repunit pseudoprime construction gives infinitely many distinct base- pseudoprimes because the values are unbounded.
The Wilson theorem states that for a prime ,
Indeed, every nonzero residue modulo has a unique multiplicative inverse. The only residues equal to their own inverses solve , hence are and . Pairing every other residue with its distinct inverse leaves
The Fermat little theorem states that for prime ,
equivalently, if , then .
Wilson's theorem at gives
so . Also , and therefore
We use the coefficient form of the Combinatorial Nullstellensatz: if a polynomial of degree has nonzero coefficient at , then it cannot vanish on every product set with .
Write the terms as and, over , put
and
Consider
A direct multinomial-coefficient calculation, using Wilson's theorem, shows that the coefficient of in is nonzero. The Combinatorial Nullstellensatz with every therefore gives an indicator vector for which .
The zero indicator does not work. The first two factors force the selected vectors to have both coordinate sums zero. If the support size is not divisible by , Fermat's little theorem makes , while the final product also vanishes; hence the support has size , , or . Size proves the claim, and size reduces to part (a). For size ,
so the bracket vanishes, again contradicting . Only the size- and reducible size- cases remain, and either yields the required zero-sum -subsequence.
For prime , pair each nonzero residue with its inverse; only are self-inverse, yielding Wilson theorem. Conversely, if , every is a unit (otherwise a common divisor would divide the left side and but not ), so is prime.