how to find co-prime numbers

1.7k Views Asked by At

Suppose $p$ and $q$ are two prime numbers. How can one quickly calculate how many numbers $x$ there are such that $\gcd(x, (q-1)\cdot(p-1)) = 1$, without using brute force?

1

There are 1 best solutions below

1
On

The answer is $\phi((q-1)(p-1))$, but to compute that you probably need to factor $p-1$ and $q-1$.