# Tag Info

The Euler phi function $\phi(n)$ is defined to be the number of integers between $1$ and $n$ which are relatively prime to $n$; that is,

$$\phi(n) = |\{1 \le k < n : \gcd{(k, n)} = 1\}|$$

The phi function is multiplicative; that is, if $n$ and $m$ are relatively prime, then

$$\phi(nm) = \phi(n) \phi(m)$$

There is also a product representation,

$$\phi(n) = n \prod_{p|n} \left(1 - \frac{1}{p}\right)$$

where the product is taken over prime divisors of $n$.

One particularly important use of Euler's phi function is in computing exponents with modular arithmetic. Whenever $a$ and $n$ are relatively prime, Euler's theorem states that

$$a^{\phi(n)} \equiv 1 \pmod{n}$$