Euler's Totient Calculator
Compute φ(n) exactly for n up to one trillion, with the factorisation that produced it printed beside the answer.
Euler's Totient Calculator
Compute φ(n) exactly for n up to one trillion, with the factorisation that produced it printed beside the answer.
What the page prints, and what it refuses
Every figure is printed with the rule or formula that produced it, and any numerical tolerance is stated on the result rather than implied. The page refuses an input the formula does not define and names the value it read; it prints no answer it cannot support.
The calculation runs entirely in this browser tab; nothing is uploaded.
Euler's totient counts the whole numbers from 1 to n that share no factor with n. For 360 the answer is 96, and the factorisation 2³ × 3² × 5 is printed so the count can be checked term by term.
The page computes φ(n) = n × ∏(1 − 1/p) from that factorisation, exactly: φ(2²⁰) is 524288, not a rounded approximation. The ratio φ(n)/n is printed separately as a decimal.
Why the factorisation is the whole answer
For a prime power p^e, exactly 1/p of the numbers below it are divisible by p, so φ(p^e) = p^e − p^(e−1). The totient is multiplicative across coprime factors, so multiplying those terms over the distinct primes gives φ(n).
The page factorises by trial division up to the square root, which is instant at the one-trillion ceiling. The ceiling is a property of that factoriser, and the page names it rather than failing halfway.
How to use Euler's Totient Calculator
Enter one whole number from 1 to 1,000,000,000,000, then press Run.
The result prints φ(n), the factorisation, the number of distinct primes and the ratio φ(n)/n.
What to Expect
Best for
- Counting coprimes exactly
- Checking a number theory exercise
- Seeing φ(n)/n for a highly composite number
Not ideal for
- Finding the coprimes themselves, which this page does not list
- n above one trillion
- A value with more than twelve digits that is not a safe integer
What this tool keeps
- n exactly as entered
What may need cleanup
- Nothing: φ(n) is a final integer
Common errors
- n below 1 is refused
- A value above one trillion is refused with the ceiling named
Example use cases
- Compute φ(360)
- Check that φ(p) = p − 1 for a prime
- Compare φ(n)/n for 30 and 210
Sample input
n = 360
Sample output
φ(360) = 96, from 360 = 2^3 × 3^2 × 5
Who this is for
- Number theory students
- Readers checking a totient by hand
Frequently asked questions
Why is φ(360) equal to 96?
The distinct primes are 2, 3 and 5, so φ(360) = 360 × (1/2) × (2/3) × (4/5), which is 96. The factorisation line shows where each fraction comes from.
Is 1 counted as coprime with n?
Yes. 1 shares no prime factor with any n, and the definition counts it. That is why φ(1) = 1.
Why the one-trillion ceiling?
The factoriser divides by every prime up to the square root, which is a million steps at the ceiling. Beyond it the wait would grow without warning, so the page refuses with the limit named.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.