Euler Phi Function of Integer

Theorem
Let $$n \in \mathbb{Z}^*_+$$, that is, a positive integer.

The totient, indicator or Euler $$\phi$$-function is the function $$\phi: \mathbb{Z}^*_+ \to \mathbb{Z}^*_+$$ defined as:

$$\phi \left({n}\right) = $$ the number of integers less than or equal to $$n$$ which are prime to $$n$$.

That is, $$\phi \left({n}\right) = \left|{S_n}\right|: S_n = \left\{{k: 1 \le k \le n, k \perp n}\right\}$$.

It follows from the definition of $\mathbb{Z}'_n$ that $$\phi \left({n}\right)$$ is the number of elements in $$\mathbb{Z}'_n$$.

For any $$n \in \mathbb{Z}^*_+$$, we have:

$$\phi \left({n}\right) = n \left({1 - \frac 1 {p_1}}\right) \left({1 - \frac 1 {p_2}}\right) \ldots \left({1 - \frac 1 {p_r}}\right)$$

where $$p_1, p_2, \ldots, p_r$$ are the distinct primes dividing $$n$$.

Proof
We express $$n$$ in its Prime Decomposition:

$$n = p_1^{k_1} p_2^{k_2} \ldots p_r^{k_r}, p_1 < p_2 < \ldots < p_r$$

as we determined it was always possible to do.

As all primes are, by definition, coprime, then from Euler Phi Function is Multiplicative we have:

$$\phi \left({n}\right) = \left({p_1^{k_1}}\right) \left({p_2^{k_2}}\right) \cdots \left({p_r^{k_r}}\right)$$

and from Euler Phi Function of a Prime, we have $$\phi \left({p_s^{k_s}}\right) = p_s^{k_s} = \left({1 - \frac 1 {p_s}}\right)$$

So $$\phi \left({n}\right) = p_1^{k_1} \left({1 - \frac 1 {p_1}}\right) p_2^{k_2} \left({1 - \frac 1 {p_2}}\right) \cdots p_r^{k_r} \left({1 - \frac 1 {p_r}}\right)$$

and the result follows directly from $$n = p_1^{k_1} p_2^{k_2} \ldots p_r^{k_r}$$.