Problem

Source: 2017 Swedish Mathematical Competition p2

Tags: number theory, Diophantine equation, diophantine



Let $p$ be a prime number. Find all pairs of coprime positive integers $(m,n)$ such that $$ \frac{p+m}{p+n}=\frac{m}{n}+\frac{1}{p^2}.$$