Compute Euler's totient function $\phi(n)$

Euler's totient function counts the positive integers up to a given integer $n$ that are relatively prime to $n$.

We have : $$\phi(n) = n \prod_{\substack{p | n \\ \text{p prime}}} \left( 1 - \dfrac{1}{p} \right)$$

We have : $$\phi(n) = n \prod_{\substack{p | n \\ \text{p prime}}} \left( 1 - \dfrac{1}{p} \right)$$

Share page