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.
Use the positive-exponent quantum Fourier transform convention . The period of a function here is the least positive translation leaving the function unchanged on the cyclic group . The injective promise means exactly when . In particular : the subgroup of period translations is generated by , and wrapping the argument by preserves its value. This is exact quantum period finding on a finite cyclic group, rather than the truncated, nondividing-period version requiring continued fractions.
Prepare a uniform superposition state in the first quantum register using , and perform a reversible computation of the function into a second quantum register, cleaning its workspace by uncomputation:
A quantum measurement in the computational basis of the second quantum register leaves a periodic coset state in the first:
For the quantum Fourier transform of this periodic coset state, the finite geometric series vanishes unless the measured label is . On those labels its normalized amplitude is . Thus has the uniform distribution on a finite set on , irrespective of .
Compute the greatest common divisor by the Euclidean algorithm, and set , with . Since ,
The exact period recovery from a Fourier sample is therefore certified by testing . Every candidate divides and lies between and , so the injective promise makes that equality equivalent to . This includes , where the test uses input , and , which always succeeds. The test does not assert that an arbitrary equality of function values certifies an arbitrary period; the Fourier-derived divisor restriction is essential.
The concise result is
Here is the Euler totient function, with . The totient lower bound from the Mertens product gives for . Each trial uses polynomial time quantum Fourier transforms, function evaluations and Euclidean algorithm arithmetic in . Repeating independent trials gives constant success probability; the herald accepts only correct answers.
The printed asymptotic bound has the wrong direction for this argument. In Big O notation, the stated upper bound on the number of coprime integers supplies no success lower bound and is itself false uniformly: for prime , , not . Likewise the single-trial success need not be , since it tends to one for prime. The meaningful corrected guarantee is the lower bound above. If an upper-bounded success rate is literally required, one may deliberately retain an accepted result with an independent probability proportional to ; this discards useful successes and is unnecessary for efficient recovery.
Measure the second register of . If the result is , injectivity within one period collapses the first register to the periodic coset state
Apply and measure the first register. By the stated transform identity, the outcome is
for a uniformly random .
Reduce the rational number
to lowest terms and call its denominator . The exact period recovery from a Fourier sample gives
Thus exactly when is coprime to .
The success can be certified with two classical function evaluations. Compute and . Since and , periodicity and injectivity within a period imply
Report only when this equality holds; otherwise report failure. The success probability is
using the standard lower bound for the Euler totient function. This is heralded exact quantum period finding when the period divides the register size.
An arithmetic function is multiplicative if whenever and are coprime integers. If and , every positive integer divisor of is uniquely with and . Hence
so is multiplicative.
The Möbius function is defined by , if the square of a prime number divides , and if is a product of distinct prime numbers. Coprime integers have disjoint sets of prime factors, so this definition immediately gives when .
For , only the square-free divisors contribute, and therefore
For the sum is . Thus in the language of Dirichlet convolution. Convolving with gives the Möbius inversion formula
If , its divisor sum is the sum-of-divisors function. Conversely, if , Möbius inversion gives
using the standard divisor identity for the Euler totient function. Therefore the two requested answers are
The prime-factor formula for the Euler totient function is
Let
The factors with contribute at most
by the Mertens third theorem. For , the number of distinct prime divisors of is at most , and hence
Thus the large-prime product is , and
Taking reciprocals gives, uniformly as ,
Let be a splitting field of over . Its formal derivative is
The assumption on the characteristic of says that in . Any root of is nonzero, and hence . Thus and have no common root, so is a separable polynomial. Since it has degree and splits over , it has exactly distinct roots. This is the separability of roots of unity.
Fix a primitive root of unity . Define the th cyclotomic polynomial by
It is monic and has degree given by the Euler totient function . Partitioning all th roots of unity according to their exact multiplicative order gives the cyclotomic factorization
We now prove by mathematical induction that . The base case is . If the result holds for every proper divisor of , then
is monic and belongs to . Polynomial division of by the monic integer polynomial produces a quotient and remainder in . The factorization over says that the remainder is zero and the quotient is , proving the claim.
It remains to prove irreducibility of cyclotomic polynomials. Let be a monic irreducible polynomial dividing , let be a root of , and write . We claim that is a root of for every prime number . Otherwise is a root of , so is a root of . Since is the minimal polynomial of over , Gauss lemma for polynomials gives
After reduction of an integer polynomial modulo a prime, the Frobenius endomorphism gives
Choose an irreducible factor of the nonconstant monic polynomial . Then , so . The cyclotomic factorization would then make divide over . This is impossible because its derivative is coprime to it when .
Thus for every prime . Iterating this fact over a prime factorization shows that whenever . These are all primitive th roots, so
Because divides , equality holds and . Hence every cyclotomic polynomial is irreducible over .
Finally, direct multiplication gives
Also
Applying the cyclotomic factorization to the two factors on the right gives
and therefore
Since , cancellation yields
The thirtieth cyclotomic polynomial is irreducible over by the theorem just proved, so is irreducible.
The Euler totient function is the number of residue classes modulo that are coprime to . The Chinese remainder theorem says that for pairwise coprime moduli , reduction induces a bijection
It restricts to a bijection of unit groups. If is squarefree, then
Each of the primes is one more than a power of two, so every squarefree product of them has power-of-two totient. Ten odd examples are
If and are coprime, every divisor of is uniquely with and . Hence, for a multiplicative arithmetic function ,
The Möbius function is if a prime square divides , and if is a product of distinct primes. The Euler totient function counts residues modulo coprime to . From the prime factorizations,
Both sides of the second identity are multiplicative, and at a prime power ,
Therefore
Start two registers in . Apply to the first and then reversibly evaluate into the second, obtaining
The evaluation can be implemented by repeated squaring and reversible modular multiplication using a number of elementary arithmetic operations polynomial in .
Measure the second register. Because is injective within one period and , the first register becomes a uniformly weighted periodic coset
The quantum Fourier transform of a periodic coset state followed by measurement returns
Reduce the rational number to lowest terms. Since
its denominator is . Test whether by repeated squaring. The promised injectivity means that is the least positive period, and , so this congruence holds exactly when . The test therefore certifies whether the run succeeded; this is heralded exact quantum period finding when the period divides the register size.
One run succeeds with probability
because success is equivalent to being coprime to . A standard estimate for the Euler totient function gives for all sufficiently large , with the finitely many smaller cases absorbed by changing the positive constant . Repeating independently times therefore makes the probability that every run fails at most . Every step, including the repetitions and the classical verification, takes time polynomial in .
Reduced residue system Created 2026-10-05 Updated 2026-10-07
For a positive modulus , a reduced residue system contains exactly one representative of each residue class coprime to . Its size is the Euler totient function . Multiplication by any unit modulo n permutes these classes, which proves the Fermat-Euler theorem after multiplying and cancelling their unit product.
For , this explicit lower bound on the Euler totient function implies as . Here is the Euler--Mascheroni constant. The prime-product formula also gives whenever , making the bound useful for certified quantum period finding. The relevant statement is a lower bound: the claimed universal upper estimate would fail at primes. Equations (3.41)–(3.42) of Theorem 15 provide the primary bound: denisevellachemla.eu/Rosser-Schoenfeld-1962.pdf .
Semiprime 2026-10-06
A semiprime is a composite number that is a product of exactly two prime numbers, counted with multiplicity. For example, and are semiprimes. Distinct factors give for the Euler totient function, whereas equal factors give . This distinction matters when constructing a uniform coprime state for a semiprime.