Pythagoras' Other Leg
Jelly, 8 bytes

²R²+²Æ²O


This answer is non-competing, since it uses features that have been implemented after the challenge was posted. Try it online!

This approach does not use floating point math, so it will give the correct answer as long as the intervening lists can fit into memory.

Idea

If (a, b, c) is a Pythagorean triple, there are strictly positive integers k, m, n such that the set equality {a, b} = {km2 - kn2, 2kmn} holds.

In particular, this means that a &lt; b2 and b &lt; a2, so for input a we can simply check if a2 + b2 is a perfect square for each b in {1, &hellip; a2}.

Code

            Input: x

²           Compute x².
 R          Get get range 1 ... x².
  ²         Square each integer in that range.
   +²       Add x² to each resulting square.
     Æ²     Check if the resulting sums are perfect squares.
       O    Get all indices of ones.