exam: APMO

problem:
We call a 5-tuple of integers arrangeable if its elements can be labeled $a$, $b, c, d, e$ in some order so that $a-b+c-d+e=29$. Determine all 2017-tuples of integers $n_{1}, n_{2}, \ldots, n_{2017}$ such that if we place them in a circle in clockwise order, then any 5 -tuple of numbers in consecutive positions on the circle is arrangeable.

Answer: $n_{1}=\cdots=n_{2017}=29$.

solution:
A valid 2017-tuple is $n_{1}=\cdots=n_{2017}=29$. We will show that it is the only solution.

We first replace each number $n_{i}$ in the circle by $m_{i}:=n_{i}-29$. Since the condition $a-b+$ $c-d+e=29$ can be rewritten as $(a-29)-(b-29)+(c-29)-(d-29)+(e-29)=0$, we have that any five consecutive replaced integers in the circle can be labeled $a, b, c, d, e$ in such a way that $a-b+c-d+e=0$. We claim that this is possible only when all of the $m_{i}$ 's are 0 (and thus all of the original $n_{i}$ 's are 29).

We work with indexes modulo 2017. Notice that for every $i, m_{i}$ and $m_{i+5}$ have the same parity. Indeed, this follows from $m_{i} \equiv m_{i+1}+m_{i+2}+m_{i+3}+m_{i+4} \equiv m_{i+5}(\bmod 2)$. Since $\operatorname{gcd}(5,2017)=1$, this implies that all $m_{i}$ 's are of the same parity. Since $m_{1}+m_{2}+m_{3}+m_{4}+m_{5}$ is even, all $m_{i}$ 's must be even as well.

Suppose for the sake of contradiction that not all $m_{i}$ 's are zero. Then our condition still holds when we divide each number in the circle by 2 . However, by performing repeated divisions, we eventually reach a point where some $m_{i}$ is odd. This is a contradiction.

problem_match: Problem 1.

solution_match: Solution.


problem: Let $A B C$ be a triangle with $A B<A C$. Let $D$ be the intersection point of the internal bisector of angle $B A C$ and the circumcircle of $A B C$. Let $Z$ be the intersection point of the perpendicular bisector of $A C$ with the external bisector of angle $\angle B A C$. Prove that the midpoint of the segment $A B$ lies on the circumcircle of triangle $A D Z$.

solution:
. Let $N$ be the midpoint of $A C$. Let $M$ be the intersection point of the circumcircle of triangle $A D Z$ and the segment $A B$. We will show that $M$ is the midpoint of $A B$. To do this, let $D^{\prime}$ the reflection of $D$ with respect to $M$. It suffices to show that $A D B D^{\prime}$ is a parallelogram.

The internal and external bisectors of an angle in a triangle are perpendicular. This implies that $Z D$ is a diameter of the circumcircle of $A Z D$ and thus $\angle Z M D=90^{\circ}$. This means that $Z M$ is the perpendicular bisector of $D^{\prime} D$ and thus $Z D^{\prime}=Z D$. By construction, $Z$ is in the perpendicular bisector of $A C$ and thus $Z A=Z C$.

Now, let $\alpha$ be the angle $\angle B A D=\angle D A C$. In the cyclic quadrilateral $A Z D M$ we get $\angle M Z D=\angle M A D=\alpha$, and thus $\angle D^{\prime} Z D=2 \alpha$. By angle chasing we get

$$
\angle A Z N=90^{\circ}-\angle Z A N=\angle D A C=\alpha,
$$

which implies that $\angle A Z C=2 \alpha$. Therefore,

$$
\angle D^{\prime} Z A=\angle D^{\prime} Z D-\angle A Z D=2 \alpha-\angle A Z D=\angle A Z C-\angle A Z D=\angle D Z C .
$$

Combining $\angle D^{\prime} Z A=\angle D Z C, Z D^{\prime}=Z D$ and $Z A=Z C$, we obtain by the $S A S$ criterion that the triangles $D^{\prime} Z A$ and $D Z C$ are congruent. In particular, $D^{\prime} A=D C$ and $\angle D^{\prime} A Z=$ $\angle D C Z$. From here $D B=D C=D^{\prime} A$.

Finally, let $\beta=\angle A B C=\angle A D C$. We get the first of the following equalities by the sum of angles around point $A$ and the second one by the sum of internal angles of quadrilateral $A Z C D$

$$
\begin{aligned}
& 360^{\circ}=\angle D^{\prime} A Z+\angle Z A D+\angle D A B+\angle B A D^{\prime}=\angle D^{\prime} A Z+90^{\circ}+\alpha+\angle B A D^{\prime} \\
& 360^{\circ}=\angle D C Z+\angle Z A D+\angle C Z A+\angle A D C=\angle D C Z+90^{\circ}+2 \alpha+\beta
\end{aligned}
$$

By canceling equal terms we conclude that $\angle B A D^{\prime}=\alpha+\beta$. Also, $\angle A B D=\alpha+\beta$. Therefore, the segments $D^{\prime} A$ and $D B$ are parallel and have the same length. We conclude that $A D B D^{\prime}$ is a parallelogram. As the diagonals of a parallelogram intersect at their midpoints, we obtain that $M$ is the midpoint of $A B$ as desired.
![](https://cdn.mathpix.com/cropped/2024_11_22_ccb78644ce22f9d3e772g-2.jpg?height=989&width=1257&top_left_y=736&top_left_x=388)

Variant of solution. The solution above is indirect in the sense that it assumes that $M$ is in the circumcircle of $A Z D$ and then shows that $M$ is the midpoint of $A B$. We point out that the same ideas in the solution can be used to give a direct solution. Here we present a sketch on how to proceed in this manner.

Now we know that $M$ is the midpoint of the side $A B$. We construct the point $D^{\prime}$ in the same way. Now we have directly that $A D B D^{\prime}$ is a parallelogram and thus $D^{\prime} A=D B=D C$. By construction $Z A=Z C$. Also, the two sums of angles equal to $360^{\circ}$ in the previous solution let us conclude that $\angle D^{\prime} A Z=\angle D C Z$. Once again, we use (differently) the $S A S$ criterion and obtain that the triangles $D^{\prime} A Z$ and $D C Z$ are congruent. Thus, $D^{\prime} Z=D Z$.

We finish the problem by noting that $Z M$ is a median of the isosceles triangle $D^{\prime} Z D$, so it is also a perpendicular bisector. This shows that $\angle D M Z=90^{\circ}=\angle D A Z$, and therefore $M$ lies in the circumcircle of $D A Z$.

problem_match: Problem 2.

solution_match: Solution 1


solution:
. We proceed directly. As above, we name

$$
\alpha=\angle D A C=\angle A Z N=\angle C Z N=\angle D C B .
$$

Let $L$ be the midpoint of the segment $B C$. Since $M$ and $N$ are midpoints of $A B$ and $A C$, we have that $M N=C L$ and that the segment $M N$ is parallel to $B C$. Thus, $\angle A N M=\angle A C B$.

Therefore, $\angle Z N M=\angle A C B+90^{\circ}$. Also, $\angle D C Z=\angle D C B+\angle A C B+\angle Z C A=\angle A C B+90^{\circ}$. We conclude that $\angle Z N M=\angle D C Z$.

Now, the triangles $Z N C$ and $C L D$ are similar since $\angle D C L=90^{\circ}=\angle C N Z$ and $\angle D C L=$ $\alpha=\angle C Z N$. We use this fact to obtain the following chain of equalities

$$
\frac{C D}{M N}=\frac{C D}{C L}=\frac{C Z}{Z N}
$$

We combine the equality above with $\angle Z N M=\angle D C Z$ to conclude that the triangles $Z N M$ and $Z C D$ are similar. In particular, $\angle M Z N=\angle D Z C$ and $\frac{Z M}{Z N}=\frac{Z D}{Z C}$. Since we also have $\angle M Z D=\angle M Z N+\angle N Z D=\angle D Z C+\angle N Z D=\angle N Z C$, we conclude that the triangles $M Z D$ and $N Z C$ are similar. This yields that $\angle Z M D=90^{\circ}$ and therefore $M$ is in the circumcircle of triangle $D A Z$.

solution_match: Solution 2


solution:
. Let $m$ be the perpendicular bisector of $A D$; thus $m$ passes through the center $O$ of the circumcircle of triangle $A B C$. Since $A D$ is the internal angle bisector of $A$ and $O M$ and $O N$ are perpendicular to $A B$ and $A C$ respectively, we obtain that $O M$ and $O N$ form equal angles with $A D$. This implies that they are symmetric with respect to $M$.

Therefore, the line $M O$ passes through the point $Z^{\prime}$ symmetrical to $Z$ with respect to $m$. Since $\angle D A Z=90^{\circ}$, then also $\angle A D Z^{\prime}=90^{\circ}$. Moreover, since $A Z=D Z^{\prime}$, we have that $\angle A Z Z^{\prime}=\angle D Z^{\prime} Z=90^{\circ}$, so $A Z Z^{\prime} D$ is a rectangle. Since $\angle A M Z^{\prime}=\angle A M O=90^{\circ}$, we conclude that $M$ is in the circle with diameter $A Z^{\prime}$, which is the circumcircle of the rectangle. Thus $M$ lies on the circumcircle of the triangle $A D Z$.

solution_match: Solution 3


problem:
Let $A(n)$ denote the number of sequences $a_{1} \geq a_{2} \geq \ldots \geq a_{k}$ of positive integers for which $a_{1}+\cdots+a_{k}=n$ and each $a_{i}+1$ is a power of two $(i=1,2, \ldots, k)$. Let $B(n)$ denote the number of sequences $b_{1} \geq b_{2} \geq \ldots \geq b_{m}$ of positive integers for which $b_{1}+\cdots+b_{m}=n$ and each inequality $b_{j} \geq 2 b_{j+1}$ holds $(j=1,2, \ldots, m-1)$.

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

solution:
We say that a sequence $a_{1} \geq a_{2} \geq \ldots \geq a_{k}$ of positive integers has type $A$ if $a_{i}+1$ is a power of two for $i=1,2, \ldots, k$. We say that a sequence $b_{1} \geq b_{2} \geq \ldots \geq b_{m}$ of positive integer has type $B$ if $b_{j} \geq 2 b_{j+1}$ for $j=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 $N$

$$
2^{N}-1=2^{N-1}+2^{N-2}+\cdots+2^{1}+2^{0}
$$

Given a sequence $a_{1} \geq a_{2} \geq \ldots \geq a_{k}$ 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, $a_{i}$ is the sum of the numbers in the $i$ th row. For example, we obtain the following array when we start with the type A sequence $15,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 $b_{1}, b_{2}, \ldots, b_{n}$ by setting $b_{j}$ to be the sum of the numbers in the $j$ 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 $a_{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 $b_{1} \geq b_{2} \geq \ldots \geq b_{m}$. We construct an array inductively as follows:

- We fill $b_{m}$ left-aligned rows with the numbers $2^{m-1}, 2^{m-2}, \ldots, 2^{1}, 2^{0}$.
- Then we fill $b_{m-1}-2 b_{m}$ left aligned rows with the numbers $2^{m-2}, 2^{m-3}, \ldots, 2^{1}, 2^{0}$.
- Then we fill $b_{m-2}-2 b_{m-1}$ left aligned rows with the numbers $2^{m-3}, 2^{m-4}, \ldots, 2^{1}, 2^{0}$, and so on.
- In the last step we fill $b_{1}-2 b_{2}$ 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 $a_{1}, a_{2}, \ldots, a_{k}$ by setting $a_{i}$ to be the sum of the numbers in the $i$ th row of the array. By construction, this sequence has type A. Furthermore, it is clear that $a_{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, 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 $2^{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 $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 $a_{1} \geq \ldots \geq a_{k}$ we may define the $b_{i}$ 's as

$$
b_{j}=\sum_{i}\left\lfloor\frac{a_{i}+1}{2^{j}}\right\rfloor .
$$

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

problem_match: Problem 3.


problem:
Call a rational number $r$ powerful if $r$ can be expressed in the form $\frac{p^{k}}{q}$ for some relatively prime positive integers $p, q$ and some integer $k>1$. Let $a, b, c$ be positive
rational numbers such that $a b c=1$. Suppose there exist positive integers $x, y, z$ such that $a^{x}+b^{y}+c^{z}$ is an integer. Prove that $a, b, c$ are all powerful.

solution:
Let $a=\frac{a_{1}}{b_{1}}, b=\frac{a_{2}}{b_{2}}$, where $\operatorname{gcd}\left(a_{1}, b_{1}\right)=\operatorname{gcd}\left(a_{2}, b_{2}\right)=1$. Then $c=\frac{b_{1} b_{2}}{a_{1} a_{2}}$. The condition that $a^{x}+b^{y}+c^{z}$ is an integer becomes

$$
\frac{a_{1}^{x+z} a_{2}^{z} b_{2}^{y}+a_{1}^{z} a_{2}^{y+z} b_{1}^{x}+b_{1}^{x+z} b_{2}^{y+z}}{a_{1}^{z} a_{2}^{z} b_{1}^{x} b_{2}^{y}} \in \mathbb{Z}
$$

which can be restated as

$$
a_{1}^{z} a_{2}^{z} b_{1}^{x} b_{2}^{y} \mid a_{1}^{x+z} a_{2}^{z} b_{2}^{y}+a_{1}^{z} a_{2}^{y+z} b_{1}^{x}+b_{1}^{x+z} b_{2}^{y+z} .
$$

In particular, $a_{1}^{z}$ divides the right-hand side. Since it divides the first and second terms in the sum, we conclude that $a_{1}^{z} \mid b_{1}^{x+z} b_{2}^{y+z}$. Since $\operatorname{gcd}\left(a_{1}, b_{1}\right)=1$, we have $a_{1}^{z} \mid b_{2}^{y+z}$.

Let $p$ be a prime that divides $a_{1}$. Let $m, n \geq 1$ be integers such that $p^{n} \| a_{1}$ (i.e. $p^{n} \mid a_{1}$ but $\left.p^{n+1} \nmid a_{1}\right)$ and $p^{m} \| b_{2}$. The fact that $a_{1}^{z} \mid b_{2}^{y+z}$ implies $n z \leq m(y+z)$. Since $\operatorname{gcd}\left(a_{1}, b_{1}\right)=$ $\operatorname{gcd}\left(a_{2}, b_{2}\right)=1$, we have $p$ does not divide $b_{1}$ and does not divide $a_{2}$. Thus

$$
p^{n z} \| a_{1}^{z} a_{2}^{y+z} b_{1}^{x} \text { and } p^{m(y+z)} \| b_{1}^{x+z} b_{2}^{y+z}
$$

On the other hand, (1) implies that

$$
p^{n z+m y} \mid a_{1}^{z} a_{2}^{y+z} b_{1}^{x}+b_{1}^{x+z} b_{2}^{y+z} .
$$

If $n z<m(y+z)$, then (2) gives $p^{n z} \| a_{1}^{z} a_{2}^{y+z} b_{1}^{x}+b_{1}^{x+z} b_{2}^{y+z}$, which contradicts (3). Thus $n z=m(y+z)$ so $n$ is divisible by $k:=\frac{y+z}{\operatorname{gcd}(z, y+z)}>1$. Thus each exponent in the prime decomposition of $a_{1}$ must be divisible by $k$. Hence $a_{1}$ is a perfect $k$-power which means $a$ is powerful. Similarly, $b$ and $c$ are also powerful.

problem_match: Problem 4.


problem:
Let $n$ be a positive integer. A pair of $n$-tuples $\left(a_{1}, \ldots, a_{n}\right)$ and $\left(b_{1}, \ldots, b_{n}\right)$ with integer entries is called an exquisite pair if

$$
\left|a_{1} b_{1}+\cdots+a_{n} b_{n}\right| \leq 1
$$

Determine the maximum number of distinct $n$-tuples with integer entries such that any two of them form an exquisite pair.

Answer: The maximum is $n^{2}+n+1$.

solution:
First, we construct an example with $n^{2}+n+1 n$-tuples, each two of them forming an exquisite pair. In the following list, $*$ represents any number of zeros as long as the total number of entries is $n$.

- (*)
- $(*, 1, *)$
- $(*,-1, *)$
- $(*, 1, *, 1, *)$
- $(*, 1, *,-1, *)$

For example, for $n=2$ we have the tuples $(0,0),(0,1),(1,0),(0,-1),(-1,0),(1,1),(1,-1)$. The total number of such tuples is $1+n+n+\binom{n}{2}+\binom{n}{2}=n^{2}+n+1$. For any two of them, at most two of the products $a_{i} b_{i}$ are non-zero. The only case in which two of them are non-zero is when we take a sequence $(*, 1, *, 1, *)$ and a sequence $(*, 1, *,-1, *)$ with zero entries in the same places. But in this case one $a_{i} b_{i}$ is 1 and the other -1 . This shows that any two of these sequences form an exquisite pair.

Next, we claim that among any $n^{2}+n+2$ tuples, some two of them do not form an exquisite pair. We begin with lemma.

Lemma. Given $2 n+1$ distinct non-zero $n$-tuples of real numbers, some two of them $\left(a_{1}, \ldots, a_{n}\right)$ and $\left(b_{1}, \ldots, b_{n}\right)$ satisfy $a_{1} b_{1}+\cdots+a_{n} b_{n}>0$.

Proof of Lemma. We proceed by induction. The statement is easy for $n=1$ since for every three non-zero numbers there are two of them with the same sign. Assume that the statement is true for $n-1$ and consider $2 n+1$ tuples with $n$ entries. Since we are working with tuples of real numbers, we claim that we may assume that one of the tuples is $a=(0,0, \ldots, 0,-1)$. Let us postpone the proof of this claim for the moment.

If one of the remaining tuples $b$ has a negative last entry, then $a$ and $b$ satisfy the desired condition. So we may assume all the remaining tuples has a non-negative last entry. Now, from each tuple remove the last number. If two $n$-tuples $b$ and $c$ yield the same $(n-1)$-tuple, then

$$
b_{1} c_{1}+\cdots+b_{n-1} c_{n-1}+b_{n} c_{n}=b_{1}^{2}+\cdots+b_{n-1}^{2}+b_{n} c_{n}>0
$$

and we are done. The remaining case is that all the $n$-tuples yield distinct ( $n-1$ )-tuples. Then at most one of them is the zero $(n-1)$-tuple, and thus we can use the inductive hypothesis on $2 n-1$ of them. So we find $b$ and $c$ for which

$$
\left(b_{1} c_{1}+\cdots+b_{n-1} c_{n-1}\right)+b_{n} c_{n}>0+b_{n} c_{n}>0
$$

The only thing that we are left to prove is that in the inductive step we may assume that one of the tuples is $a=(0,0, \ldots, 0,-1)$. Fix one of the tuples $x=\left(x_{1}, \ldots, x_{n}\right)$. Set a real number $\varphi$ for which $\tan \varphi=\frac{x_{1}}{x_{2}}$. Change each tuple $a=\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ (including $x$ ), to the tuple

$$
\left(a_{1} \cos \varphi-a_{2} \sin \varphi, a_{1} \sin \varphi+a_{2} \cos \varphi, a_{3}, a_{4}, \ldots, a_{n}\right)
$$

A straightforward calculation shows that the first coordinate of the tuple $x$ becomes 0 , and that all the expressions of the form $a_{1} b_{1}+\cdots+a_{n} b_{n}$ are preserved. We may iterate this process until all the entries of $x$ except for the last one are equal to 0 . We finish by multiplying all the entries in all the tuples by a suitable constant that makes the last entry of $x$ equal to -1 . This preserves the sign of all the expressions of the form $a_{1} b_{1}+\cdots+a_{n} b_{n}$.

We proceed to the proof of our claim. Let $A$ be a set of non-zero tuples among which any two form an exquisite pair. It suffices to prove that $|A| \leq n^{2}+n$. We can write $A$ as a disjoint union of subsets $A_{1} \cup A_{2} \cup \ldots \cup A_{n}$, where $A_{i}$ is the set of tuples in $A$ whose last non-zero entry appears in the $i$ th position. We will show that $\left|A_{i}\right| \leq 2 i$, which will finish our proof since $2+4+\cdots+2 n=n^{2}+n$.

Proceeding by contradiction, suppose that $\left|A_{i}\right| \geq 2 i+1$. If $A_{i}$ has three or more tuples whose only non-zero entry is in the $i$ th position, then for two of them this entry has the same sign. Since the tuples are different and their entries are integers, this yields two tuples for which $\left|\sum a_{i} b_{i}\right| \geq 2$, a contradiction. So there are at most two such tuples. We remove them from $A_{i}$.

Now, for each of the remaining tuples $a$, if it has a positive $i$ th coordinate, we keep $a$ as it is. If it has a negative $i$ th coordinate, we replace it with the opposite tuple $-a$ with entries with opposite signs. This does not changes the exquisite pairs condition.

After making the necessary changes, we have two cases. The first case is that there are two tuples $a$ and $b$ that have the same first $i-1$ coordinates and thus

$$
a_{1} b_{1}+\cdots+a_{i-1} b_{i-1}=a_{1}^{2}+\cdots+a_{i-1}^{2}>0
$$

and thus is at least 1 (the entries are integers). The second case is that no two tuples have the same first $i-1$ coordinates, but then by the Lemma we find two tuples $a$ and $b$ for which

$$
a_{1} b_{1}+\cdots+a_{i-1} b_{i-1} \geq 1
$$

In any case, we obtain

$$
a_{1} b_{1}+\cdots+a_{i-1} b_{i-1}+a_{i} b_{i} \geq 2
$$

This yields a final contradiction to the exquisite pair hypothesis.

problem_match: Problem 5.