For a unit modulo n and a nonnegative integer , division with remainder writes with . Euler's theorem then gives
This replaces a potentially enormous exponent by a small remainder. The exponent itself is reduced modulo Euler's totient function, while the powers are reduced modulo : these are different integer moduli.
For a worked modulo-fifteen calculation, seven is coprime to fifteen and . Therefore
Use exponentiation by squaring on the remaining exponent , reducing after each multiplication:
Thus . Modular exponentiation supplies the computation; Euler's theorem supplies the optional shortening of its exponent. Exponentiation by squaring also works for nonunit bases, without using this shortening.
The guaranteed exponent is a common return exponent and an upper bound on the shortest period; it need not be that period. The multiplicative order is the least positive return exponent for the chosen unit. The Carmichael function is the least positive return exponent that works for every unit. Their precise relation is
Either smaller return exponent can replace in exponent reduction for units. Modulo fifteen, , so gives immediately. For base four the multiplicative order is only two, smaller even than . A return at exponent eight alone does not prove that the multiplicative order is eight.[ref]
Figure 1.
Actual power periods, Carmichael function exponents and Euler return exponents
. Each row lists powers from exponent zero through eight. Highlighted first returns identify multiplicative orders; the accompanying labels distinguish a chosen base's shortest period, the common exponent for all units, and Euler's totient function. Powers of the nonunit three modulo fifteen repeat after an initial term but never return to one at a positive exponent. The final calculation compares reduction of modulo eight and modulo four. Details.
If the reduced exponent is zero, the rule gives , and still requires a unit. Applying it to the nonunit three would falsely predict ; the actual residue is six. For negative exponents, first interpret the power using a modular multiplicative inverse, as in modular exponentiation.
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]
Choose a reduced residue system . For a unit modulo n , the bijection on the unit group has inverse . Comparing products before and after this permutation gives
The product is a unit; its modular inverse cancels it, proving Euler's theorem. Merely being nonzero would not justify cancellation.[ref]
In the modulo-twelve example, . The permuted representatives have the same product, while the unreduced products equal . Equating these products modulo twelve exposes the fourth power without calculating it directly. Using all nonzero congruence classes instead would include nonunits, whose product need not permit cancellation.
Multiplicative order Created 2026-09-24 Updated 2026-10-13
For coprime integers with , the multiplicative order is the least positive integer such that
It counts the distinct powers in the cyclic subgroup generated by the congruence class of . Thus it is an order of a group element in the unit group .[ref]
For example, the modular exponentiation , starting at , produces . The first return to one takes three steps, so . Starting at the congruence class three and repeatedly multiplying by two instead gives : these are the other three units modulo seven, outside the cyclic subgroup generated by two.
Figure 1.
Multiplication by two modulo seven has two cycles; its powers follow the cycle through one
. Details.
Euler's theorem guarantees a return to one at exponent , where is Euler's totient function. Thus the multiplicative order exists for every unit.[ref] In fact,
By Lagrange's theorem, the size of the cyclic subgroup divides the size of the unit group, which is Euler's totient function. For two modulo seven, this is ; the multiplicative order need not equal Euler's totient function. If , its multiplicative order is one.
The coprime integers hypothesis is necessary: if , any common divisor of and divides one. For instance, powers of two modulo eight give , with no positive-exponent return to one. This sequence eventually settles, but two has no multiplicative order modulo eight.
Order as the exact period of modular exponentiation Created 2026-09-24 Updated 2026-10-14
Let be coprime integers with , and let be their multiplicative order. For integers ,
Negative exponents mean powers of the modular inverse of . Thus periodic modular exponentiation has smallest positive period , and are distinct congruence classes.[ref]
This lets a huge modular exponentiation reuse a short list: reduce its exponent modulo the multiplicative order, then look up the corresponding power. For example, gives , while gives . When the multiplicative order is unknown, Euler's theorem permits reduction modulo Euler's totient function, though that period may be longer. Repeated squaring remains useful when computing either the unreduced or the reduced power.
For a proof outline, multiply by the modular inverse of , leaving . Apply Euclidean division to write with . Then ; minimality of the multiplicative order forces . The reverse implication follows from . The coprime integers hypothesis enables cancellation: modulo eight, , but this repetition supplies no multiplicative order for two.
Take the positive integer whose existence is allowed by the question and write
Modulo , if then directly. Otherwise Fermat's little theorem applies, since is a multiple of . Hence . The same two-case argument works modulo . By the Chinese remainder theorem,
so
This also covers a ciphertext that is not coprime to ; applying Euler's theorem without checking that hypothesis would miss this detail. Equivalently, repeated application of a permutation on a finite set eventually returns to the starting point, although the arithmetic argument gives the requested sufficient exponent.
For , Euler's theorem allows , since are coprime integers. At every congruence holds and one may take . Let be the multiplicative order of modulo . Write a nonnegative exponent with using the Euclidean division. Then , so implies by minimality of . Thus . Negative exponents, if included, give the same conclusion using the inverse residue of .
A prime divisor of a Fermat number is odd, and satisfies . Therefore , so its multiplicative order divides . It does not divide , since modulo the odd prime. Every divisor of is a power of two, hence
By Fermat's little theorem and the divisibility just proved, , giving .
Euler's totient function is
Euler's theorem states that implies . For , let be the invertible residue classes modulo . Multiplication by permutes these classes, since it has an inverse modulo . Multiplying the resulting congruences gives
Every factor is a unit, so the product can be cancelled, proving the theorem. The case is immediate. For distinct prime numbers , removing multiples of either prime from gives
For the RSA cryptosystem, choose distinct large primes , put , and choose coprime to . Compute with . The public key is ; the private exponent is retained secretly. Represent a message by , encrypt by , and decrypt by .
To prove correct decryption even for messages not coprime to , write . Modulo , if then ; otherwise Fermat's little theorem gives . The same reasoning holds modulo . The Chinese remainder theorem therefore gives , and the chosen representative recovers . Thus decryption works for every message residue, not merely the units.
Euler's totient function is
Euler's theorem states that implies . For , let be the invertible residue classes modulo . Multiplication by permutes these classes, since it has an inverse modulo . Multiplying the resulting congruences gives
Every factor is a unit, so the product can be cancelled, proving the theorem. The case is immediate. For distinct prime numbers , removing multiples of either prime from gives
For the RSA cryptosystem, choose distinct large primes , put , and choose coprime to . Compute with . The public key is ; the private exponent is retained secretly. Represent a message by , encrypt by , and decrypt by .
To prove correct decryption even for messages not coprime to , write . Modulo , if then ; otherwise Fermat's little theorem gives . The same reasoning holds modulo . The Chinese remainder theorem therefore gives , and the chosen representative recovers . Thus decryption works for every message residue, not merely the units.
Euler's theorem states that if , then , where is Euler's totient function. This includes Fermat's little theorem when is prime.
For each prime-power factor , the integer divides the defined least common multiple . Euler's theorem modulo that prime power therefore gives
The prime powers are pairwise coprime, so their product divides . Equivalently the Chinese remainder theorem gives
For the specified composite integer,
Raising to the seventh power proves
Thus 561 is a Carmichael number. We use exactly the source's definition of as the least common multiple of prime-power totients; its validity here does not require replacing it by a smaller exponent at powers of two.
Tetration 2026-10-20
Repeated exponentiation with right association: and . For example, , rather than . Computing its remainder modulo an integer often uses a chain of smaller exponent moduli; applying Euler's theorem requires checking its coprimality hypothesis at every level.