Problem link: http://projecteuler.net/problem=9
A Pythagorean triplet is a set of three natural numbers, , for which,
For example, .
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
We have 3 variables a,b,c. So, We need at least 3 equations to solve them in constant time. But, we are given 2 equations: and . So, we combine these 2 equations and can get rid of c, , which will simplify to . Now we can iterate through all possible values of a and find the solution in linear time.