23. Katie writes a different positive integer on the top face of each of the fourteen cubes in the pyramid shown.
The sum of the nine integers written on the cubes in the bottom layer is 50. The integer written on each of the cubes in the middle and top layers of the pyramid is equal to the sum of the integers on the four cubes underneath it. What is the greatest possible integer that she can write on the top cube?
A 80
B 98
C 104
D 118
E 128
23. D Let the integers written on the small cubes in the bottom layer be arranged as shown. Hence, since the integers written on the cubes in the second and third layers are the sum of the integers on the four cubes underneath, the following is written on the cubes in the second layer.
Therefore the integer written on the top cube is
$$
\begin{array}{c}
(a+b+d+e)+(b+c+e+f)+(d+e+g+h)+(e+f+h+i) \\
=(a+b+c+d+e+f+g+h+i)+(b+d+f+h)+3 e .
\end{array}
$$

Since the sum of the integers on the bottom layer is 50 , the integer written on the top cube is equal to $50+(b+d+f+h)+3 e$. To maximise this, we first require $e$ to be as large as possible which will be obtained when the other eight integers are as small as possible. Therefore $e=50-(1+2+3+4+5+6+7+8)=14$.
Secondly, $(b+d+f+h)$ should now be made as large as possible and hence $b, d, f$ and $h$ are $5,6,7$ and 8 in any order. Therefore $(b+d+f+h)=5+6+7+8=26$. Hence the greatest possible integer she can write on the top cube is $50+26+3 \times 14=118$