Carmichael number Created 2026-09-24 Updated 2026-10-18
A Carmichael number is a composite number for which
Every unit modulo satisfies the same modular congruence supplied by Fermat's little theorem for a prime number. The name refers to Robert Daniel Carmichael. The coprime qualification is essential: a nonunit can expose a prime factor through a greatest common divisor calculation. A Carmichael number is therefore a Fermat pseudoprime to every coprime base, rather than to every nonzero residue class.[ref]
For example,
The factors are distinct prime numbers. Their predecessor numbers all divide , so Korselt criterion applies. More explicitly, for any integer coprime to , Fermat's little theorem gives
The Chinese remainder theorem combines these into . This proves all coprime bases pass from three short divisibility checks, rather than from a long table of sampled bases.
Figure 1.
Three prime factors certify that every unit passes the Fermat congruence modulo 561
. Original arithmetic certificate for . Exponents divide with quotients ; the Chinese remainder theorem combines the three prime-modulus conclusions. Details.
Equivalently, a composite is a Carmichael number exactly when for every integer , including nonunits. The equivalence follows from Korselt criterion: modulo each prime factor, either is zero or its nonzero power returns to one, and squarefreeness combines those congruences. This does not say a nonunit satisfies . For instance gives , while ; the greatest common divisor already supplies the factor three.[ref]
The Carmichael function supplies another compact description: a composite is Carmichael exactly when . For , and . In contrast, Euler's totient function gives , which does not divide . The least common return exponent, rather than the number of units, controls this test.
The obstruction is useful to know when interpreting a Fermat primality test: even checking every coprime base cannot certify primality. The passing-base fraction for the Fermat test makes this failure quantitative. Stronger primality tests require additional structure, such as the squaring conditions in a Miller-Rabin primality test.
The historical record predates the name. Václav Šimerka's 1885 paper lists on printed page 224, together with factorizations. This is an early published list of examples, independently of their later name.[ref]
Choose a primitive root modulo and write the nonzero coefficients as . The Chinese remainder theorem gives an exponent congruent to modulo , respectively. Then and the three roots , , give the displayed common nonzero residue. This technique converts multiplicative power constraints into simultaneous additive modular congruences for exponents.
Fermat little theorem Created 2026-09-24 Updated 2026-10-14
For a prime number and an integer not divisible by , Fermat's little theorem states the modular congruence
Equivalently, for every integer , including and multiples of ,
The first formulation follows from the second by multiplying by a modular multiplicative inverse of . Conversely, multiply the first by when ; when , both sides of the second are zero modulo . The divisibility condition in the first formulation is essential.[ref]
For , , so and . Also , while : a zero residue class cannot satisfy the first formulation. It does satisfy . A failure at a zero residue class therefore says nothing against a candidate's being a prime number.
The prime number is included. Its only nonzero residue class is one: every odd integer satisfies . Every integer also satisfies , because is even. Testing the first formulation with an even integer would violate its hypothesis.
The useful surprise is that every nonzero residue class returns to one at the same exponent , although its shortest return can be earlier. This gives exponent reduction for units: for a nonnegative integer , when . It also computes a modular multiplicative inverse as modulo , including . Repeated squaring makes these modular exponentiations practical.
In group theory, the nonzero residue classes form the multiplicative group of integers modulo n with , of group order . Lagrange's theorem says that the multiplicative order of divides , giving the guaranteed return. Euler's theorem extends this to a general integer modulus , using the units and Euler's totient function ; the Carmichael function gives the least common return exponent for all units. A nonzero residue class modulo a composite number need not be a unit.
Leonhard Euler's paper presented in 1732 and published in 1738 states a historical formulation: Theorem 1 says that powers with exponent leave zero or one upon division by a prime number . The preceding discussion states the difference-of-powers version and explicitly says that he does not have its proof.[ref]
Fermat test example 2026-10-14
For the Fermat primality test, a passing base satisfies . Passing proves only this modular congruence, not that is a prime number. An odd composite number that passes a coprime base is a Fermat pseudoprime to that base. A Carmichael number passes every coprime base, so even testing all the units would not certify that is a prime number. [ref]
This small table uses only the bases , each reduced modulo first. A numeric entry is : one passes, while any other numeric entry gives a Fermat witness. A "factor" entry records a proper greatest common divisor and stops before modular exponentiation. The prime/composite classification is independently established by trial division or the displayed prime factorization, not by the passing entries. These four bases are illustrative, with no asserted universal coverage or error probability.
Table 1.
Finite-base Fermat primality test examples with explicit greatest common divisor checks
.
Independent classification
2Prime numberZero residue: excluded111
7Prime number1111
15: composite number4Factor 3Factor 51
341: composite number15667Factor 11
561: composite number1Factor 31Factor 11
For , and , so . Yet and , so three is a Fermat witness. One coprime base passes and another fails: being a Fermat pseudoprime depends on the base. Choosing eleven instead reveals the proper factor through .
For , every coprime base passes: each of divides , so Fermat's little theorem gives modulo each prime factor; the Chinese remainder theorem combines the three modular congruences. Equivalently, the Carmichael function gives . Bases two and five have greatest common divisor one and pass, but , and expose factors. The qualification "coprime" is therefore crucial even for a Carmichael number.
The Fermat primality test is useful because a Fermat witness can prove compositeness using repeated squaring without finding a factor. Its failure to certify a passing candidate motivates stronger primality testing methods such as the Miller-Rabin primality test.
Assume that with implies . For a finite list of primes in that residue class, let be their product. Every prime divisor of is greater than three and satisfies that quadratic modular congruence, hence has residue one modulo six. None is listed because modulo a listed prime.
// Target: combinatorics.bigb
Legendre symbol Created 2026-09-24 Updated 2026-10-18
For an integer and an odd prime , the Legendre symbol is the integer valued function
Its value depends only on the congruence class of modulo ; the displayed notation is a symbol, not division. The value zero handles separately from quadratic residues and quadratic nonresidues.[ref]
For example, , , , and . The equality illustrates that choosing a different integer representative does not change the answer. An arbitrary odd composite denominator uses the Jacobi symbol, not the Legendre symbol. For instance,
but two is not a square modulo fifteen: any such square root would also give a square root modulo three, where the only nonzero square is one. A Jacobi symbol of one therefore cannot replace the Legendre symbol's square test.
The Legendre symbol also counts square roots compactly. For every congruence class in the prime field ,
The three cases give two, one and zero solutions for a quadratic residue, zero and a quadratic nonresidue, respectively. This is useful when counting solutions of modular congruences involving polynomials: a solvability question becomes a sum of Legendre symbols, as in the complete Legendre-symbol sum and quadratic Legendre-symbol correlation.
Modular congruence Created 2026-09-24 Updated 2026-10-31
For integers and a positive integer modulus , modular congruence means
Thus for some integer : the two integers differ by complete cycles of length . For example, because , and because . A modular congruence need not be an equality of integers.
On a twelve-position clock labelled , adding five to nine follows . Hence : the final position remembers the remainder while forgetting a complete revolution.
Figure 1.
Adding five to nine takes five clockwise steps and ends at two modulo twelve
. Details.
The same idea tracks any count repeating every steps. It also lets us compute sums and products with small residue classes, reducing intermediate results without changing the final class. The justification comes from addition and multiplication being well-defined on residue classes.
In Disquisitiones arithmeticae (1801), Carl Friedrich Gauss defines modular congruence by divisibility in article 1; article 2 describes the integers and adopts . These passages document his presentation and notation, without claiming that repeating remainders began in 1801. [ref]
Modular multiplicative inverse Created 2026-09-24 Updated 2026-10-13
For integers and , a modular multiplicative inverse is a congruence class satisfying . It exists exactly when . Necessity follows because every common divisor of would divide . Conversely, Bézout's identity gives for coprime integers, making an inverse. This is the basic bridge from greatest common divisor calculations to reversible modular arithmetic.
For example, , so . The modular congruence therefore has the unique solution class . Multiplication by sends all seventeen residue classes to different classes; multiplying by reverses it. The inverse criterion and its algorithmic construction are presented in Ankur Moitra, MIT 18.200, 2024, modular inverses and Euclid's algorithm.
By contrast, has no modular inverse modulo . Its products have only residues . Consequently has no solution, while has five solution classes, . Dividing by a noninvertible residue would discard this distinction. In a prime field , every nonzero residue is invertible; a general integer modulus instead gives a quotient ring that can have zero divisors.
Figure 1.
Multiplication by five is reversible modulo seventeen but collapses classes modulo fifteen
. Details.
Multiplicativity of the Legendre symbol Created 2026-09-29 Updated 2026-10-18
For an odd prime and any integers , the Legendre symbol obeys
In particular, if , then , where is a modular multiplicative inverse. Multiplication by a nonzero square also leaves the Legendre symbol unchanged: for .[ref]
The subgroup and coset arguments under quadratic residue and quadratic nonresidue prove the sign rule without computing a large power: square times square is square, square times nonsquare is nonsquare, and nonsquare times nonsquare is square. If either factor is zero modulo , both sides of the identity vanish. On , the Legendre symbol is thus a group homomorphism to whose kernel of a group homomorphism is the quadratic residue subgroup. Viewed on all integers, it is a completely multiplicative function and a Dirichlet character modulo .
Figure 1.
Products modulo seven: the Legendre symbol reduces a six-by-six table to sign multiplication
. Rows and columns put quadratic residues before quadratic nonresidues . Every cell displays the product modulo seven and its Legendre symbol. The four blocks have signs , showing the subgroup and its other coset. Details.
For an original calculation, factor the numerator . Modulo seven, , agreeing with . Modulo eleven, the signs are instead , giving , agreeing with . The same factorization can therefore certify different square behavior at different prime numbers.
Alternatively, Euler's criterion gives modulo . For nonzero factors both sides correspond to signs in . Since is odd, these signs are distinct modulo , so the modular congruence proves the asserted equality of integers, not merely an equality of representatives.
p-adic absolute value Created 2026-09-24 Updated 2026-10-14
Fix a prime number . Write a nonzero rational number as , where and the nonzero integers are not divisible by . The exponent is uniquely determined. Its P-adic valuation is this signed exponent : equivalently, for any nonzero integer numerator and denominator ,
Factors of in the numerator decrease the p-adic absolute value; factors in the denominator increase it. For the computations are:
Rational number FactorizationP-adic valuation 2-adic absolute value
Not applicable by convention
This is an absolute value on a field measuring divisibility, rather than the magnitude on a real number number line. It satisfies
The proof comes directly from P-adic valuations: exponents add in a product of numbers, and extracting a common power of from a sum gives . If the two P-adic valuations differ, the remaining term with smaller exponent cannot cancel modulo , so equality holds. Thus the p-adic absolute value is a Non-Archimedean absolute value. [ref]
The metric makes two rational numbers close when their difference contains a high power of . This packages successive modular congruences into a numerical error estimate, allowing convergence in a metric space and convergent series to encode exact arithmetic information.
Let count everyone present, including the host. The grouping, seating and departure conditions give the modular congruences
The first two imply , and oddness forces even. By the Chinese remainder theorem, the complete solution is
Because not every invitee attended, at most guests came, so . For , the only positive possibility is 39 people. It is feasible: seven groups of five and one of four; three tables of ten and one of nine; nineteen departing pairs and the host.
For , both 39 and 129 people are possible. The latter uses twenty-five groups of five and one of four, three tables of ten and eleven of nine, and sixty-four departing pairs. Thus the larger invitation count destroys uniqueness; it does not force a different attendance.
The modular congruence first implies . Multiplication by such an permutes the nonzero residue classes modulo the prime : if , cancellation gives . Multiply all these residues and cancel their nonzero product to obtain , the usual short proof of Fermat little theorem.
Now . By the Euclid lemma, either or . In the latter case, because ,
contradicting the preceding product argument, since is odd. Thus
No unproved assertion about the number of fourth roots is needed.
A prime number is an integer whose only positive divisors are and . Every integer greater than one has a prime factorization; in particular it has a prime divisor.
To prove infinitely many primes congruent to minus one modulo six, suppose a finite list contains all such primes, and put ; the empty product is one. The integer is coprime to , so each prime factor is congruent to or modulo . If all its prime factors, counted with multiplicity, were congruent to , their product would also be congruent to . But . Hence some prime divisor satisfies . None of the listed primes divides , since . This contradicts completeness of the list.
For infinitely many primes congruent to one modulo six, suppose instead that lists every prime congruent to modulo , and use
It is odd. Since each listed prime is coprime to , , so and does not divide it. Any prime divisor is therefore greater than and satisfies the modular congruence
The allowed quadratic-congruence result gives . Yet , and , so no listed prime divides . Again there is a new prime in the required residue class. Thus both residue classes and contain infinitely many primes.
An equivalence relation on is a binary relation that is reflexive, symmetric and transitive: for every ; ; and . Write , using the stated order for composition of relations. Composition is associative because both possible bracketings mean that there is a two-step sequence of intermediate witnesses. Reflexivity shows
and also that is reflexive. Transitivity and reflexivity of the original relations give , . Since both original relations are symmetric,
The four parts below show that each condition is equivalent to the commuting equivalence relations condition .
For the integer example, put . Membership of in the composite means that some satisfies , for integers . Consequently is divisible by . Conversely, if is divisible by , the Bezout identity expresses it as ; setting provides the required witness. Thus
Reversing the roles of gives exactly the same modular congruence relation, hence . This verifies all four conditions and identifies their common smallest equivalence relation explicitly.
Fermat's little theorem states that, for a prime number and any integer ,
If , both sides vanish modulo . Otherwise multiplication by permutes the nonzero residue classes modulo : it is injective because implies by cancellation. Taking the products of these residues gives
The factorial is coprime to , so cancellation proves and hence the stated version. This proves Fermat's little theorem in both cases.
Let be a Carmichael number. If a prime square divided , choose . Since is an odd composite integer, , and . This contradicts the required modular congruence modulo . Therefore every Carmichael number is squarefree.
For each prime divisor of , choose the allowed primitive root modulo . The Carmichael identity applied to the positive integer gives , and cancellation gives . By its defining order property,
Conversely, suppose a composite integer is squarefree and has this divisibility for every prime divisor. For an arbitrary integer , modulo a prime divisor there are two cases. If , then . Otherwise Fermat's little theorem and give , so again . Since the prime divisors are distinct and pairwise coprime, their product divides . This is the proof of Korselt criterion:
If for distinct odd primes with , the condition at would require . Reducing modulo gives , so . But , which is impossible. Thus a product of two distinct odd primes is not Carmichael.
For , squarefreeness is automatic. Since ,
Apply the analogous reductions at and to obtain
Finally , with distinct odd prime factors, and
All three divisibilities hold, so 1729 is a Carmichael number.
Use the given integer satisfying . The Euclidean lattice under consideration has basis , because every vector in it is uniquely with . Its fundamental parallelogram therefore has area
We use the following two-dimensional form of the Minkowski convex body theorem: a convex, centrally symmetric measurable subset of of area strictly greater than four times the covolume of a full-rank Euclidean lattice contains a nonzero vector of that lattice. Apply it to the closed disk of squared radius . Its area is , so it contains a nonzero lattice vector satisfying
On the other hand the defining modular congruence and imply
There is exactly one positive multiple of strictly below , so . Neither coordinate can be zero, since a prime is not the square of an integer. This congruence lattice proof of the prime sum of two squares proves the required case of the sum of two squares theorem without assuming any conclusion at the critical area .
For every prime factor of , Fermat's little theorem gives . Since divides the least common multiple , it follows that . The primes are distinct and hence pairwise coprime, so their product divides this integer. Thus
For the specified product, and . Since , raising the preceding modular congruence to the forty-eighth power proves for every coprime to . This is the defining phenomenon of a Carmichael number.
Let . If the linear congruence holds, then for some integer , so the greatest common divisor divides . Conversely, Bézout's identity gives integers with . If , multiply this identity by to obtain . Hence
For the number of solutions, write , and . The linear congruence becomes , where are coprime integers. Multiplication by is invertible modulo by Bézout's identity, so the solutions form one residue class . Modulo , these are exactly
They are distinct: if two have the same residue class modulo , then divides , forcing ; with , this forces . Every other solution differs from by a multiple of , so these exhaust the solutions.
Finally,
Combining this with the existence criterion gives the requested equivalent modular congruence.
Eliminate by twice the first modular congruence minus three times the second. This gives
The modular inverse of is , because . Hence . Substitution into the second modular congruence gives , and , so . Thus
In particular, works: and . The elimination is reversible because and have modular inverses, so the displayed classes contain all solutions.
The Chinese remainder theorem says that for pairwise coprime positive moduli , every choice of residues determines exactly one residue class modulo . Equivalently is an isomorphism under reduction.
The first two modular congruences combine to . Reducing this expression modulo seven gives , so . Consequently all integer solutions are
The moduli are pairwise coprime, so the Chinese remainder theorem guarantees that this is the entire solution class.