taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.6-12

Exercise 1.2.6-12

proved in Lean solution written

RatingM22
MarkersM (mathematical)
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.6 of Volume 1. Companion chapter: Binomial coefficients

The task

Find all positive nn such that every nonzero entry of row nn of Pascal's triangle is odd.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Use Exercise 1.2.6-10 with p=2p = 2.

Hint 2

Compare the binary digits of kk and nn.

Solution

Show the solution

The answer is: exactly the numbers n=2m−1n = 2^m - 1, with m≥1m \ge 1.

By Exercise 1.2.6-10 (f) with p=2p = 2, (nk)≡∏i(aibi)(mod2)\binom{n}{k} \equiv \prod_i \binom{a_i}{b_i} \pmod 2 where ai,bi∈{0,1}a_i, b_i \in \{0, 1\} are the binary digits of nn and kk. Each factor (aibi)\binom{a_i}{b_i} is 11 if bi≤aib_i \le a_i and 00 if bi=1b_i = 1, ai=0a_i = 0. So (nk)\binom{n}{k} is odd exactly when every binary digit of kk is at most the digit of nn in the same place.

Assume n=2m−1n = 2^m - 1. Then nn has mm digits, all equal to 11. Every kk with 0≤k≤n0 \le k \le n has at most mm digits, so each digit of kk is at most 11, and (nk)\binom{n}{k} is odd for all such kk.

Assume nn is not of the form 2m−12^m - 1. Then the binary form of nn has a digit 00 below its leading digit, say at place ii, and the leading digit is at place t>it > i. Take k=2ik = 2^i. Then k<2t≤nk < 2^t \le n, so kk is in the row, but the digit of kk at place ii is 11 and that of nn is 00. So (nk)\binom{n}{k} is even.

Check

Rows 1,3,7,151, 3, 7, 15 are 1,11,1; 1,3,3,11,3,3,1; 1,7,21,35,35,21,7,11,7,21,35,35,21,7,1; the row 1515 has only odd entries, and the first values are 1,15,105,4551, 15, 105, 455. Row 22 is 1,2,11, 2, 1 and has an even entry, and 2+1=32 + 1 = 3 is not a power of 22. A direct test with nn up to 6969 finds exactly 1,3,7,15,31,631, 3, 7, 15, 31, 63.

Remarks

If nn has tt digits equal to 11 in binary, exactly 2t2^t entries of row nn are odd. This gives the self-similar pattern of the triangle modulo 22.

This solution is drafted, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.