2018 MathCounts: Let $D(k)$ be the number of diagonals for a polygon with $k$ sides. If $D(m) + D(n) = 125$, what is the value of $m+n$? The question was asked in the 2018 Raytheon MATHCOUNTS National Competition. It appears in the video around the 35:34 mark:
https://www.youtube.com/watch?v=dSnOLW_W6og&t=2134

Let $D(k)$ be the number of diagonals for a polygon with $k$ sides. If
  $D(m) + D(n) = 125$, what is the value of $m+n$?

The formula for the number of diagonals is well-known and easily derived as $k(k-3)/2$.
I then computed several values, and found a suitable pair of numbers to solve the problem.
But is there any easier way to solve this equation:
$$\frac{n(n-3)}{2} + \frac{m(m-3)}{2} = 125$$
$$n,m \in {3, 4, ...}$$
The students were supposed to solve this in minutes without a calculator.
My guess is there is not a simpler way--in MathCounts the students may have just memorized many values.
 A: Let $m=x-n$. Then,
$$\frac{n(n-3)}{2}+\frac{m(m-3)}{2}=125$$
is equivalent to
$$x^2-(2n+3)x+2n^2- 250 = 0$$
which implies
$$x=\frac{2n+3\pm\sqrt{1018-(2n-3)^2}}{2}$$
So, there has to be an integer $k$ such that $$1018=(2n-3)^2+k^2$$
Here, both $2n-3$ and $k$ are odd. 
Since the rightmost digit of $(\text{odd})^2$ is either $1,9$ or $5$, both the rightmost digit of $(2n-3)^2$ and that of $k^2$ are $9$.
So, we only need to consider
$$3^2=9, 7^2=49, 13^2=169, 17^2=289, 23^2=529, 27^2=729$$
So, we see that 
$$27^2+17^2=1018$$
is the only possible sum.
So, $2n-3=27$ implies $n=15$, and $2n-3=17$ implies $n=10$.
Therefore, $$\color{red}{m+n=x=25}$$
A: We want to solve $n^2-3n+m^2-3m = 250$ for $n,m\ge 3$.
Multiplying by $8$ and symmetrizing the polynomials, we get that the equation is equivalent to solving 
$$j^2-9 + k^2-9 = 1000,$$
with $j=2n-3$, $k=2m-3$, or 
$$j^2+k^2=1018.$$
Mod $3$ we have $$j^2+k^2\equiv 1\pmod{3},$$ so one of $j$ or $k$ is divisible by $3$. Without loss of generality then, $j=3x$. 
Now we want to solve 
$$9x^2 + k^2 =1018.$$
Mod $9$, we get 
$$k^2 \equiv 1\pmod{9}.$$ Then $k=9y+10$ or $9y+8$ for some $y>0$, since the units mod $9$ are cyclic.
Now we have either
$$9x^2 + 81y^2+180y+100 = 1018$$
which reduces to 
$$ x^2 + 9y^2 + 20y = 102$$
or 
$$9x^2+81y^2+144y + 64 = 1018,$$
which reduces to 
$$ x^2 + 9y^2 + 16y = 106$$
In either case, $1\le y\le 2$.
Thus we are reduced to computing four values less than $100$ and checking whether they are squares:
For $y=1$, computing
$102- (9y^2+20y)$ and $106-(9y^2+16y)$  gives 
 $102-29 = 73$, and $106-25 = 81$.
$81=9^2$, so we are already done without checking $y=2$. This gives $x=9$, $y=1$, corresponding to $j=27$, $k=17$, and thus $n=15$, $m=10$.
Checking our work yields 
$$15\cdot 6 + 5\cdot 7 = 90+35=125.$$
