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

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

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

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

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

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

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