Maths Olympiad Prep

Track / Stage 6 / 86 of 400 #1086 of 1964

Problem 1086

National olympiad, first round
Combinatorics Difficulty 6.1 Prove it

Let A(n)A(n) denote the number of sequences a1a2aka_{1} \geq a_{2} \geq \ldots \geq a_{k} of positive integers for which a1++ak=na_{1}+\cdots+a_{k}=n and each ai+1a_{i}+1 is a power of two (i=1,2,,k)(i=1,2, \ldots, k). Let B(n)B(n) denote the number of sequences b1b2bmb_{1} \geq b_{2} \geq \ldots \geq b_{m} of positive integers for which b1++bm=nb_{1}+\cdots+b_{m}=n and each inequality bj2bj+1b_{j} \geq 2 b_{j+1} holds (j=1,2,,m1)(j=1,2, \ldots, m-1).

Prove that A(n)=B(n)A(n)=B(n) for every positive integer nn.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Official solution

We say that a sequence a1a2aka_{1} \geq a_{2} \geq \ldots \geq a_{k} of positive integers has type AA if ai+1a_{i}+1 is a power of two for i=1,2,,ki=1,2, \ldots, k. We say that a sequence b1b2bmb_{1} \geq b_{2} \geq \ldots \geq b_{m} of positive integer has type BB if bj2bj+1b_{j} \geq 2 b_{j+1} for j=1,2,,m1j=1,2, \ldots, m-1.

Recall that the binary representation of a positive integer expresses it as a sum of distinct powers of two in a unique way. Furthermore, we have the following formula for every positive integer NN

2N1=2N1+2N2++21+20. 2^{N}-1=2^{N-1}+2^{N-2}+\cdots+2^{1}+2^{0} .

Given a sequence a1a2aka_{1} \geq a_{2} \geq \ldots \geq a_{k} of type AA, use the preceding formula to express each term as a sum of powers of two. Write these powers of two in left-aligned rows, in decreasing order of size. By construction, aia_{i} is the sum of the numbers in the ii th row. For example, we obtain the following array when we start with the type A sequence 15,15,7,3,3,3,115,15,7,3,3,3,1.

| 8 | 4 | 2 | 1 |
| :--- | :--- | :--- | :--- |
| 8 | 4 | 2 | 1 |
| 4 | 2 | 1 | |
| 2 | 1 | | |
| 2 | 1 | | |
| 2 | 1 | | |
| 1 | | | |
| 27 | 13 | 5 | 2 |

Define the sequence b1,b2,,bnb_{1}, b_{2}, \ldots, b_{n} by setting bjb_{j} to be the sum of the numbers in the jj th column of the array. For example, we obtain the sequence 27,13,5,2 from the array above. We now show that this new sequence has type B. This is clear from the fact that each column in the array contains at least as many entries as the column to the right of it and that each number larger than 1 in the array is twice the number to the right of it. Furthermore, it is clear that a1+a2++ak=b1+b2++bma_{1}+a_{2}+\cdots+a_{k}=b_{1}+b_{2}+\cdots+b_{m}, since both are equal to the sum of all the entries in the array.

We now show that we can do this operation backwards. Suppose that we are given a type B sequence b1b2bmb_{1} \geq b_{2} \geq \ldots \geq b_{m}. We construct an array inductively as follows:

- We fill bmb_{m} left-aligned rows with the numbers 2m1,2m2,,21,202^{m-1}, 2^{m-2}, \ldots, 2^{1}, 2^{0}.
- Then we fill bm12bmb_{m-1}-2 b_{m} left aligned rows with the numbers 2m2,2m3,,21,202^{m-2}, 2^{m-3}, \ldots, 2^{1}, 2^{0}.
- Then we fill bm22bm1b_{m-2}-2 b_{m-1} left aligned rows with the numbers 2m3,2m4,,21,202^{m-3}, 2^{m-4}, \ldots, 2^{1}, 2^{0}, and so on.
- In the last step we fill b12b2b_{1}-2 b_{2} left-aligned rows with the number 1.

For example, if we start with the type B sequence 27,13,5,227,13,5,2, we obtain once again the array above. We define the sequence a1,a2,,aka_{1}, a_{2}, \ldots, a_{k} by setting aia_{i} to be the sum of the numbers in the ii th row of the array. By construction, this sequence has type A. Furthermore, it is clear that a1++ak=b1++bma_{1}+\cdots+a_{k}=b_{1}+\cdots+b_{m}, since once again both sums are equal to the sum of all the entries in the array.

We have defined an operation that starts with a sequence of type A, produces an array whose row sums are given by the sequence, and outputs a sequence of type B corresponding to the column sums. We have also defined an operation that starts with a sequence of type B\mathrm{B}, produces an array whose column sums are given by the sequence, and outputs a sequence of type A corresponding to the row sums. The arrays produced in both cases comprise leftaligned rows of the form 2N1,2N2,,21,202^{N-1}, 2^{N-2}, \ldots, 2^{1}, 2^{0}, with non-increasing lengths. Let us refer to arrays obeying these properties as marvelous.

To show that these two operations are inverses of each other, it then suffices to prove that marvelous arrays are uniquely defined by either their row sums or their column sums. The former is obviously true and the latter arises from the observation that each step in the above inductive algorithm was forced in order to create a marvelous array with the prescribed column sums.

Thus, we have produced a bijection between the sequences of type A with sum nn and the sequences of type B\mathrm{B} with sum nn. So we can conclude that A(n)=B(n)A(n)=B(n) for every positive integer nn.

Remark The solution above provides a bijection between type A and type B sequences via an algorithm. There are alternative ways to provide such a bijection. For example, given the numbers a1aka_{1} \geq \ldots \geq a_{k} we may define the bib_{i} 's as

bj=iai+12j b_{j}=\sum_{i}\left\lfloor\frac{a_{i}+1}{2^{j}}\right\rfloor \text {. }

Conversely, given the numbers b1bmb_{1} \geq \ldots \geq b_{m}, one may define the aia_{i} 's by taking, as in the solution, bmb_{m} numbers equal to 2m1,bm12bm2^{m}-1, b_{m-1}-2 b_{m} numbers equal to 2m11,2^{m-1}-1, \ldots, and b12b2b_{1}-2 b_{2} numbers equal to 2112^{1}-1. One now needs to verify that these maps are mutually inverse.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.