ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 13 Sep 2020 10:35:18 +0200Solving a Diophantine systemhttps://ask.sagemath.org/question/53429/solving-a-diophantine-system/ I am trying to find solutions to the following Diophantine system:
a+b+c=x^2
a^2+b^2+c^2=y^2
a^3+b^3+c^3=z^2
where a,b,c are less than 5000 and where x,y,z are perfect squaresSat, 12 Sep 2020 23:00:29 +0200https://ask.sagemath.org/question/53429/solving-a-diophantine-system/Comment by slelievre for <p>I am trying to find solutions to the following Diophantine system:</p>
<p>a+b+c=x^2</p>
<p>a^2+b^2+c^2=y^2</p>
<p>a^3+b^3+c^3=z^2</p>
<p>where a,b,c are less than 5000 and where x,y,z are perfect squares</p>
https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53435#post-id-53435Should $x$, $y$, $z$ really be perfect squares?
So $a + b + c$, $a^2 + b^2 + c^2$, $a^3 + b^3 + c^3$ are perfect fourth powers?
Or did you mean $a + b + c$, $a^2 + b^2 + c^2$, $a^3 + b^3 + c^3$ are perfect squares?
If so, write one of the following:
- $a + b + c = x$, $a^2 + b^2 + c^2 = y$, $a^3 + b^3 + c^3 = z$ and $x$, $y$, $z$ are perfect squares
- $a + b + c = x^2$, $a^2 + b^2 + c^2 = y^2$, $a^3 + b^3 + c^3 = z^2$ and nothing more on $x$, $y$, $z$Sun, 13 Sep 2020 03:43:41 +0200https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53435#post-id-53435Comment by slelievre for <p>I am trying to find solutions to the following Diophantine system:</p>
<p>a+b+c=x^2</p>
<p>a^2+b^2+c^2=y^2</p>
<p>a^3+b^3+c^3=z^2</p>
<p>where a,b,c are less than 5000 and where x,y,z are perfect squares</p>
https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53436#post-id-53436Is this homework? Is this from Project Euler?
What have you tried? What specific problem(s) are you facing?Sun, 13 Sep 2020 03:45:22 +0200https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53436#post-id-53436Comment by brennan for <p>I am trying to find solutions to the following Diophantine system:</p>
<p>a+b+c=x^2</p>
<p>a^2+b^2+c^2=y^2</p>
<p>a^3+b^3+c^3=z^2</p>
<p>where a,b,c are less than 5000 and where x,y,z are perfect squares</p>
https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53442#post-id-53442It is not for homework, I am doing research and I am just trying to find small numerical solutions without using elliptic curves.
I do mean that $a+b+c$, $a^2+b^2+c^2$, and $a^3+b^3+c^3$ are simply perfect squares, not perfect fourths.
And i have been trying to define each as a separate equation but I cant solve for the variables within a range as integers, something like:
for a in range(5000)
for b in range(5000)
for c in range(5000)
eq1 = a+b+c==x^2
eq2 = a^2+b^2+c^2==y^2
eq3 = a^3+b^3+c^3==z^2
solve([eq1,eq2,eq3],a,b,c,x,y,z)
I know this is not right, I am super new to Sage, please help!Sun, 13 Sep 2020 09:01:45 +0200https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53442#post-id-53442Answer by vdelecroix for <p>I am trying to find solutions to the following Diophantine system:</p>
<p>a+b+c=x^2</p>
<p>a^2+b^2+c^2=y^2</p>
<p>a^3+b^3+c^3=z^2</p>
<p>where a,b,c are less than 5000 and where x,y,z are perfect squares</p>
https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?answer=53443#post-id-53443Elementary version
sage: for a in srange(1, 5000):
....: for b in srange(1, a+1):
....: for c in srange(1, b+1):
....: if (a+b+c).is_square() and (a^2+b^2+c^2).is_square() and (a^3+b^3+c^3).is_square():
....: print(a,b,c)
A little bit more elaborate
sage: for abc in srange(1, 10000):
....: abc = abc*abc
....: for a in srange((abc + 2)// 3, abc):
....: for b in srange((abc - a + 1)//2, min(a, abc - a)):
....: c = abc - a - b
....: if (a^2+b^2+c^2).is_square() and (a^3+b^3+c^3).is_square():
....: print(a,b,c)
From which you get the list: (129, 124, 108), (516, 496, 432), (1161, 1116, 972), (2873, 2134, 34), (2064, 1984, 1728), (3225, 3100, 2700), ...
Sun, 13 Sep 2020 10:10:24 +0200https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?answer=53443#post-id-53443Comment by brennan for <p>Elementary version</p>
<pre><code>sage: for a in srange(1, 5000):
....: for b in srange(1, a+1):
....: for c in srange(1, b+1):
....: if (a+b+c).is_square() and (a^2+b^2+c^2).is_square() and (a^3+b^3+c^3).is_square():
....: print(a,b,c)
</code></pre>
<p>A little bit more elaborate</p>
<pre><code>sage: for abc in srange(1, 10000):
....: abc = abc*abc
....: for a in srange((abc + 2)// 3, abc):
....: for b in srange((abc - a + 1)//2, min(a, abc - a)):
....: c = abc - a - b
....: if (a^2+b^2+c^2).is_square() and (a^3+b^3+c^3).is_square():
....: print(a,b,c)
</code></pre>
<p>From which you get the list: (129, 124, 108), (516, 496, 432), (1161, 1116, 972), (2873, 2134, 34), (2064, 1984, 1728), (3225, 3100, 2700), ...</p>
https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53444#post-id-53444Thank you so much! It is exactly what I needed!!Sun, 13 Sep 2020 10:35:18 +0200https://ask.sagemath.org/question/53429/solving-a-diophantine-system/?comment=53444#post-id-53444