3
$\begingroup$

I am stuck on a problem where I am given the value of $\phi(n)=31615577098574867424$ for $n=pq=31615577110997599711$ where $p$ and $q$ are prime numbers. Now, I need to find the values of $p$ and $q$ but I am not able to get an idea as to how I can solve it. I know that $\phi(n)$ gives the number of relative prime to a given number $n$ but I can use Euler-totient function to factorize $n$?

  • 0
    $\phi(n) =n$, typo?2017-01-07
  • 1
    here, $\phi(n) = (p-1)(q-1) = n + 1 -(p+q).$ So, you know both $pq$ and $p+q.$ That's enough2017-01-07
  • 0
    Why is it so? Is there a number or a range defined beyond which it may not work?2017-01-07
  • 1
    @AlexM. I think it is generally true that if you are given $n$, told that it is the product of two primes, and are also given $\varphi(n)$ that you can then factor $n$ without much fuss. Simple arithmetic and the extraction of a single square root...all operations that can be done with very large numbers. Of course, there is no sensible way to compute $\varphi (n)$ for gigantic numbers, but here you are handed it.2017-01-07
  • 0
    @AlexM. I have some of those neurons too. More than i used to.2017-01-07

3 Answers 3

5

When $\phi(n)$ is given when $n=pq$ where $p$ and $q$ are prime numbers, then we have

$\phi(n)=(p-1)(q-1)=pq-(p+q)+1$

But $pq=n$, therefore , $\phi(n)=n-(p+q)+1$ and $p+q=n+1-\phi(n)$.

Now, $p$ and $q$ are the roots of the equation, $x^2-(p+q)x+pq=(x-p)(x-q)$.

Substituting for $p+q$,

$x^2-(n+1-\phi(n))x+n$

$=x^2-(31615577110997599711+1-31615577098574867424)x+31615577110997599711$

$=(x-3572144239)(x-8850588049)$

Therefore, $31615577110997599711=3572144239.8850588049$

2

Note that if $n = pq$, with $p \ne q$ prime, we have $$ \phi(n) = (p-1)(q-1) = n - p - q + 1 = (n+1)-(p+q)$$ so you know $n = pq$ and $p+q = n+1 - \phi(n)$. If this doesn't give you primes $p$ and $q$, you need to consider the case $p = q$, that is $n = p^2$. Here we have $$ \phi(n) = p(p-1) = n - p $$ so in that case $p = q = n -\phi(n)$.

  • 0
    If $n=p^2$ then there are simpler ways of recovering $p$ not using $\phi(n)$...2017-01-07
1

Since $\phi(n) = n + 1 - (p+q)$ as mentioned by Will Jagy in the comments, consider the polynomial $$(x-p)(x-q) = x^2 - (p+q)x + pq = x^2 - (n + 1 - \phi(n)) x + n.$$ As you know the coefficients of the polynomial on the right hand side, can you use this to find $p,q$?