# Find exactly $3$ matching primitive Pythagorean triples for a given hypotenuse

I'm trying to find three Pythagorean triples $$\quad A^2+B^2=C^2 \quad\text{where}$$ $$A_1^2+B_1^2=A_2^2+B_2^2=A_3^2+B_3^2=C^2\quad \text{and} \\ A_1\ne A_2,\ne A_3\quad\land \quad B_1\ne B_2,\ne B_3$$

It is relatively easy to find Pythagorean triples for a given hypotenuse if we solve the C-function of Euclid's formula $$A=m^2-k^2,\quad B=2mk,\quad C=m^2+k^2\quad$$ for $$k$$ and test a range of m-values to see which yield integers. Here is an example using $$C=65$$.

$$\begin{equation} C=m^2+k^2\implies k=\sqrt{C-m^2}\qquad\\ \text{for}\qquad \bigg\lfloor\frac{ 1+\sqrt{2C-1}}{2}\bigg\rfloor \le m \le \lfloor\sqrt{C-1}\rfloor \end{equation}$$ The lower limit ensures $$m>k$$ and the upper limit ensures $$k\in\mathbb{N}$$.

$$C=65\implies \bigg\lfloor\frac{ 1+\sqrt{130-1}}{2}\bigg\rfloor=6 \le m \le \lfloor\sqrt{65-1}\rfloor=8\\ \quad\land \quad m\in\{7,8\}\Rightarrow k\in\{4,1\}\\$$ $$F(7,4)=(33,56,65)\qquad \qquad F(8,1)=(63,16,65)$$

I found $$67$$ C-values where $$\quad C=4n+1\space\text{ for }\space 81\le n\le 11925\quad$$ with $$3$$ matching triples each but, in all cases, one or more of the triples had $$\quad GCD(A,B,C)>1.\quad$$ I ran similar tests for 4-triples, 5-tiples, 6-triples and 7-triples but, in all [my admittedly limited] cases, only an even number of them were primitive.

Does there exist $$3$$ and only $$3$$ primitive triples with the same hypotenuse?

• What is the number of primitive triples in each case? How does this compare with the number of distinct odd prime factors of the hypotenuse? Can you discern a (nonlinear) correlation between these two functions? Given this correlation, can you ever get 3? Or 5 or 6? – Oscar Lanzi Jan 4 at 21:39
• In separate testing, I have found $1,2,3,4,5,6, or 7$ triples for a given C-value. For example C=325 yields these triples but only two are primitive. $$f(15,10)=(125,300,325)\quad f(17,6)=(253,204,325)\quad f(18,1)=(323,36,325)$$ – poetasis Jan 4 at 21:47
• How many primitive triples in each case? For $325$ you say there are two. And it factors as $5^2×13$. For $125$ you get only one. That has just the prime factor $5$. If you tested $1105=5×13×17$ I'll bet the house you got four primitive triples. And for $32045=5×13×17×29$ I "suspect" you'll get ... eight. – Oscar Lanzi Jan 4 at 21:52
• mathoverflow.net/questions/375295/… Check out my comment there. – individ Jan 5 at 6:06
• If $C=p^3$ where $p$ is a prime congruent $1$ mod $4$, then there exists $3$ triples with the same hypotenuse as follows. Let $p=a^2+b^2$. $C^2=(6a^5b-20a^3b^3+6ab^5)^2+(a^6-15a^4b^2+15a^2b^4-b^6)^2=(2ab^5+2a^5b+4a^3b^3)^2+(a^6-a^2b^4-b^6+a^4b^2)^2=(-4a^5b+4ab^5)^2+(a^6-5a^4b^2-5a^2b^4+b^6)^2$ However one of pairs have a common factor. – Tomita Jan 5 at 6:53

My conjecture is that there exist solutions only when $$C$$ is composed by $$4n+1$$-type primes and the number of primitive triples having $$C$$ as hypothenuse is $$2^{p-1}$$ where $$p$$ is the number of $$4n+1$$-type factors of $$C$$.
Exponents don't change the number of triples, i.e. $$5 \cdot 13^3\cdot 29^2$$ has the same number (four) of primitive triples as $$5\cdot 13\cdot 17$$.
• That is not a conjecture. It is a known fact. To get an idea of how the power of $2$ is proved, go to Gaussian integers and consider the products $(2\pm i)^2(3\pm 2i)$. Using all combinations of $\pm$ signs you get all primitive forms $a+bi$ where $a^2+b^2=5^2×13=325$. You have $2^2$ sign combinations but, since complex conjugate pairs have the same absolute values for $a$ and $b$, only half or $2^1$ are distinct triples. Can you generalize? – Oscar Lanzi Jan 4 at 22:32
• @OscarLanzi Thank you. And the fact that no triples exists if $C$ contains $4k+3$-like factors? – Raffaele Jan 4 at 22:36
• Can you find nonzero residues $\bmod 3$ whise squares sum to zero? If you can't, therecare no primitive tripleswhere the hypotenuse us a multiple of $3$, and this too can be generalized. – Oscar Lanzi Jan 4 at 23:16
• Finally there is the prime factor $2$. We have $1^2+1^2≡0\bmod2$ and $1±i|2$ in Gaussian integer, but no primitive triples. In the Gaussian integer theory, you have to square the compkex number $a+bi$ to actually get the legs of the triangle, and doing so with $1±i$ gives a zero real part which prevents a primitive triple for an even hypotenuse. It's connected with the fact that the complex conjugates $1±i$ are each a unit times the other, which us true if no other Gaussian-prime conjugate pair. – Oscar Lanzi Jan 4 at 23:27