# the New Year will be 2017: how many pairs of integer solutions to $x^2 + y^2 = (2017)^3$?

We're almost in 2017. I wonder how many pairs of integer solutions has the following diophantine equation:

$$x^2 + y^2 = (2017)^3$$

• Since 2017 is not yet come, you still have time to think about it and tell us your efforts! Dec 28, 2016 at 0:09
• @Maffred nice comment xd.
– Xam
Dec 28, 2016 at 0:10
• wow, my answer got $6$ upvotes and it was wrong, good to see you all love me though :) Dec 28, 2016 at 0:13
• Using brute force one can find that the only solutions $(x,y)$ satisfying $0 \le x \le y$ are $(18153, 88748)$ and $(51543, 74492)$. Hence in total there are 16 integer solutions. Dec 28, 2016 at 0:27
• There is a well-known lemma (see Cox, primes of the form $x^2+ny^2$) stating that the number of integer solutions of $x^2+y^2=n$ is four times the difference between the number of divisors of $n$ of the form $4k+1$ and the number of divisors of $n$ of the form $4k+3$. Since $2017$ is a prime of the form $4k+1$, there are $16$ solutions. Dec 28, 2016 at 1:45

Without loss of generality, let's say $x < y$. Thus, $2x^2 < x^2+y^2=2017^3$, meaning $x < \sqrt{\frac{2017^3}{2}} < 64054$. Thus, just test all of the integers $x$ from $x=0$ to $x=64053$. Here's the Python code for this problem and the program's output.

>>> from math import sqrt
... for x in range(64054):
...     y = int(sqrt(2017**3-x**2))
...     if x*x*+y*y == 2017**3: print(x, y)

18153 88748
51543 74492


Thus, we have: $$(x, y) \in \{(\pm 18153,\pm 88748), (\pm 51543,\pm 74492), (\pm 74492,\pm 51543), (\pm 88748,\pm 18153)\}$$

• @AlexWertheim Thanks for the catch! Dec 28, 2016 at 0:25
• Sure! Of course, each component can be negative, so you'd have to include those as well. But maybe it'd be easiest to write $(\pm x, \pm y)$. Dec 28, 2016 at 0:26
• @AlexWertheim Oh, thanks again! Dec 28, 2016 at 0:27

Noble Mushtak's solution is a quick way to solve this problem completely using a computer. What I will try to present here is a method for finding a solution that can be done a little more simply.

We know that $2017$ is a prime number. Thus, the factorization of $2017^3$ is just that: $2017^3$.

By Fermat's theorem on two squares, $2017$ is expressible as the sum of two squares, since $2017\equiv 1 (\operatorname{mod} 4)$. This can be done by hand relatively easily: the only solution to $a^2+b^2=2017$, excluding trivial rearrangments, is:

$9^2+44^2=2017$.

Consider $(2017\cdot 9)^2+(2017\cdot 44)^2$. We can factor out $2017^2$, so this gives

$2017^2(9^2+44^2)$,

and knowing the value of the sum of squares, this is just

$2017^3$.

Thus, we have quickly found a solution

$(2017\cdot 9)^2+(2017\cdot 44)^2=2017^3$,

matching up with one of the solutions the programs gave.

There are other primitive solutions to this equation; this method won't give them, but it is a quick way to solve the problem by hand. A consequence of this is that given any integer $n$ such that there exists a Diophantine solution to

$a^2+b^2=n$,

$n^3$ can be decomposed as well (and in an easily constructible way).

The answer is just $\frac{3+1}{2}=2$. ( or $4$ if the order matters).

I checked it with this code:

#include <bits/stdc++.h>
using namespace std;
typedef long long lli;

lli N=2017;

int isq(lli N){
lli s=sqrt(N);
if(s*s==N) return(1);
return(0);
}

int main(){
N=N*N*N;
int res=0;
for(lli i=0;i*i<N;i++){
if(isq(N-i*i) ) res++;
}
printf("%d\n",res);
}


For future reference, if you just enter

m^2 + n^2 = (2017)^3

into Mathematica (or WolframAlpha) then it returns all integer solutions:

I want to share with everyone that I just found an algebraic method to calculate primitive triples in my specific case of raising to the third power:

$$[x(x^2-3y^2)]^2+[y(3x^2-y^2)]^2=n^3$$

I do not know why but on specialist internet sites this is not often found.

Happy new year for all.