Pythagoras had his leg blown up in the war. It had to be amputated, and though he nearly died, he pulled through and made a full recovery. Now, after a year of walking with crutches, he gets the privilege of getting a prosthetic leg! Thing is, though, there are several that fit, but which ones?
The Task
Given a positive integer as input that is the length of one leg of a Pythagorean triple, output all possibilities for the other leg. For example, the smallest Pythagorean triple is (3,4,5), which forms a triangle with two legs of length 3 and 4, and a hypotenuse of length 5.
Examples
Leg:5
12
Leg:28
21
45
96
195
Leg:101
5100
Leg:1001
168
468
660
2880
3432
4080
5460
6468
10200
38532
45540
71568
501000
The Rules
- Input will be a single positive integer
n
. - Output may be in any order, with any delimiter, in any base (though this base must be consistent), and with optional opening and closing braces, and optional trailing whitespace. That is,
1 2 3
,[1,2,3]
, and1,11,111
all fit this output specification. - You may assume that
n
will never be larger than one fourth of the fourth root of your language's limit (without using libraries). In practice, you may assume the input will be less than either this or 10,000, whichever is less.
Pythagoras is waiting on you, so better write your code quick and short!