# Finding integer solution to a quadratic equation in two unknowns [closed]

We have an equation: $$m^2 = n^2 + m + n + 2018.$$ Find all integer pairs $$(m,n)$$ satisfying this equation.

## closed as off-topic by Théophile, John Omielan, Eevee Trainer, YiFan, zz20sMar 9 at 0:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – Théophile, John Omielan, Eevee Trainer, YiFan, zz20s
If this question can be reworded to fit the rules in the help center, please edit the question.

• Well, if $(m,n)$ is a solutions, integer or not, what is the formula for $m$ in terms of $n$ (or vice versa)? Now which values can to be integers. – fleablood Mar 8 at 16:38

Hint $$(m+n)(m-n)= (m+n)+2018$$

so $$(m+n)(m-n-1)= 2018$$

Guide: Write $$m=n+k$$ for some integer $$k$$, then $$n^2+2nk+k^2= n^2+2n+k+2018$$

so $$n={-k^2+k+2018\over 2(k-1)}=-{k\over 2}+{1009\over k-1}$$

If $$k$$ is odd then there is no solution, so $$k= 2s$$ so $$2s-1\mid 1009$$

Can you finish?

Simpler start: separating variables to either side gives: $$m^2-m=n^2+n+2018$$ which then factors roughly for the variables as: $$m(m-1)=n(n+1)+2018$$

which since both pairs(m,m-1) and (n,n+1) are consecutive integers, you can divide both sides by two giving:

$$\frac{m(m-1)}{2}=\frac{n(n+1)}{2}+1009$$

But, $$\frac{y(y+1)}{2}$$ is the form of the y-th triangular number, so the solutions are such that 1009 is the difference of two triangular numbers $$T_{\vert m-1 \vert}$$ and $$T_{\vert n \vert}$$ . Solve for n, and m-1 .