Why is the totient function expressed as $\phi(n)=n \prod_{p|n}\left ( 1-\frac{1}{p} \right )$

69 Views Asked by At

This seems a little inconvenient, and using

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

seems much more convenient for computational purposes.

So I am guessing that there is a specific reason for expressing it as such. What is that reason?

1

There are 1 best solutions below

0
On BEST ANSWER

The formula

$$\phi(n) = \prod_{p \mid n} (p-1)$$

is correct for squarefree $n$, but incorrect otherwise. Generally correct is

$$\phi(n) = \prod_{p \mid n} (p-1)\cdot p^{v_p(n) - 1},$$

where $v_p(n)$ is the exponent of $p$ in the prime factorisation of $n$. But in comparison to that,

$$\phi(n) = n \prod_{p \mid n} \bigl(1 - \tfrac{1}{p}\bigr)$$

is more convenient.