Any way of computing the number of co-prime numbers to $n$

65 Views Asked by At

For a certain problem, I need to compute $$|\phi(n)|=|\{x\in\mathbb{N} : 0<x<n, gcd(x,n)=1\}|.$$ Is there any "formula" that works for any natural number $n$? Or is it just impossible. Any help will be appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

The Euler Totient function:

$$\phi(n) = n \prod_{p | n} \bigg( 1 - {1 \over p} \bigg)$$

counts the positive integers up to a given integer $n$ that are relatively prime to $n$