Euler Totient Calculator
Compute Euler's totient φ(n) — the count of integers up to n that are coprime to n.
About Euler Totient Calculator
Euler's totient function φ(n) counts the integers from 1 to n that are coprime to n (share no common factor other than 1). It is computed efficiently via the product formula: φ(n) = n × ∏(1 − 1/p) over all distinct prime factors p of n. For a prime p, φ(p) = p − 1. The totient is fundamental in RSA cryptography, where it determines the modular inverse of the public exponent.
Formula
Euler's product formula
φ(n) = n × ∏(1 − 1/p) for each distinct prime factor p of n
- n
- Positive integer
- p
- Distinct prime factor of n
Worked example
With the default values below, Euler Totient Calculator returns φ(n) of 4. Change any input above and every figure here is recalculated in your browser.
Inputs used
- nminimum 1
- 12
Results
- φ(n)
- 4
- Prime Factors of n
- 2, 3
- Calculation
- φ(12) = 12 × (1 − 1/2) × (1 − 1/3) = 4
Step by step
- 1Prime factors of n
- 2Product formula
- 3φ(n)= 4
Assumptions and limits
- The result is derived only from the single input listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
What is φ(1)?
φ(1) = 1 by convention — the only integer from 1 to 1 is 1 itself, and gcd(1, 1) = 1.
How is the totient used in RSA?
In RSA, the private key d is the modular inverse of the public exponent e modulo φ(n), where n = p×q for two large primes. Knowing φ(n) is equivalent to being able to factor n.
