# If $m^2 = (a+1)^3 - a^3$, then $m$ is the sum of two squares.

Prove that: $$\text{If} \space m^2=(a+1)^3-a^3\text{ where}\space m,a\in\mathbb{N} \implies \exists c,d \in\mathbb{N}\space \text{ such that}\space m=c^2+d^2.$$ Maybe it is wrong, if it is let me know why. I really need answer of this question.

(I asked this question in Edit of this link but I need to find answer soon so I just ask it again here.)

Edit (and hint): It has an answer like $m = n^2+(n+1)^2$ but I don't know how to find this n for m from above equation.

-
necessary condition is : $m\equiv 1 \pmod 4$ – pedja Jan 19 '12 at 13:33
If it is wrong then the counterexample has $m>10^{100}$ and if there is a counterexample where $m$ not $1$ (mod 4) then $m> 10^{20000}$. – Listing Jan 19 '12 at 13:41
@lhf tnx for link. now i'm sure the question isn't wrong but how I prove it?i can't find it there! – Lrrr Jan 19 '12 at 13:54
@Listing i don't get what you said! – Lrrr Jan 19 '12 at 13:56
The condition is equivalent to the Pell equation $(2m)^2 - 3(2a+1)^2 = 1$. – Thomas Andrews Jan 19 '12 at 14:10

HINT $\$ Times $4$ yields $\rm\ 3\ (2\ a + 1)^2 = (2\ m-1)\ (2\ m + 1)\:.\$ The latter factors are coprime so

$\rm(1)\quad 2\ m - 1 = 3\ j^2,\ 2\ m + 1 = k^2\ \Rightarrow\ k^2 - 3\ j^2 = 2\ \Rightarrow\ k^2 \equiv -1\pmod 3\ \Rightarrow\Leftarrow$

$\rm(2)\quad 2\ m - 1 = \ j^2,\quad 2\ m + 1 = 3\ k^2 \Rightarrow\ odd\ j = 2\ i +\! 1\ \Rightarrow\ m\: = \dfrac{j^2+1}2 = (i\!+\!\!1)^2\!\! +\! i^2\$ QED

REMARK $\ \$ The above technique, exploiting the structure of coprime factors of powers in a UFD, is ubiquitous in number theory. Perhaps the simplest example is the parametrization of primitive Pythagorean triples $\rm\ x^2 + y^2 = z^2\:.$ The essence of the proof is: $\rm\ x+y\ i,\ \ x-y\ i\$ are coprime factors of a square in a UFD, so they must themselves be squares (up to unit factors). Therefore $\rm\ x + y\ i\ =\ (m + n\ i)^2 =\ m^2 - n^2 + 2\: m\: n\ i\:.\:$ Similarly one can solve low degree cases of Fermat's Last Theorem by employing analogous factorizations over certain rings of algebraic integers. For example, Gauss showed there are no solutions for exponent 3 by working in the ring of integers of $\rm\ \mathbb Q(\sqrt{-3})\:,\:$ and Dirichlet did similarly for exponent 5 using $\rm\ \mathbb Q(\sqrt{5})\:.$ Later Kummer generalized these techniques to handle all regular prime exponents by working over rings of cyclotomic integers. For a nice exposition see Ribenboim: 13 lectures on Fermat's last theorem. Weil nicely summarizes the essence of these techniques in his Number Theory, Ch.IV,S.VI,p.335:

-
it was great i'm really tankful i can't see this beautiful solution. tnx again:) – Lrrr Jan 19 '12 at 17:14
@Ali I've added some general remarks that may help you to see it better. – Bill Dubuque Jan 19 '12 at 18:20
tnx again for being kind:) – Lrrr Jan 19 '12 at 18:25
+1, Excellent solution. This is really nice. – Eric Naslund Jan 19 '12 at 18:36
It's also possible that (you mentioned unit factors, but didn't consider them): $x+yi=-(m+ni)^2=-\left(m^2-n^2\right)-(2mn)i$, $x+yi=\pm i (m+ni)^2=\mp (2mn)\pm\left(m^2-n^2\right)i$. Since $x,y$ are symmetric and their signs don't matter, the proof still works. – user236182 Sep 25 '15 at 3:02

The sequence of such $m$ is oeis.org/A001570 and there we learn that $m$ is a sum of consecutive squares, which is more than we need.

oeis.org/A001570 points to this note:

Victor Thebault, Consecutive Cubes with Difference a Square, The American Mathematical Monthly, Vol. 56, No. 3 (Mar., 1949), pp. 174-175.

There we learn that $m^2 = (a+1)^3 - a^3 = 3a^2+3a+1$ is equivalent to $(2m)^2-3(2a+1)^2=1$. Indeed, $(2a+1)^2=4a^2+4a+1$ and so $4m^2=3(2a+1)+1$. This is a Pell equation $u^2-3v^2=1$, with $u=2m$ and $v=2a+1$.

We also learn in that note that $m=(x+1)^2+x^2$ reduces to the same Pell equation $4r^2-3s^2=1$, but no details are given. These are left as an exercise. :-)

-

So, if $(2m)^2-3y^2 = 1$, then:

$$4m = (2+\sqrt 3)^l + (2-\sqrt 3)^l$$

for an odd integer $l$.

But $2+\sqrt 3 = \frac{(1+\sqrt 3)^2}2$, so we can rewrite this as:

$$2^{l+2}m = a^{2l} + b^{2l}$$

Where $a = 1+\sqrt 3$, $b=1-\sqrt 3$. Noting that, since $l$ is odd and $ab=-2$:

$$2^{l+1}=(-2)^{l+1} = -2(ab)^l = -2a^lb^l$$ we can subtract $2^{l+1}$ from both side and get that:

$$2^{l+2}m - 2^{l+1} = a^{2l} + 2a^lb^l + b^{2l} = (a^l + b^l)^2$$

But $a^l+b^l$ is an integer, so $2^{l+2}m - 2^{l+1}$ is a square. Since $l$ is odd, $2^{l+1}$ is a square, so $2m-1$ must be a square.

That is, $2m = z^2 + 1$ for some $z$, and hence $m = u^2 + (u+1)^2$ where $u = \frac{z-1}2$

-
tnx for your answer but bill's answer was really beautiful. – Lrrr Jan 19 '12 at 17:45
@AliAmiri Definitely, his answer is better :) – Thomas Andrews Jan 19 '12 at 17:53

I find an answer for my questionn: $$(a+1)^3-a^3 = m^2 \Rightarrow 3a^2+3a+1=m^2\Rightarrow 9a^2+9a+3=3m^2\Rightarrow (3a+1)^2+3a+2=3m^2$$ now we assume $3a+1 = t$ so: $$t^2+t+1-3m^2 = 0 \rightarrow t = \dfrac{-1\pm\sqrt{1-4(1-3m^2)}}2\Rightarrow t=\dfrac{-1\pm\sqrt{12m^2-3}}2$$and $t>0$ so: $$t=\dfrac{\sqrt{12m^2-3}-1}2$$ and we know $t$ is natural so: $$\sqrt{12m^2-3} = k \Rightarrow k^2 = 3(4m^2-1)$$ so if we assume $p = 2m$ : $$k^2=3(p^2-1)\Rightarrow 3(p-1)(p+1)\ ,\ gcd(p-1,p+1)=1$$ And the rest the of solution is like Bill's answer!

Obviously Bill's answer is better but it is mine:).

-