Report

Help us improve this tool

Euler Totient Function Calculator

Compute Euler totient function phi(n) with prime factorization steps, coprime counts, and RSA cryptography insights. Use our free Euler Totient Function

O M T

What Is Euler's Totient Function?

Euler's totient function $\varphi(n)$ counts how many integers from 1 to $n$ are coprime to $n$. Two integers are coprime when their greatest common divisor is 1.

Product Formula

If $n = p_1^{a_1} p_2^{a_2} \cdots p_k^{a_k}$, then:

$$\varphi(n) = n \prod_{p \mid n}\left(1 - \frac{1}{p}\right)$$

Key Properties

  • For prime $p$: $\varphi(p) = p - 1$
  • For prime power $p^k$: $\varphi(p^k) = p^k - p^{k-1}$
  • If $\gcd(m,n)=1$, then $\varphi(mn)=\varphi(m)\varphi(n)$
  • Euler's theorem: $a^{\varphi(n)} \equiv 1 \pmod{n}$ when $\gcd(a,n)=1$

The totient function is central to RSA cryptography because private-key operations rely on $\varphi(n)$ for semiprime moduli. Related tools: use the Prime Factors Calculator and GCF Calculator.

Frequently Asked Questions

What is phi(12)?

$\varphi(12)=4$ because 1, 5, 7, and 11 are the integers between 1 and 12 that share no common factor with 12 other than 1.

Why is phi important in RSA?

RSA key generation uses $\varphi(n)$ for $n=pq$. The private exponent $d$ is chosen so $ed \equiv 1 \pmod{\varphi(n)}$, which enables decryption.

Does exponent matter in the product formula?

No. Only distinct prime factors matter. For example, $\varphi(8)=\varphi(2^3)=8(1-\frac{1}{2})=4$.

What is phi(1)?

By convention, $\varphi(1)=1$ because 1 is coprime to itself.