## Task 4.

Determine all triples of natural numbers $(p, m, n)$ such that $p$ is prime, $m<n$, and there exist natural numbers $a, b, c, d$ that are not divisible by $p$ such that

$$
\begin{aligned}
& a b+c d=p^{m} \\
& a c+b d=p^{n}
\end{aligned}
$$
## Solution.

Let's add the two equations and we get

$$
a b+b d+d c+c a=(a+d)(b+c)=p^{m}\left(p^{n-m}+1\right)
$$

so $p^{m} \mid (a+d)(b+c)$. If $p$ does not divide $a+d$, then $p^{m} \mid b+c$, so $a b+c d \leqslant b+c$, which is only possible if $a=d=1$. However, then we get $b+c=p^{m}=p^{n}$, a contradiction with $m < n$. Therefore, $p$ must divide $a+d$.

If $c \geqslant 2$, then $a b+c d>2(a+d) \geqslant 2 \cdot 2^{m-1}$, a contradiction. Therefore, $c=1$.

Now we have the system of equations $b+d=2^{m}$ and $1+b d=2^{n}$. We know that $2^{m-1} \mid d+1$ and $2^{m-1} \mid b-1$, so $b+d=b-1+d+1 \geqslant 2 \cdot 2^{m-1}$ with equality only if $b-1=d+1=2^{m-1}$. Therefore, it must be that $b=2^{m-1}+1, d=2^{m-1}-1$.

By direct substitution, we get $1+b d=2^{2 m-2}$. Therefore, $n=2 m-2$.

We conclude that the set of solutions is $\{(2, m, 2 m-2) \mid m \geqslant 3\}$.