Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
4  
The number is infinite; presumably you mean how many positive numbers strictly smaller than some bound; for those smaller than $(p-1)(q-1)$ you can use Euler's totient function, provided you can factor $p-1$ and $q-1$. –  Arturo Magidin Oct 11 '10 at 2:12

1 Answer 1

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

share|improve this answer
1  
For any positive integer $n$ given $\phi(n)$ the factorization of $n$ can be found in probabilistic polynomial time or deterministically under the Extended Riemann Hypothesis. See for example rjlipton.wordpress.com/2011/12/10/a-lemma-on-factoring for the main idea. –  David Marquis Mar 26 '13 at 1:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.