Find primes that satisfy conditions

140 Views Asked by At

The problem is as follows: Find all primes $p$ and $q$ such that $p-q$ and $pq-q$ are both perfect squares.

I found the solution $(3,2)$ by considering when $q$ is even. I then considered when both $p$ and $q$ are odd. The farthest I got was that $q \equiv 1 \pmod 4$, but I'm unsure how to continue.

Any thoughts?

1

There are 1 best solutions below

0
On

For some integers $r \ge 0$ and $s \ge 1$,

$$p - q = r^2 \tag{1}\label{eq1A}$$

$$pq - q = s^2 \tag{2}\label{eq2A}$$

Next, \eqref{eq2A} minus \eqref{eq1A} gives

$$pq - p = s^2 - r^2 \; \; \to \; \; p(q - 1) = (s - r)(s + r) \tag{3}\label{eq3A}$$

Since $p$ is prime, then $p \mid s - r$ or $p \mid s + r$. From \eqref{eq1A} and \eqref{eq2A}, we have $s \gt r \; \to \; s - r \gt 0$. Also, \eqref{eq1A} gives $q \le p$, so using \eqref{eq2A} note that $pq - q \lt p^2 \; \to \; s \lt p$. Thus, $0 \lt s - r \lt p \; \to \; p \nmid s - r$, which means $p \mid s + r$. Since $r \lt s \lt p$, then

$$s + r \lt 2p \; \; \to \; \; s + r = p \; \; \to \; \; s - r = p - 2r \tag{4}\label{eq4A}$$

Substituting this into the RHS of \eqref{eq3A} gives

$$\begin{equation}\begin{aligned} p(q - 1) & = (p - 2r)(p) \\ q - 1 & = p - 2r \\ p - q & = 2r - 1 \end{aligned}\end{equation}\tag{5}\label{eq5A}$$

Next, substituting this into \eqref{eq1A} gives

$$2r - 1 = r^2 \; \to \; r^2 - 2r + 1 = 0 \; \to \; (r - 1)^2 = 0 \; \to \; r = 1 \tag{6}\label{eq6A}$$

From \eqref{eq1A} with $r^2 = 1$, the only primes having a difference of $1$ are $p = 3$ and $q = 2$ (and using these values in \eqref{eq2A} gives $s = 2$).