# Thread: find all prime numbers

1. ## find all prime numbers

find all prime numbers p,q,r such that (p/q )- (4/(r+1))=1

2. Originally Posted by nh149
find all prime numbers p,q,r such that (p/q )- (4/(r+1))=1
Hi!

We first rewrite the equality $\displaystyle \frac{p}{q}-\frac{4}{r+1}=1$ equivalently as $\displaystyle (p-q)(r+1)=4q$.
If $\displaystyle r=2$, we get $\displaystyle 3p=7q$, which forces $\displaystyle q=3$ and $\displaystyle p=7$, so we've found one triplet.
So suppose from now on that $\displaystyle r$ is an odd prime.
If $\displaystyle q=2$ we have $\displaystyle (p-2)(r+1)=8$. We can't have $\displaystyle r=3$ because it implies $\displaystyle p=4$. Forced is $\displaystyle r=7$ and $\displaystyle p=3$, which gives us another triplet.
So suppose from now on that $\displaystyle q$ is an odd prime.
From $\displaystyle (p-q)(r+1)=4q$ we see that $\displaystyle p$ is an odd prime.

We now know $\displaystyle 2|(p-q)$, $\displaystyle 2|(r+1)$ so we can rewrite $\displaystyle (p-q)(r+1)=4q$ as $\displaystyle \frac{p-q}{2}\cdot \frac{r+1}{2}=q$.

We cannot have $\displaystyle \frac{r+1}{2}=1$ (else $\displaystyle r$ wouldn't be a prime) so we must have $\displaystyle \frac{r+1}{2}=q$ and $\displaystyle \frac{p-q}{2}=1$.

In other words, $\displaystyle p-q=2$ and $\displaystyle r=2q-1$.

Let $\displaystyle q \equiv l \mod{3}$ for some $\displaystyle l\in \{0,1,2\}$. Then $\displaystyle p \equiv l+2 \mod{3}$ and $\displaystyle r \equiv 2l-1 \mod{3}$.

If $\displaystyle l=0$, we have $\displaystyle q=3$, $\displaystyle p=5$ and $\displaystyle r=5$, so we've found another triplet.
If $\displaystyle l=1$, then $\displaystyle p=3$ which implies $\displaystyle q=1$. So we cannot have $\displaystyle l=1$.
If $\displaystyle l=2$, then $\displaystyle r=3$ which implies $\displaystyle q=2$, which we excluded, so we cannot have $\displaystyle l=2$.

We conclude that the only triplets are 7,3,2 and 3,2,7 and 5,3,5.