# On the equation $m^3-m^2+1 = n^2$

(i) How can I find all positive integers $m$ such that $m\equiv 4 \pmod 7$ and $m^3-m^2+1$ is a perfect square?

(ii) Is there a method to solve this equation over positive integers: $$m^3-m^2+1 = n^2.$$

-
Notice that if $m \equiv 4 \mod 7$ then $n^2 = m^3 - m^2 + 1 \equiv 0 \mod 7$. This means that $7$ divides $n$ and $7^2$ divides $m^3-m^2+1$. It might help... – Joel Cohen May 29 '11 at 14:29
The equation describes an elliptic curve of rank 1 with trivial torsion subgroup. See my answer here on how to find integral points on elliptic curves in general: math.stackexchange.com/questions/30457/… – Alex B. May 29 '11 at 14:59
Thanks... Can someone please help me with the cube version of the problem? I mean solving this equation: $m^3−m^2+1=n^{\color{red}3}$ in positive integers. – Amir Hossein May 29 '11 at 15:29
A hint/comment for the cube version (new poster, not good enough reputation to comment, sorry): [Edit: moved this to a comment now that I CAN comment] If $m$ and $n$ are positive integers, then you are left with relatively few alternatives given that whenever $m>1$ we have the inequalities $$(m-1)^3=m^3-3m^2+3m-1< m^3-m^2+1< m^3.$$ Thus your choices for $n$ are severely limited given that cubing is an increasing function :-) – Jyrki Lahtonen Jun 8 '11 at 6:10

Solution to i). We put $m=7\lambda+4$, for an integer $\lambda\geq 0$ in your equation. We obtain, thus by substitution $$343\lambda^3+539\lambda^2+280\lambda+49=n^2.$$ Since $7|n^2$ then $49|n^2$, thus since $49$ doesn't divide $280$ there exists an integer $\mu\geq 0$ such that $\lambda=7\mu$, and we obtain $$2401\mu^3+539\mu^2+40\mu+1=l^2,$$ for $l^2=(\frac{n}{7})^2$.

If $\mu=0$ we obtain the solution $(m,n)=(4,7)$, corresponding to $l=1$.

Now let $\mu>0$, since if $\mu$ is even (or odd, too holds the following statement) $2|2401\mu^3+539\mu^2+40\mu$ then $2$ divides $1-l^2$, thus $\mu-2|2401\mu^3+539\mu^2+40\mu+1-l^2$. When we divide we obtain $$2401\mu^3+539\mu^2+40\mu+1-l^2=(\mu-2)\cdot (2401\mu^2+5341\mu+10722),$$ with remainder $21444+1-l^2$ vanishing, that has not integer solutions. Neither the quotient equation $2401\mu^2+5341\mu+10722=0$ (compute its discriminant to prove). Thus the unique solution is computed as $(m,n)=(4,7)$.

I hope that there aren't mistakes in my computations. Another attempt to solution that I made was study your equation as $$m^2(m-1)=(n-1)(n+1).$$

My solution to ii). We study the case $n=1$ and obtain the solutions $(m,n)=(0,1),(1,1)$. Thus we assume that integers $m,n\geq 1$. And we use previous method for study (and we are sure too to exclude more solutions) in cases $m\equiv 0,1,2,3,5,6\mod 7$. For case $m=7k$ for an integer $k$, we obtain by substitution $(7k)^3-(7k)^2+1-n^2=0$, with remainder (when we divide by $k-2$) $2548+1-n^2=0$ without integer solutions and negative discriminant of polynomial in quotient $343k^2+637k+1274$. My computations (corresponding to polynomial after our substitution, remainder without integer solutions, polynomial in quotient that has negative discriminant) to cases $m\equiv 1,2,3,5,6\mod 7$ are

$343k^3+98k^2+7k+(1-n^2)=0$, $3150+1-n^2=0$ and $343k^2+784k+1575$;

$343k^3+245k^2+56k+4+(1-n^2)=0$, $3840+1-n^2=0$ and $343k^2+931k+1918$;

$343k^3+392k^2+147k+(1-n^2)=0$, $4606+1-n^2=0$ and $343k^2+1078k+2303$;

$343k^3+686k^2+455k+100+(1-n^2)=0$, $6498+1-n^2=0$ and $343k^2+1372k+3199$;

$343k^3+833k^2+672k+180+(1-n^2)=0$, $7600+1-n^2=0$ and $343k^2+1519k+3710$.

(I've edited because my computations were wrong and to give a full solution. Thanks.)

-