How can I find all Pythagorean triples $(a,b,c)$ such that the hypotenuse $c$ is a leg in another Pythagorean triple?
For example, $(3,4,5)$ is such a Pythagorean triple because the length of the hypotenuse for this right triangle is 5 and this length shows up as a leg in another Pythagorean triple $(5,12,13)$.
This is a lot easier than it looks like. It turns out that the answer is "all of them". Actually, every single number $n$ greater than $2$ appears as the leg of some pythagorean triangle. If $n$ is not a power of two, the following way works: First, assume $n$ is odd. Then $$\left( n,\frac{n^2 - 1}{2}, \frac{n^2 + 1}{2}\right)\quad \text{or} \quad \left(\frac{n^2 - 1}{2}, n, \frac{n^2 + 1}{2}\right) $$ is a Pythagorean triple. If $n$ is even, say $n = 2^km$ with $m\geq 3$ odd, then use the above on $m$, and scale the pythagorean triple you get by $2^k$.
If $n > 2$ is a power of $2$, use $(3, 4, 5)$ with appropriate scaling.