Prove that $n$ is divisible by $6$

Problem:

Let $x^2+mx+n$ and $x^2+mx-n$ give integer roots where $(m,n)$ are integers. Show that $n$ is divisible by $6$

My attempt:

Since the roots are integers then the discriminants of both the equations should be perfect squares.

Let $a=\sqrt{m^2-4n}$ and $b=\sqrt{m^2+4n}$, then $(ab)^2=m^4-16n^2$ where $(a,b,m,n)$ are all integers. I am stuck here...


We have $a^2 + b^2 = 2 m^2$, whose solution in the integers is

$$a = x^2+2xy-y^2, b = y^2 + 2xy - x^2, m = x^2 + y^2, \text { for } x, y \in \mathbb{N}$$

Hence, $ 4n = m^2 - a^2 = 4 xy (x-y) ( x+y)$

It is clear that $ xy (x-y)(x+y)$ must be a multiple of 6.


Proof of classification: (I'm slightly surprised I can't find a derivation on this site, but I'm bad at searching)

If $a$ is even, then clearly $b$ is even, and thus so is $m$, and we can then divide out by 2. Hence, we may assume that $a$ and $b$ are odd, so $ a = 2p-1, b = 2q-1$.

Observe that $m^2 = ( p-q) ^2 + (p+q-1)^2$, hence by the classification of pythagorean triples, we have

$$ m = x^2 + y^2, (p-q) = x^2 - y^2, (p+q-1) = 2xy$$

In other words,

$$a = x^2+2xy-y^2, b = y^2 + 2xy - x^2, m = x^2 + y^2, \text { for } x, y \in \mathbb{N}$$