BMO2 2016 Number Theory Problem
First assume that $p>2$ (because when $p=2$ the equation $u^2+v^2=8$ is easily solved).
Now use the following trick to form $2p-u-v$ :
$$4p^2=2\cdot 2p^2=2(u^2+v^2)=(u+v)^2+(u-v)^2$$
and use the difference of squares :
$$(2p-u-v)(2p+u+v)=(u-v)^2 $$
Let $q$ be a prime factor of both $2p-u-v$ and $2p+u+v$ so :
$$q \mid (2p-u-v)+(2p+u+v)=4p$$ $$q \mid (2p+u+v)-(2p-u-v)=2(u+v)$$
Now let's consider two cases :
- If $q$ is odd then $q \mid p$ but because $p$ is prime it follows that $q=p$ and then $p \mid u+v$ .
But then :
$$p \mid (u+v)^2-(u^2+v^2)=2uv$$ $$p \mid uv$$
If for example $p \mid u$ then also $p \mid v$ because $p \mid u+v$ .Thus both $u$ and $v$ are divisible with $p$ and so :
$$2p^2=u^2+v^2 \geq p^2+p^2=2p^2$$
Thus we must have $u=v=p$ and $2p-u-v=0$ is a perfect square .
- If none of the common prime factors $q$ is odd then their gcd must be a power of two , some $2^k$
Using the identity :
$$(2p-u-v)(2p+u+v)=(u-v)^2 $$
it follows that $2p-u-v=2^kx^2$ and $2p+u+v=2^ky^2$ for some $x$ and $y$ .
Thus if $k$ is even then $2p-u-v$ is a perfect square and if it's odd it's twice a perfect square which proves the claim .
Hint: One way to get squares from the given $2p-u-v$ is to multiply it by a conjugate, $2p+u+v$. Simplify what you get using the fact that $2p^2 = u^2+v^2$, and look at the factorization of the result. Then consider the possible values for $2p-u-v$ given that factorization.
Note that $2p^2=u^2+v^2$, or $(p-u)(p+u)=(v-p)(v+p)$. WLOG, suppose $u<p<v$.
From the above equation, we have: $$2p-u-v=(p-u)+(p-v)=\frac{(v-p)(v-u)}{p+u}$$ Now, we do following analysis:
If $q$ is odd prime, and $q^a|(v-p)$ then $q^a\not|(v+p)$ since $p$ is prime, and $p\not|v$.
So, $q^a|(p-u)(p+u)$, and only one of $(p-u)$ and $(p+u)$ is divisible by $q^a$.
If $q^a|(p-u)$, then $q^a|(v-p+p-u)$, i.e $q^a|(v-p)$, and so $$q^{2a}|\frac{(v-p)(v-u)}{p+u}.$$
If $q^a|(p+u)$, then $$q\not|\frac{(v-p)(v-u)}{p+u}.$$ since factorization of numerator and denominator will cancel all $q$'s.
The above is true for all odd primes, so$$2p-u-v=\frac{(v-p)(v-u)}{p+u}=n^2,$$ or $$2p-u-v=\frac{(v-p)(v-u)}{p+u}=2n^2.$$