Euler's totient function calculator φ(n)
Euler's totient counts the numbers up to n that share no factor above 1 with n. It is used in Euler's theorem and RSA encryption.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter number n.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
φ(n) = n × Π (1 - 1/p) over every prime p dividing n. For example φ(36) = 36 × (1 - 1/2) × (1 - 1/3) = 12.
Example
Inputs: Number n = 36. Result: φ(n): 12; Share of numbers coprime to n: 33.3333%.
Limits and caveats
- Accepts whole numbers from 1 to 10^15.
- By definition φ(1) = 1.
Questions about this tool
What is φ of a prime?
For a prime p, φ(p) = p - 1, since every number from 1 to p - 1 is coprime to it. For example φ(97) = 96.
What is Euler's theorem?
If a and n are coprime, then a^φ(n) mod n = 1. It generalizes Fermat's little theorem.
How is it used in RSA?
For n = p × q, φ(n) = (p - 1)(q - 1), which is used to derive the private key. For 3233 = 53 × 61, φ = 3120.
