Given $m\in\mathbb{N}$ and a prime number $p$, $p>m$, let \[M=\{n\in\mathbb{N}\mid m^2+n^2+p^2-2mn-2mp-2np \,\,\, \text{is a perfect square} \} \] Prove that $|M|$ does not depend on $p$. Proposed by Aleksandar Ivanov
Problem
Source: Bulgarian NMO 2013, p6
Tags: number theory, Diophantine equation, number theory proposed
25.07.2014 03:43
The cardinality of $M$ is the number of solutions with $n>0$ of the Diophantine equation $(1) \;\; n^2 - 2(m+p)n + (m-p)^2 = u^2$, i.e. $(2) \;\; (n - m - p)^2 = u^2 - 4mp$. Hence $u^2 - 4mp = v^2$ for a non-negative integer $v<u$. Thus $(3) \;\; (u - v)(u + v) = 4mp$. Consequently $p|u \pm v$. Let us consider these two cases: Case 1: $p|u - v$. Then $u-v = kp$ for a positive integer $k$. Hence by (3) and the fact that $m<p$ we obtain $k^2p \leq k(kp + 2v) = 4m < 4p$, i.e. $k^2 < 4$. Therefore $k=1$, yielding $p + 2v = 4m$, implying $p$ is even. Thus $p=2$ and $m=1$ (since $m<p$), which means $2v = 4m-p = 4 \cdot 1- 2 = 2$, i.e. $v=1$ and $u = v + kp = 1 + 1 \cdot 2 = 3$. Thus $n = m + p \pm v = 1 + 2 \pm 1 = 3 \pm 1$. So $|M|=2$ in this case. Observe that the cardinality of $M$ is independent of $p$ since both $k$ and $m$ are determined by applying the condition $m<p$ while $p$ is determined by the equation $p + 2v= 4m$which implies $p$ is even. Case 2: $p|u + v$. Then $u+v = kp$ for a positive integer $k$. Hence by (3) $(4) \:\: k(kp - 2v) = 4m$. Assume $k$ is odd. Then $2|k^2p$ by (4), implying $2|p$ since $k$ is odd. Therefore $p=2$ and $m=1$, which inserted in (4) result in $k(k - v) = 2$. Thus $k|2$, which give us $k=1$ (since $k$ is odd) and $1 - v = 2$, i.e. $v=-1$, contradicting $v \geq 0$. Hence $k$ is even, i.e. $k=2t$, where $t$ is a positive integer, which inserted in (4) result in $t(tp-v)=m$. Therefore $vt = pt^2 - m \geq p - m > 0$, implying $v>0$ since $t>0$. In other words ${\textstyle pt - \frac{m}{t}=v}$ is a positive integer iff $t|m$. The integer solution of (2) are $(5) \;\;{\textstyle n = m + p \pm v = m + p \pm pt -\mp \frac{m}{t}}$. This obviously means $|M|$ only depends on the number of positive divisors of $m$. So $|M|$ does not dependent on $p$. q.e.d. Comment: In case (2) (i.e. when $p>2$) we can calculate $|M|$ in the following way: Assume $n = m + p - v$ is a positive solution of (2). Consequently ${\textstyle m + p > v = pt -\frac{m}{t}}$, i.e. $mt + pt < pt^2 - m$, implying $m(t+1) > pt(t-1) > mt(t-1)$. Thus $t + 1 > t(t-1)$, i.e. $t(t-2) < 1$, yielding $t \leq 2$. If $t=1$, then $m + p - v = m + p - (p - m) = 2m > 0$, which means $t=1$ result in two solutions of (2) for which $n>0$. If $t=2$, then ${\textstyle m + p - v = m + p - (2p - \frac{m}{2}) = \frac{3m}{2} - p}$, which means $t=2$ result in two solutions of (2) for which $n>0$ iff $m$ is even and ${\textstyle p< \frac{3m}{2}}$. Summa summarum: $|M|=2$ when $p=2$. For $p > 2$ we have $|M| = \tau(m)+2$ if $m$ is even and ${\textstyle p< \frac{3m}{2}}$ and $|M| = \tau(m)+1$ otherwise.