Disclaimer: The solutions we've shared are just one exciting approach, and
there are surely many other wonderful methods out there. We’d love to hear
your alternative solutions in the community thread below, so let's keep the
creativity
flowing!
Let the gcd of $M$ and $N$ be $d$.
Let $M=dm$ and $N=dn$.
As $d$ is gcd, $gcd(m,n)=1$
So as given $lcm(M,N)=M^2-N^2+MN$
$lcm(M,N)=d^2m^2-d^2n^2+d^2mn=d^2(m^2-n^2+mn)$
We know, $gcd(a,b) \times lcm(a,b)=ab$
Using this,
$lcm(M,N) \times gcd(M,N)=MN$
$d^2(m^2-n^2+mn) \times d = dm \times dn$
$d^3(m^2-n^2+mn)=d^2mn$
$d(m^2-n^2+mn)=mn$
$dm^2-dn^2+dmn=mn$
$mn(d-1)=d(n^2-m^2)=d(n-m)(n+m)$
Note that $d$ is a divisor of Left hand side
As $gcd(d,d-1)=1$ and $d | mn(d-1)$ we have $d | mn$
As $gcd(m,n)=1$
So, $gcd(m,n-m)=1$
Also $gcd(m,n+m)=1$
So, $gcd(m,(n-m)(n+m))=1$
Similarly $gcd(n,(n-m)(n+m))=1$
So, $gcd(mn,(n-m)(n+m))=1$
which implies $mn | d$
We have $d | mn$ and $mn | d$ so $d=mn$
Now, $MN=dm \times dn =d^2mn=d^3$ which is a cubic number.