Prime number: φ(13)
Since 13 is prime, its only prime divisor is 13:
φ(13) = 13 − 13/13 = 12
Every integer from 1 through 12 is coprime to 13.
Digits may include commas, spaces, or underscores as grouping separators. Decimals, zero, and negative integers are not accepted.
Try 36 to see φ(36) = 12 and the steps using the distinct primes 2 and 3.
Euler’s totient function, written φ(n) and sometimes called Euler’s phi function, counts the positive integers from 1 through n that are relatively prime to n. Two numbers are relatively prime, or coprime, when their greatest common divisor is 1.
Euler product formula: φ(n) = n ∏p | n (1 − 1/p)
The product uses each distinct prime divisor p of n exactly once. This calculator evaluates the equivalent integer update result = result − result / p, so no floating-point rounding is introduced.
For example, 36 = 22 × 32. Its distinct prime divisors are 2 and 3, so φ(36) = 36(1 − 1/2)(1 − 1/3) = 12.
Since 13 is prime, its only prime divisor is 13:
φ(13) = 13 − 13/13 = 12
Every integer from 1 through 12 is coprime to 13.
Because 32 = 25, use the distinct prime 2 once:
φ(32) = 32 − 32/2 = 16
More generally, φ(pk) = pk − pk−1.
Since 15 = 3 × 5:
φ(15) = 15(1 − 1/3)(1 − 1/5) = 8
The coprimes are 1, 2, 4, 7, 8, 11, 13, and 14.
Since 360 = 23 × 32 × 5:
φ(360) = 360 × 1/2 × 2/3 × 4/5 = 96
Only the distinct primes 2, 3, and 5 affect the product.
| n | Prime factorization | φ(n) | Reason |
|---|---|---|---|
| 1 | Empty product | 1 | Standard convention |
| 8 | 23 | 4 | 8 − 8/2 |
| 9 | 32 | 6 | 9 − 9/3 |
| 10 | 2 × 5 | 4 | 10 × 1/2 × 4/5 |
| 12 | 22 × 3 | 4 | 12 × 1/2 × 2/3 |
| 100 | 22 × 52 | 40 | 100 × 1/2 × 4/5 |
φ(n) counts the positive integers from 1 through n whose GCD with n is 1. These integers are often called totatives of n.
Each product factor (1 − 1/p) removes integers divisible by one prime p. Reusing the same prime would remove its multiples twice. Exponents matter when reconstructing n, but the Euler product runs over distinct primes.
By standard convention, φ(1) = 1. This makes the totient function multiplicative and corresponds to counting 1 as relatively prime to itself.
φ(p) = p − 1. A prime has no positive divisors other than 1 and itself, so every positive integer less than p is coprime to it.
φ(n) is even for every integer n greater than 2. Coprimes can be paired as a and n − a; there are no unpaired members when n > 2.
The accepted range is 1 through 1 trillion. The calculator uses optimized trial division and exact BigInt arithmetic. The limit keeps difficult primes and semiprimes from making the page unresponsive.
Yes. Factoring and arithmetic happen entirely in your browser. This calculator does not upload, save, or add your number to a URL.