Exercise 18. Determine the number of sequences $a_{1}, \ldots, a_{100}$ of integers such that $a_{1} \leqslant a_{2} \leqslant$ $\cdots \leqslant a_{100}, a_{1}=1, a_{100}=4$, and such that there exist $m$ and $n$ satisfying $a_{m}=2$ and $a_{n}=3$.
Solution to Exercise 18: We take $k, m, n$ maximal such that $a_{k}=1, a_{m}=2$ and $a_{n}=3$. Then $1 \leqslant k<m<n \leqslant 99$, and the triplet $(k, m, n)$ determines the sequence. Consequently, the number sought is $\frac{99 \times 98 \times 97}{6}=156849$.