Finding a Pythagorean triple $a^2 + b^2 = c^2$ with $a+b+c=40$ Let's say you're asked to find a Pythagorean triple $a^2 + b^2 = c^2$ such that $a + b + c = 40$. The catch is that the question is asked at a job interview, and you weren't expecting questions about Pythagorean triples.
It is trivial to look up the answer. It is also trivial to write a computer program that would find the answer. There is also plenty of material written about the properties of Pythagorean triples and methods for generating them. However, none of this would be of any help during a job interview.
How would you solve this in an interview situation?

$$a^2=(c-b)(c+b) \Rightarrow b+c = \frac{a^2}{c-b}$$
$$a+\frac{a^2}{c-b}=40$$
For simplicity let $c-b=\alpha$.
then 
$$a^2+\alpha a-40\alpha =0$$
Since this equation has integral solutions, 
$$\Delta=\alpha^2+160 \alpha$$
is a perfect square.Thus
$$\alpha^2+160 \alpha =\beta^2$$
Or
$$(\alpha+80)^2=\beta^2+80^2 \,.$$
This way we reduced the problem to finding all pytagorean triples of the type $(80, ??, ??)$. This can be easily done if you know the formula, or by setting
$$80^2=(\alpha+80-\beta)(\alpha+80+\beta)$$ and solving.
