Given two pythagorean triples, generate another I don't know if this has been asked before, but I could not find any existing answer.
I noticed that for any pair of primitive pythagorean triples (not necessarily distinct), let's say:
a² + b² = c²
d² + e² = f²

Then there is at least another primitive triple where:
g² + h² = (cf)²

And there are 2 if the starting triples are distinct.
So, for example:
(3,4,5) and (5,12,13) -> (16, 63, 65) and (33, 56, 65)
(5,12,13) and (8,15,17) -> (21, 220, 221) and (140, 171, 221)
(3,4,5) (5,12,13) (8,15,17) -> (817,744,1105) (943,576,1105) (1073,264,1105) (1104,47,1105)
(3,4,5) and (3,4,5) -> (7,24,25)

I think there is an explanation for that, a property of pythagorean triples, or in general of diophantine equations.
Is it true in every case? Is there a way to calculate the two legs of the resulting triple(s)?

Given any pair of triples
\begin{align*}
A_1^2+B_1^2=C_1^2\\
A_2^2+B_2^2=C_2^2
\end{align*}
There are $\space 2^{n-1}\space$ other triples:
$\space A_3^2+B_3^2=(C_1\times C_2)^2=C_3^2\space$
where
$\space n\space$ is the number of distinct prime factors
$\space f\equiv 1 \pmod 4\space$ of
$\space C_3\space.\quad$
To find these, we begin with Euclid's formula
$\space A=m^2-k^2\quad B=2mk\quad C=m^2+k^2.\quad $
We solve the $\space C$-function for $\space k\space$ and test a defined range of $\space m$-values to see which yield integers.
$$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 \big\lfloor\sqrt{C-1}\big\rfloor$$
The lower limit ensures $m>k$ and the upper limit ensures $k\in\mathbb{N}$.
Take the example
\begin{align*}
15^2+8^2=17^2\\
21^2+20^2=29^2
\end{align*}
$$C=17\cdot29=493\implies \\
\bigg\lfloor\frac{ 1+\sqrt{986-1}}{2}\bigg\rfloor=16
 \le m \le 
\big\lfloor\sqrt{493-1}\big\rfloor=22\quad \\
\text{and we find} \quad
 m\in\{18,22\}\implies k\in\{13,3\}\\$$
$$F(18,13)=(155,468,493)\qquad F(22,3)=(475,132,493)\quad $$
