# Diophantine equation $125(m^2+n^2)=(m+n)^3$

Today I came through the following Diophantine equation in a maths contest: $$125(m^2+n^2)=(m+n)^3, m,n\in\mathbb Z_+$$ of which it asks for the sum of all possible values of $m$ in the solution set.

Obviously $m^2+n^2$ is a perfect cube, but also trivially the equation $$m^2+n^2=k^3$$ have infinite many solutions, so it does not work out with only this. Also we know that it is impossible that $m,n$ are both even, or else by counting the multiplicity of $2$ on both sides yields a contradiction. And by modulo $4$ the possibility for $m,n$ both odd is also sort out.

By a simple approximation one could also see $m,n<125$. The rest could actually verified by computer, but it is obviously not allowed in the contest. The answer to the question is $150$, but I cannot see how they got that, and for the question itself I can hardly proceed further, so I am asking for help in this community.

• What is 150 equal to; m, n, m+n,,,? – sirous Apr 18 '18 at 13:14
• @sirous It is, as the question stated, the sum of all possible values of $m$ – Igor. K Apr 18 '18 at 13:16

Hint: write your equation in the form $$125=m+3\,n+2\,{\frac {{n}^{2} \left( m-n \right) }{{m}^{2}+{n}^{2}}}$$
• Since $m,n$ are integers, must $$2n^2(m-n)$$ divisible by $m^2+n^2$ – Dr. Sonnhard Graubner Apr 18 '18 at 13:35
By his answer, we know that $$m^2+n^2\mid 2n^2(m-n)$$ Let $g:=\gcd(m,n)$, and $p=n/g,q=m/g$, so $$p^2+q^2\mid 2gp^2(p-q)$$ But we know by Euclidean algorithm that $p-q$ is coprime to $p^2+q^2$, and so does $p^2$ since $p,q$ are coprime to each other, so we know that the above would mean $$p^2+q^2\mid 2g$$ or $$m^2+n^2\mid 2g^3$$ Notice again from the equation that $$m^2+n^2=\left(\frac{m+n}{5}\right)^3$$ thus $$\left(\frac{m+n}{5}\right)^3\mid 2g^3$$ hence $(m+n)/5\mid g$ since $2$ is not a perfect cube. So we have $p+q\mid 5$, but they are both positive integers, so $p+q=5$. We have $m+n=5g$, putting back to get $$m^2+n^2=g^3\implies p^2+q^2=g$$ The simultaneous equation $$\begin{cases} p+q=5\\ p^2+q^2=g \end{cases}$$ for $p,q,g\in\mathbb Z_+$ yields all the solutions $$(p,q,g)=(1,4,17),(2,3,13),(3,2,13),(4,1,17)$$ So the sum of all possible values of $m$ is $5(13+17)=150$, as desired.