Maths WorkshopMaths problems with full solutions
Exercise 1334Number theory › CongruencesOlympiadAdded 5 Nov 2026

Counting odd entries in a row of Pascal's triangle

#binomial coefficients#parity#binary expansion#generating function

Statement

Let s(n)s(n) be the number of ones in the binary expansion of nn. Prove that exactly 2s(n)2^{s(n)} of the numbers (n0),(n1),…,(nn)\binom n0,\binom n1,\dots,\binom nn are odd.

Hint

Work with polynomials modulo 22. Why is (1+x)2i≡1+x2i(mod2)(1+x)^{2^i}\equiv1+x^{2^i}\pmod 2?

Show solutionHide solution

Solution

Idea. The coefficients of (1+x)n(1+x)^n are the binomial coefficients; reducing modulo 22 turns the expansion into a product of very simple factors.

Frobenius step. Modulo 22, (1+x)2=1+2x+x2≡1+x2(1+x)^2=1+2x+x^2\equiv1+x^2. Repeating, (1+x)2i≡(1+x2i)(1+x)^{2^i}\equiv(1+x^{2^i}) for all i≥0i\ge0.

Factorising. Write n=∑i∈S2in=\sum_{i\in S}2^i with SS the set of positions of ones in the binary expansion, so ∣S∣=s(n)|S|=s(n). Then
(1+x)n=∏i∈S(1+x)2i≡∏i∈S(1+x2i)=∑T⊆Sx∑i∈T2i(mod2).(1+x)^n=\prod_{i\in S}(1+x)^{2^i}\equiv\prod_{i\in S}\left(1+x^{2^i}\right)=\sum_{T\subseteq S}x^{\sum_{i\in T}2^i}\pmod2.

Counting. The exponents ∑i∈T2i\sum_{i\in T}2^i for different subsets T⊆ST\subseteq S are pairwise different. So the right side is a sum of 2∣S∣2^{|S|} distinct monomials with coefficient 11, and every other coefficient is 00 modulo 22. Thus exactly 2s(n)2^{s(n)} coefficients (nk)\binom nk are odd.

Check. n=6=1102n=6=110_2: row 1,6,15,20,15,6,11,6,15,20,15,6,1 has 4=224=2^2 odd entries.

Remark. In particular the whole row consists of odd numbers iff n=2j−1n=2^j-1.

Lesson. Reduce a polynomial identity modulo a prime and use (1+x)p≡1+xp(1+x)^p\equiv1+x^p; binary expansions turn (1+x)n(1+x)^n into a product.