How can I calculate the following expression?
$$\sum_{k=0}^{n} \left(_nC_k \mod 2 \right)$$
To clarify my question, what I am asking is
$$\text{The number of odd coefficients in }(1+x)^n$$
How can I calculate the following expression?
$$\sum_{k=0}^{n} \left(_nC_k \mod 2 \right)$$
To clarify my question, what I am asking is
$$\text{The number of odd coefficients in }(1+x)^n$$
As shown in this answer, $\binom{n}{k}\equiv1\pmod2$ precisely when adding $k$ and $n-k$ in base two incurs no carry; that is, $\sigma_2(n-k)+\sigma_2(k)=\sigma_2(n)$. That is precisely when $\operatorname{AND}(n,k)=k$, where $\operatorname{AND}$ is bitwise AND. Since $n$ has $\sigma_2(n)$ one bits in its binary representation, there are $2^{\sigma_2(n)}$ numbers $k$ so that $\operatorname{AND}(n,k)=k$; those numbers whose binary representation only has ones where $n$ has them.
For example, since $4=\color{#C00000}{1}00_{\text{two}}$, $$ \{\color{#C00000}{0}00_{\text{two}}, \color{#C00000}{1}00_{\text{two}}\}=\{0,4\} $$ is the set of $k$ so that $\binom{4}{k}$ is odd: $$ (1+x)^4=x^{\color{#C00000}{0}}+4x^1+6x^2+4x^3+x^{\color{#C00000}{4}} $$
For example, since $5=\color{#C00000}{1}0\color{#C00000}{1}_{\text{two}}$, $$ \{\color{#C00000}{0}0\color{#C00000}{0}_{\text{two}}, \color{#C00000}{0}0\color{#C00000}{1}_{\text{two}}, \color{#C00000}{1}0\color{#C00000}{0}_{\text{two}}, \color{#C00000}{1}0\color{#C00000}{1}_{\text{two}}\}=\{0,1,4,5\} $$ is the set of $k$ so that $\binom{5}{k}$ is odd: $$ (1+x)^5=x^{\color{#C00000}{0}}+5x^{\color{#C00000}{1}}+10x^2+10x^3+5x^{\color{#C00000}{4}}+x^{\color{#C00000}{5}} $$
For example, since $7=\color{#C00000}{111}_{\text{two}}$, $$ \{\color{#C00000}{000}_{\text{two}}, \color{#C00000}{001}_{\text{two}}, \color{#C00000}{010}_{\text{two}}, \color{#C00000}{011}_{\text{two}}, \color{#C00000}{100}_{\text{two}}, \color{#C00000}{101}_{\text{two}}, \color{#C00000}{110}_{\text{two}}, \color{#C00000}{111}_{\text{two}}\}=\{0,1,2,3,4,5,6,7\} $$ is the set of $k$ so that $\binom{7}{k}$ is odd: $$ (1+x)^7=x^{\color{#C00000}{0}}+7x^{\color{#C00000}{1}}+21x^{\color{#C00000}{2}}+35x^{\color{#C00000}{3}}+35x^{\color{#C00000}{4}}+21x^{\color{#C00000}{5}}+7x^{\color{#C00000}{6}}+x^{\color{#C00000}{7}} $$
Therefore, $$ \sum_{k=0}^n\binom{n}{k}\bmod2=2^{\sigma_2(n)} $$ where $\sigma_2(n)$ is the number of one bits in the binary representation of $n$.
As in any other ring: calculate $\;(1+1)^n$ in $\mathbf Z/2\mathbf Z$. Thee binomial formula is valid in any commutative ring.
Lucas' theorem is the key. The triangle of binomial coefficients $\!\!\pmod{2}$ looks like the Sierpinski gasket and the number of odd coefficients $\binom{n}{k}$ with $k\in\{0,1,\ldots,n\}$ can be computed through Kummer's theorem. Have a look also at OEISA001316 - Gould's sequence. The number of odd coefficients is, in fact, $2$ raised to the power:
$$\nu_2\left(\binom{2n}{n}\right)=\sum_{k\geq 1}\left(\left\lfloor\frac{2n}{2^k}\right\rfloor-2\left\lfloor\frac{n}{2^k}\right\rfloor\right).$$