I am working on Project Euler's problem 9, which needs you to calculate the product of a pythagorean triplet which sums to 1000.
Therefore we have:
- $a < b < c$
- $c^2=a^2+b^2$
- $a+b+c=1000$
I was wondering if there is a way to find an upper bound for $c$, not in terms of $a$ or $b$.
$$a+b+c = 1000$$ $$a^2 + b^2 + c^2 +2ab +2bc + 2ac = 1000000$$ $$ 2c^2 +2ab + 2(a+b)c = 1000000$$ $$c^2 + ab + (1000-c)c = 500000$$ $$ab + 1000c = 500000$$ $$c = 500 - \frac{ab}{1000}$$
So $$c < 500$$ is given.
Now, can we do better? Well we know from (1) that $ab < ac < c^2 < 250000$ so we also know $c>250$, so we're pretty close to the actual upper bound.