Determine all quadruples $(p, q, r, n)$ of prime numbers $p, q, r$ and positive integers $n$ for which

$$
p^{2}=q^{2}+r^{n}
$$

is satisfied.

(Walther Janous)

Answer. There are two such quadruples $(p, q, r, n)$, namely $(3,2,5,1)$ and $(5,3,2,4)$.
After rearranging the equation and factoring the obtained difference $p^{2}-q^{2}$, we have

$$
(p-q)(p+q)=r^{n}
$$

to consider, and for this, we distinguish two cases.

- Case 1. $p-q=1$, so $p=3$ and $q=2$. This gives $r^{n}=5$, thus $r=5$ and $n=1$, and the solution quadruple $(p, q, r, n)=(3,2,5,1)$.
- Case 2. $p-q>1$. Since $p+q>p-q$, $n \geq 2$ must hold, and $r \mid p-q$ and $r \mid p+q$ must be true. This implies $r \mid p-q+p+q=2 p$ and $r \mid p+q-p+q=2 q$.

Assume $r \neq 2$. Then $r=p$ and $r=q$ would have to hold, and consequently $r^{n}=0$.

Therefore, let $r=2$ from now on. Then we must have

$$
p-q=2^{a} \text{ and } p+q=2^{b} \text{ with } a+b=n \text{ and } 1 \leq a<b
$$

and thus $p-q+p+q=2 p=2^{a}+2^{b}$, i.e., $p=2^{a-1}\left(2^{b-a}+1\right)$.

Since $2^{b-a}+1 \geq 2^{1}+1=3$, it follows that $a=1$, so $p=2^{b-1}+1$ and $p-q=2$ with $q=2^{b-1}-1$. Consequently, $q=2^{b-1}-1, 2^{b-1}$, and $p=2^{b-1}+1$ are three consecutive integers, one of which must be divisible by 3. Since $p$ and $q$ are primes and the number between them is a power of 2, we get $q=3$ and $p=5$. (The alternative $p=3$ would imply $q=1$.) This immediately gives $b=3$ and $n=4$, and we have thus determined the second solution quadruple $(p, q, r, n)=(5,3,2,4)$.

(Walther Janous)