HMMT-Nov 2014 guts, Problem 25

What is the smallest positive integer $n$ which cannot be written in any of the following forms? \begin{itemize} $n=1+2+\cdots+k$ for a positive integer $k$. $n=p^{k}$ for a prime number $p$ and integer $k$. $n=p+1$ for a prime number $p$. $n=p q$ for some distinct prime numbers $p$ and $q$ \end{itemize}

Solution: The first numbers which are neither of the form $p^{k}$ nor $p q$ are $12,18,20,24,28,30,36,40, \ldots$ Of these 12,18,20,24, 30 are of the form $p+1$ and 28, 36 are triangular. Hence the answer is 40. $\fbox{40}$.

Answer: 40