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-56

Exercise 1.2.6-56

proved in Lean solution written

Rating20
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

Write each nn from 00 to 2020 as (a3)+(b2)+(c1)\binom{a}{3} + \binom{b}{2} + \binom{c}{1} with a>b>c≥0a > b > c \ge 0.

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

Take the largest aa with (a3)≤n\binom{a}{3} \le n, then handle the remainder in the same way with (b2)\binom{b}{2}.

Hint 2

Show that b<ab < a follows from the choice of aa.

Solution

Show the solution

Greedy method. Choose aa as the largest number with (a3)≤n\binom{a}{3} \le n. Let n1=n−(a3)n_1 = n - \binom{a}{3}. Choose bb as the largest number with (b2)≤n1\binom{b}{2} \le n_1, and let c=n1−(b2)c = n_1 - \binom{b}{2}.

Why this works and gives a>b>ca > b > c: by the choice of aa, n<(a+13)=(a3)+(a2)n < \binom{a+1}{3} = \binom{a}{3} + \binom{a}{2}, so n1<(a2)n_1 < \binom{a}{2}, and b<ab < a. Likewise c<(b+12)−(b2)=bc < \binom{b+1}{2} - \binom{b}{2} = b. And the triple is unique, because any triple with a>b>c≥0a > b > c \ge 0 has (b2)+c≤(a−12)+(a−2)=(a2)−1\binom{b}{2} + c \le \binom{a-1}{2} + (a-2) = \binom{a}{2} - 1, so (a3)≤n<(a+13)\binom{a}{3} \le n < \binom{a+1}{3} fixes aa, and the same argument fixes bb and then cc. For small nn take a≥2a \ge 2, b≥1b \ge 1, c≥0c \ge 0, so that the value 00 is (2,1,0)(2,1,0).

The triples (a,b,c)(a,b,c) for n=0,1,…,20n = 0, 1, \ldots, 20 are 210, 310, 320, 321, 410, 420, 421, 430, 431, 432, 510, 520, 521, 530, 531, 532, 540, 541, 542, 543, 610.210,\ 310,\ 320,\ 321,\ 410,\ 420,\ 421,\ 430,\ 431,\ 432,\ 510,\ 520,\ 521,\ 530,\ 531,\ 532,\ 540,\ 541,\ 542,\ 543,\ 610.

Check

For n=13n = 13: (53)+(32)+(01)=10+3+0=13\binom{5}{3} + \binom{3}{2} + \binom{0}{1} = 10 + 3 + 0 = 13. For n=19n = 19: 10+6+3=1910 + 6 + 3 = 19. For n=20n = 20: (63)+(12)+0=20\binom{6}{3} + \binom{1}{2} + 0 = 20. A program check shows that all 2121 triples satisfy a>b>c≥0a > b > c \ge 0 and give nn.

Remarks

Every natural number has exactly one such representation with any fixed number of terms. This is the combinatorial number system. It orders the 33-subsets of the naturals, as {a,b,c}\{a,b,c\} with a>b>ca > b > c.

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.