TITLE: Find the smallest positive integer which can be written as the sum of the squares of two positive integers in two different ways
QUESTION [7 upvotes]: Find the smallest positive integer which can be written as the sum of the squares of two positive integers in two different ways.

I took extremely long to solve this 
I got 
$50= 7^2 + 1^2 $
$50= 5^2 + 5 ^2 $ 
I did it with the trial and error method. 
I'm just curious if this came out during my exams, is there a quicker way to find the answer?

REPLY [4 votes]: I do wonder why it took so long... I added all pairs from the first ten squares on a piece of scrap paper in a few minutes. Maybe that's a long time. 
\begin{array}{c|c|c}
&& +1 & +4 & +9 & +16 &  +25 & +36 & +49 & +64 & +81 & +100  \\ \hline
1 && 2 \\ \hline
4 && 5 & 8\\ \hline
9 && 10 & 13 & 18 \\ \hline
16 && 17 & 20 & 25 & 32 \\ \hline
25 && 26 & 29 & 34 & 41 & \color{red}{50} \\ \hline
36 && 37 & 40 & 45 & 52 & 61 & 72 \\ \hline
49 && \color{red}{50} & 53 & 58 & \color{blue}{65} & 74 & \color{magenta}{85} & 98 \\ \hline
64 && \color{blue}{65} & 68 & 73 & 80 & 89 & 100 & 113 & 128 \\ \hline
81 && 82 & \color{magenta}{85} & 90 & 97 & 106 & 117 & 130 & 145 & 162 \\ \hline
100 && 101 & 104 & 109 & 116 & 125 & 136 & 149 & 164 & 181 & 200 \\ \hline
\end{array}
This also gives the first case when all the squares in question are distinct, at $65 = 8^2+1^2 = 7^2+4^2$