26

I. This post asks to find $4$ integers $a,b,c,d$ such that the difference between any two is a square. As mentioned by my answer, it is equivalent to finding $3$ squares such that the difference of any two is also a square.

With the positive answer to that question, the OP of that post muses if we can also find $FIVE$ integers $a,b,c,d,e$ such that the difference of any two is a square. Equivalently, we are to solve System 1,

$$p^2+w^2 = x^2\\ q^2+w^2 = y^2\\ r^2+w^2 = z^2\\ s^2+x^2 = y^2\\ t^2+x^2 = z^2\\ u^2+y^2 = z^2$$

If this has a positive solution, then it involves three special hypotenuse $\color{blue}{x,y,z}$ expressible as Pythagorean triples in $1$, $2$, and $3$ ways,

$$p^2+w^2 = \color{blue}{x^2}$$ $$q^2+w^2 = s^2+x^2 = \color{blue}{y^2}$$ $$r^2+w^2 = t^2+x^2 = u^2+y^2 = \color{blue}{z^2}$$

which seems doable.


II. Alternatively, by solving the system for $p,q,r,s,t,u$, then we can reduce the number of variables to finding just four squares $w^2< x^2<y^2<z^2$ such that the difference between any two is a square, or System 2,

$$-w^2+x^2 =\square_1\\-w^2+y^2=\square_2\\-w^2+z^2=\square_3\\-x^2+y^2=\square_4\\-x^2+z^2=\square_5\\-y^2+z^2=\square_6$$

For the special case $w = 0$, the smallest of infinitely many solutions is,

$$w,x,y,z = 0, 153, 185, 697$$

Q: More generally, can we find four squares $w^2,x^2,y^2,z^2$ of System 2 such that $w\neq0$?

Update: Using zwim's data here, we find that for $w,x,y,z = 448, 952, 1073, 1105$, then,

$$-w^2+x^2 =840^2\\-w^2+y^2=975^2\\-w^2+z^2\neq\square_3\,\,\\-x^2+y^2=495^2\\-x^2+z^2=561^2\\-y^2+z^2=264^2$$

Almost, but not quite. But I believe a higher search range will yield something.

  • 1
    My calculations made so far suggest that $z$ is well over 500,000. – Oldboy Jul 08 '19 at 15:44
  • 1
    @Oldboy: Thanks. But that is strange. The smallest solution such that the relations yield at least 5 squares only has $z=1105$ in the update. – Tito Piezas III Jul 08 '19 at 15:59
  • True, but with my code I have been able to reproduce all those results but still could not find the solution with 6 squares. – Oldboy Jul 08 '19 at 16:20
  • @Oldboy: Ok. I have an idea. Rathbun's results have the 3-square case with the $z$ up to the millions. I'll check those. – Tito Piezas III Jul 08 '19 at 16:24
  • @Oldboy: A favor. Can you modify your code to search such that 5 out of the 6 are squares? And post some of the results as a partial answer? The results might give a trend or pattern. – Tito Piezas III Jul 08 '19 at 16:37
  • Let me run the current program (searching for 6 out of 6) overnight. If that fails I'll modify the program to search for 5 out of 6. – Oldboy Jul 08 '19 at 16:43
  • @Oldboy: Oops, never mind about the 5 out of 6. I just found a parameterization for it. It's the 6 out of 6 that is a challenge. – Tito Piezas III Jul 08 '19 at 17:30
  • I have left my code running, stay tuned. :) – Oldboy Jul 08 '19 at 20:06
  • Still no luck :( If the solution exists, $z$ must be greater than $1.6\times10^6$. But I'm a stubborn guy, still running the code. – Oldboy Jul 09 '19 at 08:21
  • 1
    @Oldboy: Thanks for the persistence! The fact that the smallest for the 5 out of 6 case has $z\approx 10^3$, while the 6 out of 6 case still has none for $z\approx 10^6$ does not seem to bode well. But thanks again. :) – Tito Piezas III Jul 09 '19 at 08:44
  • This seems related to Euler bricks and perfect cuboids in particular, but I'm not sure whether it is the same problem in disguise... – Servaes Jul 09 '19 at 13:06
  • @Servaes: Very good intuition! The 5 out of 6 parameterization I found uses Euler bricks. However, I haven't been able to reduce this problem to perfect cuboids, though I also have a feeling they may be related. – Tito Piezas III Jul 09 '19 at 14:02
  • @Oldboy I have limited time for programming but, if you do not, perhaps you can shorten your search using formulas that I developed after I had spent too much time in $FOR$ loops from $1$ to some limit. These show how to match sides of Pythagorean triples in a defined finite search. Caveat: they will $only$ find primitives, doubles, and square multiple of primitives, i.e. they will not find $9,12,15\quad 15,20,25$, etc. Good luck – poetasis Jul 30 '19 at 18:04
  • 1
    @Tito Piezas III: Actually $z=1105$ is the smallest $z$ possible because $5\cdot13\cdot17$ is the smallest number that has at least 3 prime factors only 1 mod 4. – emacs drives me nuts Apr 04 '20 at 07:59
  • @Oldboy I finally added the infinite family of 5 out of 6 squares. I don't know why I didn't back then, almost lost the data. Kindly see second answer below. – Tito Piezas III Feb 08 '25 at 08:41
  • @Oldboy: Do you still have the data $0<w<x<y<z<B$ for some bound $B$ that gives 5 out of 6 squares? I almost lost mine. I should have asked you to give a partial answer before as there may have patterns in your data. – Tito Piezas III Feb 09 '25 at 03:17
  • @Servaes I've given a connection to Euler bricks (well to Euler cuboids really) in this answer. – Tito Piezas III Feb 09 '25 at 07:12

2 Answers2

4

I could manage to find many almost solutions (with the aim to derive full solutions) by a systematic search:

My first trials, code and ideas are posted here, where I received very helpful input that directed me to a promising approach, proposed by Peter: Search for 6-tuples $(s,t,u,t+u,t+u−s,t−s)$ consisting of perfect squares. I implemented a Python script which systematically searched for those 6-tuples and it found a lot of instances. Unfortunatelly at a certain point it became slow and did not scale anymore.

With the help of Arty, who developed an enhaced version, I could manage to find a first allmost matches. This performance breakthrough origins from this question, I asked on SO.

On a machine with 128GB RAM, an Intel Xeon CPU E5-2630 v4, 2.20GHz processor (and two graphic cards of type Tesla V100 with 16GB RAM) I generated a large textfile of these 6-tuples $(s,t,u,t+u,t+u−s,t−s)$.

To make the final step, namely to identify these four squares, I implemented the Mathematica Script pythagorean.nb, which outputs an "almost solution": [w=40579, x=-58565, y=-65221].

From the data set I selected the corresponding row:

42228, 51060, 185472, 1783203984, 2607123600, 34399862784, 37006986384, 35223782400, 823919616

Hence $s=42228^2,t=51060^2,u=185472^2$. To calculate the last variable $z$, I need to use the equation $u+y^2=z^2$ leading to $z=196605,294$.

Now my idea is to multiply all integers $w,x,y,z$ with a suitable integer, for example with $10^{10}$ to bring us closer towards a solution:

  • $z^2-y^2=1854720000103154^2$
  • $z^2-x^2=1876800000101940.2^2$
  • $z^2-w^2=1923720000099454^2$
  • $y^2-x^2=287040000000000^2$
  • $y^2-w^2=510600000000000^2$
  • $x^2-w^2=422280000000000^2$

An excerpt of the list containing such "almost" solutions, I could generate so far is (raw output of Mathematica):

  • $w=40579,x=-58565,y=-65221,z=196605.2940$
  • $w=53900,x=-71540,y=-91756,z=157415.4376$
  • $w=534240,y=-540600,z=-554115,x=537302.7941$
  • $w=67375,x=-89425,y=-114695,z=196769.2970$
  • $w=81158,x=-117130,y=-130442,z=393210.5880$

The Mathematica Code is shown below:

arr = Import[
   "C:/Users/esultano/git/pythagorean/pythagorean_stu_Arty_.txt", 
   "CSV", "HeaderLines" -> 0];
f[i_] := Part[arr[[i]], 1 ;; 3];
len = Length[arr];
For[i = 1, i < len, i++, {
  triplet = f[i];
  s = triplet[[1]];
  t = triplet[[2]];
  u = triplet[[3]];
  ins = FindInstance[
    x*x - w*w == s*s && y*y - w*w == t*t && w != 0, {w, x, y}, 
    Integers];
  If[Length[ins] > 0, 
   Print[Append[First[ins], 
     z -> N[Sqrt[u^2 + First[ins][[3, 2]]^2], 10]]], Continue];
  ins = FindInstance[
    y*y - w*w == t*t && z*z - y*y == u*u && w != 0, {w, y, z}, 
    Integers];
  If[Length[ins] > 0, 
   Print[Append[First[ins], 
     x -> N[Sqrt[s^2 + First[ins][[1, 2]]^2], 10]]], Continue];
  }
 ]
Eldar Sultanow
  • 1,678
  • 7
  • 19
  • 1
    Great that you finally found solutions! If for some reason we need many more solutions, or to scan larger space, I still have ideas of improvements to code speed. Latest enhanced version should be much faster than previous. And still there is a lot of space to improve speed further. Also such solution is extendable from 4-tuple squares to 5 and 6 tuple if needed. – Arty Jan 24 '22 at 03:51
  • Yes we will search and find more. I am on it and will try your new enhanced version today. – Eldar Sultanow Jan 24 '22 at 05:33
  • I double checked them. These are (due to loss of precision) still almost solutions. Need to search further. – Eldar Sultanow Jan 24 '22 at 08:02
  • 1
    @EldarSultanow I've added a "near-solution" infinite family of 5 out of 6 squares. I don't know why I almost forgot about this post. Kindly see second answer. – Tito Piezas III Feb 08 '25 at 08:36
  • @EldarSultanow I've moved the other comments to "chat" as it was getting too long. And I've edited my answer to include some of your new data. Unfortunately, your variable $z$ should be $\sqrt{z}$ hence is irrational. The explanation should be clear in the edited answer. – Tito Piezas III Feb 10 '25 at 04:48
4

I should have put as a partial answer the "near-solution" family of $5$ out of $6$ squares I mentioned to OldBoy in a July 8, 2019 comment, as the data was almost lost. Assume integers with absolute value $0<w<x<y<z$.

Since $6$ out $6$ squares seems impossible for now (with OldBoy's search implying any solution must have $z>500000)$, we will settle for the easier $5$ out $6$ since the smallest solution $wxyz\neq0$ only has $z=1105$.


I. Families

We seek to solve two simultaneous systems with the same $(x,y,z)$,

$$-x^2+y^2=\square_1\\-x^2+z^2=\square_2\\-y^2+z^2=\square_3\\-w_1^2+x^2\color{red}\neq\square_a\\-w_1^2+y^2=\square_b\\-w_1^2+z^2=\square_c\\$$

but the variable $w_n$ differs in the second system,

$$-x^2+y^2=\square_1\\-x^2+z^2=\square_2\\-y^2+z^2=\square_3\\-w_2^2+x^2=\square_d\\-w_2^2+y^2=\square_e\\-w_2^2+z^2\color{red}\neq\square_f$$

where only the 4th or 6th equation are not squares, respectively. One infinite family is,

\begin{align} \qquad w_1 &= (p^4 - 9 q^4)^2 - 64 p^4 q^4\\[5pt] w_2 &= 16 p^2 (p^4 - 9 q^4)\\[5pt] x &= 4 p q (p^2 + 3 q^2) (p^4 - 2 p^2 q^2 + 9 q^4)\\[5pt] y &=(p^4 - 9 q^4)^2 + 64 p^4 q^4\\[5pt] z &= (p^2 + q^2) (p^2 + 9 q^2) (p^4 - 2 p^2 q^2 + 9 q^4) \end{align}


II. Example

Let $(p,q) = (2,1)$ and we get the absolute values,

$$(w_1,x,y,z) = (\color{blue}{975},\, 952,\, 1073,\, 1105)$$ $$(w_2,x,y,z) = (\color{red}{448},\, 952,\, 1073,\, 1105)$$

therefore,

$$-x^2+y^2=495^2\\-x^2+z^2=561^2\\-y^2+z^2=264^2\\-\color{blue}{975}^2+x^2 \neq\square\quad\\-\color{blue}{975}^2+y^2=\color{red}{448}^2\\-\color{blue}{975}^2+z^2 = 520^2$$

as well as,

$$-x^2+y^2=495^2\\-x^2+z^2=561^2\\-y^2+z^2=264^2\\-\color{red}{448}^2+x^2 =840^2\\-\color{red}{448}^2+y^2=\color{blue}{975}^2\\-\color{red}{448}^2+z^2\neq\square\quad$$

also found by zwim in a computer search. The second system is equivalent to six right triangles obeying the relationship,

$$448^2 + 840^2 = 952^2 = x^2$$ $$448^2 + 975^2 = 495^2 + 952^2 = 1073^2 = y^2$$ $$561^2 + 952^2 = 264^2 + 1073^2 = 448^2 + \big(3\sqrt{113369}\big)^2 = 1105^2 = z^2$$

with only one irrational side. And so on for all $(p,q)$. Whether all sides can be non-zero rationals is still unknown.


Update: Feb 10, 2025

Upon some discussion with Eldar Sultanow, he came up with some data, https://github.com/Sultanow/pythagorean/blob/main/python/verified_solutions6.txt which, after some analysis, solved a slightly different system. Given the pair of triples $(a,b,c)$ and $(d,e,f)$ which solve Mengoli's three-square problem, so,

$$-a^2+b^2 =-e^2+f^2 \,= \square_1\\ {-a}^2+c^2 = -d^2+f^2 = \square_2\\ {-b}^2+c^2 = -d^2+e^2 \,= \square_3$$

and a variable $z$ defined by,

$$z^2=a^2+f^2=b^2+e^2=c^2+d^2$$

Of course, $(a,b,c,z)$ or $(d,e,f,z)$ would immediately solve the "four-square problem" of the post. Unfortunately, all known $z$ so far are irrational. Example,

$$(a,b,c,z) = (31654, 31850, 48790, \sqrt{2483994725})$$ $$(d,e,f,z) = (10175, 38335, 38497, \sqrt{2483994725})$$

where $(a,b,c,z)$ are in Sultanow's data, while $(d,e,f)$ can be derived from $z$'s definition.

  • The fact that an answer of the question, whether all sides can be non-zero rationals is still unknown, keeps that problem being interesting. If you are interested that we implement a solution together - let me know. I am still interested in that amazing topic. – Eldar Sultanow Feb 09 '25 at 08:32
  • 1
    @EldarSultanow If you can generate “smallish” solutions $(w,x,y,z)$ which yield 5 out of 6 squares, that would be a start. (The family I gave yields big values quickly, so i assume there are others.) – Tito Piezas III Feb 09 '25 at 09:11
  • 1
    Ok - this sounds like a good start. I'll implement an efficient code finding 5 out of 6 solutions and will contact you. – Eldar Sultanow Feb 09 '25 at 09:14
  • @EldarSultanow And if in your search you find solutions come in pairs (differing only in one variable like $w$ in the formulas above) then that is certainly interesting. I have no explanation for that yet. – Tito Piezas III Feb 09 '25 at 09:24
  • Here is all I found so far (including "almost solutions"): https://github.com/Sultanow/pythagorean I am now implementing your suggested approach. – Eldar Sultanow Feb 09 '25 at 09:48
  • 1
    Are these near solutions the ones you are looking for: https://github.com/Sultanow/pythagorean/blob/main/python/near_solutions.txt @tito-piezas-iii – Eldar Sultanow Feb 09 '25 at 10:16
  • @EldarSultanow Perfect! These were found by brute-force? Let me check if some belong the family above. Update: The first 20 belong to the family. I think all do. :( – Tito Piezas III Feb 09 '25 at 10:26
  • Understood - you want me to find those samples that do not belong to this family. Let me give another try. – Eldar Sultanow Feb 09 '25 at 10:33
  • 1
    @EldarSultanow Yes, please. If you have Mathematica, what I did was Factor[ Resultant [(p^4 - 9q^4)^2 - 64p^4q^4 - w1, 16p^2(p^4 - 9q^4) - w2, q ] ] and the first 20 had integer $p$. Set $q=1$, and they were the first 20 values of $p$. – Tito Piezas III Feb 09 '25 at 10:37
  • Ok - now get these solutions by avoiding the family you mentioned above (but there are equalities, I need to remove) - the process becomes computationally intensive: https://github.com/Sultanow/pythagorean/blob/main/python/near_solutions6.txt I'll fix this issue. – Eldar Sultanow Feb 09 '25 at 12:36
  • 1
    @EldarSultanow I looked at your newest data and, to prevent confusion, we should clarify some things. First, it is just FOUR positive integers $(w,x,y,z)$ with $\text{GCD}(w,x,y,z)=1$. Second, they should obey $0<w<x<y<z$. Third, System 2 in the post above should have 5 out of 6 equations satisfied. It seems the two quadruples by zwim, $$(w,x,y,z)=(448,952,1073,1105)\(w,x,y,z)=(952,975,1073,1105)$$ are the smallest that obey the three conditions. It got complicated because you were searching five terms $(w_1,w_2,x,y,z)$ when it was supposed to be only *four* $(w,x,y,z)$. – Tito Piezas III Feb 09 '25 at 14:17
  • I've made some progress. Please take a look into this data: https://github.com/Sultanow/pythagorean/blob/main/python/verified_solutions6.txt – Eldar Sultanow Feb 09 '25 at 22:18