TITLE: Find all whole number solutions of the following equation
QUESTION [5 upvotes]: While training for a math olympiad(university level) I stumbled upon the following problem. Find all $n, k \in \mathbb{N}$ such that 
$${ n \choose 0 } + {n \choose 1}+{n \choose 2} + {n \choose 3} = 2^k.$$
Now I have thought about two ways of solving this. The first is by expanding the left hand side to get a polynomial in $n$, and by this finding restrictions on $n$ and $k$. The other way would be by repeatedly using Pascal's formula and the fact that 
$$2^j = \sum_{i=0}^j {j \choose i}$$
for all $j \in \mathbb{N}$. Both have not given me any success. Am I on a right track? Could you give me some hints, or an attempt at a solution?  Thanks in advance.

REPLY [5 votes]: Assume $n>3$.
Expanding the LHS and simplifying gives
$$\frac{1}{6}(n+1)(n^2-n+6) = 2^k.$$
So except for one factor of $3$, both $n+1$ and $n^2+n-6$ are powers of $2$. If the factor of $3$ is in $n+1$, then $n = 3\cdot 2^r-1$ with $r\ge 1$, so that
$$n^2+n-6 = (3\cdot 2^r-1)^2 - (3\cdot 2^r-1) + 6
     = 8 - 3\cdot 2^4 + 9\cdot 2^{2r} - 3\cdot 2^{r+1}
     = 8(1 - 2^{r-3} - 2^r + 2^{2r} + 2^{2r-3}).$$
In order for this to be a power of $2$, we must have $r=3$; otherwise the second factor is odd. $r=3$ gives $n = 3\cdot 2^3-1 = 23$.
Alternatively, the factor of $3$ is in $n^2-n+6$, so that $n+1 = 2^r$ is a power of $2$ with $r\ge 1$. But then
\begin{align*}
  n^2-n+6 &= (2^r-1)^2 - (2^r-1) + 6 = 2^{2r} - 3\cdot 2^r + 8 \\
    &= 9 -3\cdot 2^r + (2^{2r}-1) \\
    &= 9 - 3\cdot 2^r + 3(2^{2r-2}+2^{2r-4} + \ldots + 2^2 + 1) \\
    &= 12 - 3\cdot 2^r + 3(2^{2r-2}+2^{2r-4}+\ldots + 2^2) \\
    &= 3(4-2^r + 2^{2r-2}+2^{2r-4} + \ldots + 2^2) \\
    &= 24(1-2^{r-3}+2^{2r-5}+2^{2r-7}+\ldots+ 2),
\end{align*}
and in order for this to be $3$ times a power of $2$, we must again have $r=3$, so that $n = 2^3-1=7$.