H5. James chooses five different positive integers, each at most eight, so that their mean is equal to their median.
In how many different ways can he do this?
Solution
Since there are five different positive integers, the middle one is at least 3 . But the five numbers are at most 8 , so the middle one is at most 6 .

However, the middle value is the median of the numbers, which we are told is equal to the mean. Let the integers, in increasing order, be $a, b, c, d$ and $e$. Thus $c$ is the median and therefore the mean.

Because $c$ is the mean, $a+b+c+d+e=5 c$, and thus $(a+b)+(d+e)=4 c$. We know that $d+e$ is at most $7+8=15$, so that $a+b$ is at least $4 c-15$; also, $a+b$ is at most $(c-2)+(c-1)=2 c-3$.

For each value of $c$, we first list the possible values of $a+b$. From $a+b$ we find $d+e$.

Finally, we list the possible values of $a, b, d$ and $e$, using $0<a<b<c<d<e$. The following table shows the results.
\begin{tabular}{ccccccc}
\hline$c$ & $a+b$ & $d+e$ & $a$ & $b$ & $d$ & $e$ \\
\hline 3 & 3 & 9 & 1 & 2 & 4 & 5 \\
4 & 3 & 13 & 1 & 2 & 5 & 8 \\
& & & 1 & 2 & 6 & 7 \\
& 4 & 12 & 1 & 3 & 5 & 7 \\
& 5 & 11 & 2 & 3 & 5 & 6 \\
5 & 5 & 15 & 1 & 4 & 7 & 8 \\
& & & 2 & 3 & 7 & 8 \\
& 6 & 14 & 2 & 4 & 6 & 8 \\
& 7 & 13 & 3 & 4 & 6 & 7 \\
6 & 9 & 15 & 4 & 5 & 7 & 8 \\
\hline
\end{tabular}

So altogether there are 10 ways for James to choose the integers.