TITLE: Binomial coefficients are odd if and only if $n = 2^k-1$
QUESTION [6 upvotes]: Let $n$ be an integer, $n > 0$. Prove that all the coefficients of the expansion of the Newtonian binomial $(a+b)^n$ are odd if and only if $n$ is of the form $2^k-1$.

Why in the solution below do they take $n > 8$? Also, I don't get the middle paragraph argument about $n_1$. What do those values represent using $n_1$?
Solution:
For $n \leq 8$ the theorem is immediately verifiable. It is therefore sufficient to assume that the theorem is true for the binomials $a+b,(a+b)^2,\ldots,(a+b)^{n-1}$ for $n > 8$, and prove that the theorem holds for $(a+b)^n$. The coefficients of the binomial expansion (except for the extreme ones both equal to $1$) are $$\dfrac{n}{1}, \dfrac{n(n-1)}{1 \cdot 2},\ldots,\dfrac{n(n-1) \cdots 1}{1 \cdot 2 \cdots (n-1)}.$$ A necessary and sufficient condition in order that all these numbers be odd is that $n$ is odd and the numbers obtained by deleting the odd factors from the numerators and denominators of the remaining numbers be odd.
But setting $n = 2n_1+1$ these numbers can be represented by the terms of the sequence $$\dfrac{n_1}{1},\dfrac{n_1(n_1-1)}{1 \cdot 2}, \ldots, \dfrac{n_1(n_1-1) \cdots 1}{1 \cdot 2 \cdots (n_1-1)}.$$ Since $n_1 < n$, the latter are all odd if and only if $n_1$ is of the form $2^k-1$, i.e. if and only if $n$ is of the form $2(2^k-1)+1 = 2^{k+1}-1$.

REPLY [2 votes]: Counting the Number of Factors of $\boldsymbol{2}$
In Corollary $(7)$ of this answer, it is shown that the number of factors of $p$ in $\binom{n}{j}$ is
$$
\frac{\sigma_p(j)+\sigma_p(n-j)-\sigma_p(n)}{p-1}\tag{1}
$$
where $\sigma_p(n)$ us the sum of the digits in the base-$p$ representation of $n$. This is the number of carries performed when adding $j$ and $n-j$.

$\boldsymbol{n=2^k-1}$
If $n=2^k-1$, in base-$2$, each digit of $n$ is a $1$. For $0\le j\le n$, each digit of $j$ that is a $0$ is a $1$ in $n-j$ and vice-versa. Thus, $\sigma_p(j)+\sigma_p(n-j)=\sigma_p(n)$. Therefore, formula $(1)$ says that there are $0$ factors of $2$ in $\binom{n}{j}$.
That is, $\binom{n}{j}$ is odd.

$\boldsymbol{n\ne2^k-1}$
If the binary representation of $n$ is not all $1$s, then there must be a section of the binary representation consisting of '$10$'. Let $j$ have the same binary representation except with that section replaced by '$01$'. The binary representation of $n-j$ has a '$01$' in that section and $0$s everywhere else. Since there is a binary carry when adding $j$ and $n-j$ (that is, there is a carry when adding $1+1=10$), there is at least one factor of $2$ in $\binom{n}{j}$.
That is, $\binom{n}{j}$ is even.