Write . The second modular congruence becomes . The Bezout identity above says that is the inverse of modulo , so . Therefore
The checks are . The Chinese remainder theorem explains uniqueness modulo , since the moduli are coprime integers.
The Fermat-Euler theorem states that, for an integer and any integer coprime to ,
where the Euler totient function counts the residue classes coprime to .
Let be representatives of these residue classes. Multiplication by gives a permutation of them: each remains coprime to , and implies by cancellation using the modular inverse of . Multiplying all the resulting modular congruences yields
The product is itself coprime to , so it has a modular inverse and can be canceled. This proves the Fermat-Euler theorem. For , the congruence is trivial; no separate argument is needed.
For , the identity for binomial coefficients
shows that divides . Since is a prime number and is not divisible by , cancellation modulo gives
The binomial theorem consequently gives as a coefficientwise polynomial modular congruence. Apply the same identity with replaced by and use mathematical induction to obtain
This is an iteration of the Frobenius endomorphism in characteristic . Comparing the intermediate coefficients gives the prime-power binomial divisibility result
Reduce using modular congruence: its residue class modulo is , , or . A square number therefore has residue class or , and raising either residue to the positive integer power leaves it unchanged. Consequently
The exponent in the original PDF is ; the polynomial identities in the converted TeX are a transcription error. The argument uses ; it does not assign a value.
For a Pythagorean triple, each square number is or modulo . If neither nor were divisible by , modular congruence would give , impossible for a square number. Thus at least one of is divisible by ; both can be divisible, as in .
An odd number has square number congruent to modulo , whereas an even number has square number congruent to . If both and were odd numbers, their sum of square numbers would again be modulo , which no square number can be. Hence and cannot both be odd. They can both be even; the conclusion does not require the Pythagorean triple to be primitive.
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.
A reduced positive definite binary quadratic form satisfies
with when or . Its discriminant of a binary quadratic form is . The first displayed inequality already gives , while gives
Taking the positive square root yields
Moreover, , so . For fixed negative , the displayed bounds leave only finitely many possible integers and , and then is uniquely determined. Hence only finitely many reduced forms have discriminant .
For , the bound gives , so . The modular congruence condition makes odd. If , then and ; the boundary convention retains . If , then and ; the boundary convention retains . Thus the complete list is
The Lagrange root bound over a field says that a nonzero polynomial of degree over a field has at most roots. In particular, a polynomial modular congruence of degree modulo a prime number has at most incongruent solutions unless all its coefficients vanish modulo that prime.
Suppose that is good and that the positive integer divisor divides . The roots of form a finite multiplicative subgroup of . By the fact that every finite multiplicative subgroup of a field is cyclic, is a cyclic group of order . The solutions in of are
so there are at least of them. The Lagrange root bound over a field gives at most roots in all of , hence exactly . Thus every divisor of a good number is good.
Now put . By the Chinese remainder theorem for unit groups, a base is a Fermat-pseudoprime base precisely when its two components satisfy
The power roots in a finite field and
show that each component has ten choices. Therefore there are
Fermat-pseudoprime bases.
To impose the strong pseudoprime condition, write with odd. Since , we have . In each cyclic group of ten Fermat components, raising to the th power sends five elements to and five elements to . A pair of components passes the strong test exactly when their signs agree: the pair satisfies the first alternative, and satisfies the second at . Components of opposite sign become after squaring and can never jointly equal . Hence the number of strong-pseudoprime bases is