Calcoid

Euler's Totient Calculator

Compute Euler's totient phi(n), the count of integers from 1 to n coprime to n, from its prime factorization. Shows Euler's product and coprime density.

Euler's Totient phi(n)

Enter an integer from 1 to 1,000,000,000,000.

Euler's totient

φ(36) = 12

12 of the integers from 1 to 36 are coprime to 36.

Coprime count phi(n)

12

Not coprime (n - phi)

24

Coprime density phi(n)/n

33.3%

Prime factorization of 36

22*32

Euler's product

φ(36) = 36 * (1 - 1/2) * (1 - 1/3) = 12

Each distinct prime factor p contributes a factor of (1 - 1/p).

Frequently Asked Questions about the Euler's Totient Calculator

What is Euler's totient function phi(n)?
Euler's totient function phi(n), also written as the Greek letter phi of n, counts how many integers from 1 to n share no common factor with n other than 1 (the integers coprime to n). For example, phi(10) is 4 because only 1, 3, 7, and 9 are coprime to 10. By convention phi(1) equals 1. It is one of the most important functions in number theory.
How do you calculate the totient from the prime factorization?
Write n as a product of prime powers, n = p1^a1 times p2^a2 and so on. Then Euler's product gives phi(n) = n times the product over each distinct prime p of (1 - 1/p). An equivalent integer form is the product of p^(a-1) times (p - 1) over the distinct primes. This calculator factors n first, then applies the integer form, so the result stays exact.
Can you show a worked example for phi(36)?
Take n = 36, which factors as 2^2 times 3^2, so the distinct primes are 2 and 3. Euler's product gives phi(36) = 36 times (1 - 1/2) times (1 - 1/3) = 36 times 1/2 times 2/3 = 12. So 12 of the integers from 1 to 36 are coprime to 36, and the coprime density phi(n)/n is 12/36, or about 33 percent.
Why does phi(p) equal p minus 1 for a prime p?
When p is prime, its only divisors are 1 and p itself, so every integer from 1 up to p - 1 shares no factor with p other than 1. That makes all p - 1 of them coprime to p, giving phi(p) = p - 1. This calculator flags when your input is prime and confirms that phi(n) equals n - 1 in that case.
What does coprime mean, and is phi multiplicative?
Two integers are coprime (relatively prime) when their greatest common divisor is 1, meaning they share no prime factor. Euler's totient is multiplicative for coprime arguments: if gcd(m, n) is 1, then phi(m times n) equals phi(m) times phi(n). That property is exactly why the totient can be built up from the prime-power factors of n.
Where is Euler's totient used in practice?
The totient underpins Euler's theorem, which states that a raised to the power phi(n) is congruent to 1 modulo n whenever a and n are coprime. That result is the foundation of RSA public-key cryptography, where phi of the modulus determines the decryption exponent. The totient also appears in modular arithmetic, the order of the group of units modulo n, and cyclic-group theory.

Related Calculators

More calculators in "Math"

See all 202 calculators in "Math"