# Solution APMO 2017 ( Number 3)

**Solution APMO 2017 ( Number 3)**

**Problem 3. **

Let A(n) denote the number of sequences of positive integers for which and each is a power of two (i = 1, 2, . . . , k). Let B(n) denote the number of sequences of positive integers for which and each inequality holds (j = 1, 2, . . . , m − 1). Prove that A(n) = B(n) for every positive integer n.

Also Read:

**Also Read :**

**Solution APMO 2017 Number 1****Solution APMO 2017 Number 2****Solution APMO 2017 Number 3**- Solution APMO 2017 Number 4
**Solution APMO 2017 Number 5**

**Solution : **

We say that a sequence of positive integers has type A if is a power of two for i = 1, 2, . . . , k. We say that a sequence of positive integer has type B if for j = 1, 2, . . . , 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 N

.

Given a sequence of type A, 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, ai is the sum of the numbers in the ith row. For example, we obtain the following array when we start with the type A sequence 15, 15, 7, 3, 3, 3, 1.

Define the sequence by setting to be the sum of the numbers in the jth 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 , 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 . We construct an array inductively as follows:

- We fill left-aligned rows with the numbers
- Then we fill left aligned rows with the numbers
- Then we fill left aligned rows with the numbers and the so on.
- In the last step we fill left aligned rows with the number 1.

For example, if we start with the type B sequence 27, 13, 5, 2, we obtain once again the array above. We define the sequence by setting to be the sum of the numbers in the ith row of the array. By construction, this sequence has type A. Furthermore, it is clear that , 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, 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 left- aligned rows of the form ,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 n and the sequences of type B with sum n. So we can conclude that A(n) = B(n) for every positive integer n.

**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 we may define the as

Conversely, given the numbers , one may define the by taking, as in the solution, numbers equal to numbers equal to ,…, and number equal to . One now needs to verify that these maps are mutually inverse.