21. N3 (BUL) A finite sequence of integers $a_{0}, a_{1}, \ldots, a_{n}$ is called quadratic if for each $i \in\{1,2, \ldots, n\}$ we have the equality $\left|a_{i}-a_{i-1}\right|=i^{2}$. (a) Prove that for any two integers $b$ and $c$, there exist a natural number $n$ and a quadratic sequence with $a_{0}=b$ and $a_{n}=c$. (b) Find the smallest natural number $n$ for which there exists a quadratic sequence with $a_{0}=0$ and $a_{n}=1996$.

Solution: 21. (a) It clearly suffices to show that for every integer $c$ there exists a quadratic sequence with $a_{0}=0$ and $a_{n}=c$, i.e., that $c$ can be expressed as $\pm 1^{2} \pm 2^{2} \pm \cdots \pm n^{2}$. Since  $$ (n+1)^{2}-(n+2)^{2}-(n+3)^{2}+(n+4)^{2}=4 $$  we observe that if our claim is true for $c$, then it is also true for $c \pm 4$. Thus it remains only to prove the claim for $c=0,1,2,3$. But one immediately finds $1=1^{2}, 2=-1^{2}-2^{2}-3^{2}+4^{2}$, and $3=-1^{2}+2^{2}$, while the case $c=0$ is trivial. (b) We have $a_{0}=0$ and $a_{n}=1996$. Since $a_{n} \leq 1^{2}+2^{2}+\cdots+n^{2}=$ $\frac{1}{6} n(n+1)(2 n+1)$, we get $a_{17} \leq 1785$, so $n \geq 18$. On the other hand, $a_{18}$ is of the same parity as $1^{2}+2^{2}+\cdots+18^{2}=2109$, so it cannot be equal to 1996. Therefore we must have $n \geq 19$. To construct a required sequence with $n=19$, we note that $1^{2}+2^{2}+\cdots+19^{2}=$ $2470=1996+2 \cdot 237$; hence it is enough to write 237 as a sum of distinct squares. Since $237=14^{2}+5^{2}+4^{2}$, we finally obtain  $$ 1996=1^{2}+2^{2}+3^{2}-4^{2}-5^{2}+6^{2}+\cdots+13^{2}-14^{2}+15^{2}+\cdots+19^{2} $$


22. N4 (BUL) Find all positive integers $a$ and $b$ for which  $$ \left[\frac{a^{2}}{b}\right]+\left[\frac{b^{2}}{a}\right]=\left[\frac{a^{2}+b^{2}}{a b}\right]+a b $$  where as usual, $[t]$ refers to greatest integer that is less than or equal to $t$.

Solution: 22. Let $a, b \in \mathbb{N}$ satisfy the given equation. It is not possible that $a=b$ (since it leads to $a^{2}+2=2 a$ ), so we assume w.l.o.g. that $a>b$. Next, for $a>b=1$ the equation becomes $a^{2}=2 a$, and one obtains a solution $(a, b)=(2,1)$. Let $b>1$. If $\left[\frac{a^{2}}{b}\right]=\alpha$ and $\left[\frac{b^{2}}{a}\right]=\beta$, then we trivially have $a b \geq$ $\alpha \beta$. Since also $\frac{a^{2}+b^{2}}{a b} \geq 2$, we obtain $\alpha+\beta \geq \alpha \beta+2$, or equivalently $(\alpha-1)(\beta-1) \leq-1$. But $\alpha \geq 1$, and therefore $\beta=0$. It follows that $a>b^{2}$, i.e., $a=b^{2}+c$ for some $c>0$. Now the given equation becomes $b^{3}+2 b c+\left[\frac{c^{2}}{b}\right]=\left[\frac{b^{4}+2 b^{2} c+b^{2}+c^{2}}{b^{3}+b c}\right]+b^{3}+b c$, which reduces to  $$ (c-1) b+\left[\frac{c^{2}}{b}\right]=\left[\frac{b^{2}(c+1)+c^{2}}{b^{3}+b c}\right] $$  If $c=1$, then (1) always holds, since both sides are 0 . We obtain a family of solutions $(a, b)=\left(n, n^{2}+1\right)$ or $(a, b)=\left(n^{2}+1, n\right)$. Note that the solution $(1,2)$ found earlier is obtained for $n=1$. If $c>1$, then $(1)$ implies that $\frac{b^{2}(c+1)+c^{2}}{b^{3}+b c} \geq(c-1) b$. This simplifies to  $$ c^{2}\left(b^{2}-1\right)+b^{2}\left(c\left(b^{2}-2\right)-\left(b^{2}+1\right)\right) \leq 0 $$  Since $c \geq 2$ and $b^{2}-2 \geq 0$, the only possibility is $b=2$. But then (2) becomes $3 c^{2}+8 c-20 \leq 0$, which does not hold for $c \geq 2$. Hence the only solutions are $\left(n, n^{2}+1\right)$ and $\left(n^{2}+1, n\right), n \in \mathbb{N}$.


23. N5 (ROM) Let $\mathbb{N}_{0}$ denote the set of nonnegative integers. Find a bijective function $f$ from $\mathbb{N}_{0}$ into $\mathbb{N}_{0}$ such that for all $m, n \in \mathbb{N}_{0}$,  $$ f(3 m n+m+n)=4 f(m) f(n)+f(m)+f(n) . $$

Solution: 23. We first observe that the given functional equation is equivalent to  $$ 4 f\left(\frac{(3 m+1)(3 n+1)-1}{3}\right)+1=(4 f(m)+1)(4 f(n)+1) . $$  This gives us the idea of introducing a function $g: 3 \mathbb{N}_{0}+1 \rightarrow 4 \mathbb{N}_{0}+1$ defined as $g(x)=4 f\left(\frac{x-1}{3}\right)+1$. By the above equality, $g$ will be multiplicative, i.e.,  $$ g(x y)=g(x) g(y) \quad \text { for all } x, y \in 3 \mathbb{N}_{0}+1 $$  Conversely, any multiplicative bijection $g$ from $3 \mathbb{N}_{0}+1$ onto $4 \mathbb{N}_{0}+1$ gives us a function $f$ with the required property: $f(x)=\frac{g(3 x+1)-1}{4}$. It remains to give an example of such a function $g$. Let $P_{1}, P_{2}, Q_{1}, Q_{2}$ be the sets of primes of the forms $3 k+1,3 k+2,4 k+1$, and $4 k+3$, respectively. It is well known that these sets are infinite. Take any bijection $h$ from $P_{1} \cup P_{2}$ onto $Q_{1} \cup Q_{2}$ that maps $P_{1}$ bijectively onto $Q_{1}$ and $P_{2}$ bijectively onto $Q_{2}$. Now define $g$ as follows: $g(1)=1$, and for $n=p_{1} p_{2} \cdots p_{m}\left(p_{i}\right.$ 's need not be different) define $g(n)=h\left(p_{1}\right) h\left(p_{2}\right) \cdots h\left(p_{m}\right)$. Note that $g$ is well-defined. Indeed, among the $p_{i}$ 's an even number are of the form $3 k+2$, and consequently an even number of $h\left(p_{i}\right) \mathrm{s}$ are of the form $4 k+3$. Hence the product of the $h\left(p_{i}\right)$ 's is of the form $4 k+1$. Also, it is obvious that $g$ is multiplicative. Thus, the defined $g$ satisfies all the required properties.


24. C1 (FIN) ${ }^{\mathrm{IMO} 1}$ We are given a positive integer $r$ and a rectangular board $A B C D$ with dimensions $|A B|=20,|B C|=12$. The rectangle is divided into a grid of $20 \times 12$ unit squares. The following moves are permitted on the board: One can move from one square to another only if the distance between the centers of the two squares is $\sqrt{r}$. The task is to find a sequence of moves leading from the square corresponding to vertex $A$ to the square corresponding to vertex $B$. (a) Show that the task cannot be done if $r$ is divisible by 2 or 3 . (b) Prove that the task is possible when $r=73$. (c) Is there a solution when $r=97$ ?

Solution: 24. We shall work on the array of lattice points defined by $\mathcal{A}=\left\{(x, y) \in \mathbb{Z}^{2} \mid\right.$ $0 \leq x \leq 19,0 \leq y \leq 11\}$. Our task is to move from $(0,0)$ to $(19,0)$ via the points of $\mathcal{A}$ so that each move has the form $(x, y) \rightarrow(x+a, y+b)$, where $a, b \in \mathbb{Z}$ and $a^{2}+b^{2}=r$. (a) If $r$ is even, then $a+b$ is even whenever $a^{2}+b^{2}=r(a, b \in \mathbb{Z})$. Thus the parity of $x+y$ does not change after each move, so we cannot reach $(19,0)$ from $(0,0)$. If $3 \mid r$, then both $a$ and $b$ are divisible by 3 , so if a point $(x, y)$ can be reached from $(0,0)$, we must have $3 \mid x$. Since $3 \nmid 19$, we cannot get to $(19,0)$. (b) We have $r=73=8^{2}+3^{2}$, so each move is either $(x, y) \rightarrow(x \pm 8, y \pm 3)$ or $(x, y) \rightarrow(x \pm 3, y \pm 8)$. One possible solution is shown in Fig. 1. (c) We have $97=9^{2}+4^{2}$. Let us partition $\mathcal{A}$ as $\mathcal{B} \cup \mathcal{C}$, where $\mathcal{B}=$ $\{(x, y) \in \mathcal{A} \mid 4 \leq y \leq 7\}$. It is easily seen that moves of the type $(x, y) \rightarrow(x \pm 9, y \pm 4)$ always take us from the set $\mathcal{B}$ to $\mathcal{C}$ and vice versa, while the moves $(x, y) \rightarrow(x \pm 4, y \pm 9)$ always take us from $\mathcal{C}$ to $\mathcal{C}$. Furthermore, each move of the type $(x, y) \rightarrow(x \pm 9, y \pm 4)$ changes the parity of $x$, so to get from $(0,0)$ to $(19,0)$ we must have an odd number of such moves. On the other hand, with an odd number of such moves, starting from $\mathcal{C}$ we can end up only in $\mathcal{B}$, although the point $(19,0)$ is not in $\mathcal{B}$. Hence, the answer is no. Remark. Part (c) can also be solved by examining all cells that can be reached from $(0,0)$. All these cells are marked in Fig. 2. ![](https://cdn.mathpix.com/cropped/2024_11_18_8e985d6b9c83aa3e9d0eg-623.jpg?height=259&width=420&top_left_y=1081&top_left_x=289)  Fig. 1 ![](https://cdn.mathpix.com/cropped/2024_11_18_8e985d6b9c83aa3e9d0eg-623.jpg?height=256&width=414&top_left_y=1083&top_left_x=886)  Fig. 2


25. C2 (UKR) An $(n-1) \times(n-1)$ square is divided into $(n-1)^{2}$ unit squares in the usual manner. Each of the $n^{2}$ vertices of these squares is to be colored red or blue. Find the number of different colorings such that each unit square has exactly two red vertices. (Two coloring schemes are regarded as different if at least one vertex is colored differently in the two schemes.)

Solution: 25. Let the vertices in the bottom row be assigned an arbitrary coloring, and suppose that some two adjacent vertices receive the same color. The number of such colorings equals $2^{n}-2$. It is easy to see that then the colors of the remaining vertices get fixed uniquely in order to satisfy the requirement. So in this case there are $2^{n}-2$ possible colorings. Next, suppose that the vertices in the bottom row are colored alternately red and blue. There are two such colorings. In this case, the same must hold for every row, and thus we get $2^{n}$ possible colorings. It follows that the total number of considered colorings is $\left(2^{n}-2\right)+2^{n}=$ $2^{n+1}-2$.


26. C3 (USA) Let $k, m, n$ be integers such that $1<n \leq m-1 \leq k$. Determine the maximum size of a subset $S$ of the set $\{1,2,3, \ldots, k\}$ such that no $n$ distinct elements of $S$ add up to $m$.

Solution: 26. Denote the required maximum size by $M_{k}(m, n)$. If $m<\frac{n(n+1)}{2}$, then trivially $M=k$, so from now on we assume that $m \geq \frac{n(n+1)}{2}$. First we give a lower bound for $M$. Let $r=r_{k}(m, n)$ be the largest integer such that $r+(r+1)+\cdots+(r+n-1) \leq m$. This is equivalent to $n r \leq m-\frac{n(n-1)}{2} \leq n(r+1)$, so $r=\left[\frac{m}{n}-\frac{n-1}{2}\right]$. Clearly no $n$ elements from $\{r+1, r+2, \ldots, k\}$ add up to $m$, so  $$ M \geq k-r_{k}(m, n)=k-\left[\frac{m}{n}-\frac{n-1}{2}\right] . $$  We claim that $M$ is actually equal to $k-r_{k}(m, n)$. To show this, we shall prove by induction on $n$ that if no $n$ elements of a set $S \subseteq\{1,2, \ldots, k\}$ add up to $m$, then $|S| \leq k-r_{k}(m, n)$. For $n=2$ the claim is true, because then for each $i=1, \ldots, r_{k}(m, 2)=$ $\left[\frac{m-1}{2}\right]$ at least one of $i$ and $m-i$ must be excluded from $S$. Now let us assume that $n>2$ and that the result holds for $n-1$. Suppose that $S \subseteq\{1,2, \ldots, k\}$ does not contain $n$ distinct elements with the sum $m$, and let $x$ be the smallest element of $S$. We may assume that $x \leq r_{k}(m, n)$, because otherwise the statement is clear. Consider the set $S^{\prime}=\{y-x \mid$ $y \in S, y \neq x\}$. Then $S^{\prime}$ is a subset of $\{1,2, \ldots, k-x\}$ no $n-1$ elements of which have the sum $m-n x$. Also, it is easily checked that $n-1 \leq$ $m-n x-1 \leq k-x$, so we may apply the induction hypothesis, which yields that  $$ |S| \leq 1+k-x-r_{k}(m-n x, n-1)=k-\left[\frac{m-x}{n-1}-\frac{n}{2}\right] . $$  On the other hand, $\left(\frac{m-x}{n-1}-\frac{n}{2}\right)-r_{k}(m, n)=\frac{m-n x-\frac{n(n-1)}{2}}{n(n-1)} \geq 0$ because $x \leq r_{k}(m, n)$; hence (2) implies $|S| \leq k-r_{k}(m, n)$ as claimed.


27. C4 (FIN) Determine whether or not there exist two disjoint infinite sets $\mathcal{A}$ and $\mathcal{B}$ of points in the plane satisfying the following conditions: (i) No three points in $\mathcal{A} \cup \mathcal{B}$ are collinear, and the distance between any two points in $\mathcal{A} \cup \mathcal{B}$ is at least 1. (ii) There is a point of $\mathcal{A}$ in any triangle whose vertices are in $\mathcal{B}$, and there is a point of $\mathcal{B}$ in any triangle whose vertices are in $\mathcal{A}$.

Solution: 27. Suppose that such sets of points $\mathcal{A}, \mathcal{B}$ exist.  First, we observe that there exist five points $A, B, C, D, E$ in $\mathcal{A}$ such that their convex hull does not contain any other point of $\mathcal{A}$. Indeed, take any point $A \in \mathcal{A}$. Since any two points of $\mathcal{A}$ are at distance at least 1 , the number of points $X \in \mathcal{A}$ with $X A \leq r$ is finite for every $r>0$. Thus it is enough to choose four points $B, C, D, E$ of $\mathcal{A}$ that are closest to $A$. Now consider the convex hull $\mathcal{C}$ of $A, B, C, D, E$. Suppose that $\mathcal{C}$ is a pentagon, say $A B C D E$. Then each of the disjoint triangles $A B C, A C D, A D E$ contains a point of $\mathcal{B}$. Denote these points by $P, Q, R$. Then $\triangle P Q R$ contains some point $F \in \mathcal{A}$, so $F$ is inside $A B C D E$, a contradiction. Suppose that $\mathcal{C}$ is a quadrilateral, say $A B C D$, with $E$ lying within $A B C D$. Then the triangles $A B E, B C E, C D E, D A E$ contain some points $P, Q, R, S$ of $\mathcal{B}$ that form two disjoint triangles. It follows that there are two points of $\mathcal{A}$ inside $A B C D$, which is a contradiction. Finally, suppose that $\mathcal{C}$ is a triangle with two points of $\mathcal{A}$ inside. Then $\mathcal{C}$ is the union of five disjoint triangles with vertices in $\mathcal{A}$, so there are at least five points of $\mathcal{B}$ inside $\mathcal{C}$. These five points make at least three disjoint triangles containing three points of $\mathcal{A}$. This is again a contradiction. It follows that no such sets $\mathcal{A}, \mathcal{B}$ exist.


28. C5 (FRA) ${ }^{\mathrm{IMO} 6}$ Let $p, q, n$ be three positive integers with $p+q<n$. Let $\left(x_{0}, x_{1}, \ldots, x_{n}\right)$ be an $(n+1)$-tuple of integers satisfying the following conditions: (i) $x_{0}=x_{n}=0$. (ii) For each $i$ with $1 \leq i \leq n$, either $x_{i}-x_{i-1}=p$ or $x_{i}-x_{i-1}=-q$. Show that there exists a pair $(i, j)$ of distinct indices with $(i, j) \neq(0, n)$ such that $x_{i}=x_{j}$.

Solution: 28. Note that w.l.o.g., we can assume that $p$ and $q$ are coprime. Indeed, otherwise it suffices to consider the problem in which all $x_{i}$ 's and $p, q$ are divided by $\operatorname{gcd}(p, q)$.  Let $k, l$ be the number of indices $i$ with $x_{i+1}-x_{i}=p$ and the number of those $i$ with $x_{i+1}-x_{i}=-q(0 \leq i<n)$. From $x_{0}=x_{n}=0$ we get $k p=l q$, so for some integer $t>1, k=q t, l=p t$, and $n=(p+q) t$. Consider the sequence $y_{i}=x_{i+p+q}-x_{i}, i=0, \ldots, n-p-q$. We claim that at least one of the $y_{i}$ 's equals zero. We begin by noting that each $y_{i}$ is of the form $u p-v q$, where $u+v=p+q$; therefore $y_{i}=(u+v) p-$ $v(p+q)=(p-v)(p+q)$ is always divisible by $p+q$. Moreover, $y_{i+1}-y_{i}=$ $\left(x_{i+p+q+1}-x_{i+p+q}\right)-\left(x_{i+1}-x_{i}\right)$ is 0 or $\pm(p+q)$. We conclude that if no $y_{i}$ is 0 then all $y_{i}$ 's are of the same sign. But this is in contradiction with the relation $y_{0}+y_{p+q}+\cdots+y_{n-p-q}=x_{n}-x_{0}=0$. Consequently some $y_{i}$ is zero, as claimed.  Second solution. As before we assume $(p, q)=1$. Let us define a sequence of points $A_{i}\left(y_{i}, z_{i}\right)(i=0,1, \ldots, n)$ in $\mathbb{N}_{0}^{2}$ inductively as follows. Set $A_{0}=$ $(0,0)$ and define $\left(y_{i+1}, z_{i+1}\right)$ as $\left(y_{i}, z_{i}+1\right)$ if $x_{i+1}=x_{i}+p$ and $\left(y_{i}+1, z_{i}\right)$ otherwise. The points $A_{i}$ form a trajectory $L$ in $\mathbb{N}_{0}^{2}$ continuously moving upwards and rightwards by steps of length 1 . Clearly, $x_{i}=p z_{i}-q y_{i}$ for all $i$. Since $x_{n}=0$, it follows that $\left(z_{n}, y_{n}\right)=(k q, k p), k \in \mathbb{N}$. Since $y_{n}+z_{n}=n>p+q$, it follows that $k>1$. We observe that $x_{i}=x_{j}$ if and only if $A_{i} A_{j} \| A_{0} A_{n}$. We shall show that such $i, j$ with $i<j$ and $(i, j) \neq(0, n)$ must exist. If $L$ meets $A_{0} A_{n}$ in an interior point, then our statement trivially holds. From now on we assume the opposite. Let $P_{i j}$ be the rectangle with sides parallel to the coordinate axes and with vertices at $(i p, j q)$ and $((i+$ 1) $p,(j+1) q)$. Let $L_{i j}$ be the part of the trajectory $L$ lying inside $P_{i j}$. We may assume w.l.o.g. that the endpoints of $L_{00}$ lie on the vertical sides of $P_{00}$. Then there obviously exists $d \in\{1, \ldots, k-1\}$ such that the endpoints of $L_{d d}$ lie on the horizontal sides of $P_{d d}$. Consider the translate $L_{d d}^{\prime}$ of $L_{d d}$ for the vector $-d(p, q)$. The endpoints of $L_{d d}^{\prime}$ lie on the vertical sides of $P_{00}$. Hence $L_{00}$ and $L_{d d}^{\prime}$ have some point $X \neq A_{0}$ in common. The translate $Y$ of point $X$ for the vector $d(p, q)$ belongs to $L$ and satisfies $X Y \| A_{0} A_{n}$.


29. C6 (CAN) A finite number of beans are placed on an infinite row of squares. A sequence of moves is performed as follows: At each stage a square containing more than one bean is chosen. Two beans are taken from this square; one of them is placed on the square immediately to the left, and the other is placed on the square immediately to the right of the chosen square. The sequence terminates if at some point there is at most one bean on each square. Given some initial configuration, show that any legal sequence of moves will terminate after the same number of steps and with the same final configuration.

Solution: 29. Let the squares be indexed serially by the integers: ..., $-1,0,1,2, \ldots$. When a bean is moved from $i$ to $i+1$ or from $i+1$ to $i$ for the first time, we may assign the index $i$ to it. Thereafter, whenever some bean is moved in the opposite direction, we shall assume that it is exactly the one marked by $i$, and so on. Thus, each pair of neighboring squares has a bean stuck between it, and since the number of beans is finite, there are only finitely pairs of neighboring squares, and thus finitely many squares on which moves are made. Thus we may assume w.l.o.g. that all moves occur between 0 and $l \in \mathbb{N}$ and that all beans exist at all times within $[0, l]$. Defining $b_{i}$ to be the number of beans in the $i$ th cell $(i \in \mathbb{Z})$ and $b$ the total number of beans, we define the semi-invariant $S=\sum_{i \in \mathbb{Z}} i^{2} b_{i}$. Since all moves occur above 0 , the semi-invariant $S$ increases by 2 with each move, and since we always have $S<b \cdot l^{2}$, it follows that the number of moves must be finite. We now prove the uniqueness of the final configuration and the number of moves for some initial configuration $\left\{b_{i}\right\}$. Let $x_{i} \geq 0$ be the number of moves made in the $i$ th cell $(i \in \mathbb{Z})$ during the game. Since the game is finite, only finitely many of $x_{i}$ 's are nonzero. Also, the number of beans in cell $i$, denoted as $e_{i}$, at the end is  $$ (\forall i \in \mathbb{Z}) e_{i}=b_{i}+x_{i-1}+x_{i+1}-2 x_{i} \in\{0,1\} $$  Thus it is enough to show that given $b_{i} \geq 0$, the sequence $\left\{x_{i}\right\}_{i \in \mathbb{Z}}$ of nonnegative integers satisfying (1) is unique. Suppose the assertion is false, i.e., that there exists at least one sequence $b_{i} \geq 0$ for which there exist distinct sequences $\left\{x_{i}\right\}$ and $\left\{x_{i}^{\prime}\right\}$ satisfying (1). We may choose such a $\left\{b_{i}\right\}$ for which $\min \left\{\sum_{i \in \mathbb{Z}} x_{i}, \sum_{i \in \mathbb{Z}} x_{i}^{\prime}\right\}$ is minimal (since $\sum_{i \in \mathbb{Z}} x_{i}$ is always finite). We choose any index $j$ such that $b_{j}>1$. Such an index $j$ exists, since otherwise the game is over. Then one must make at least one move in the $j$ th cell, which implies that $x_{j}, x_{j}^{\prime} \geq 1$. However, then the sequences $\left\{x_{i}\right\}$ and $\left\{x_{i}^{\prime}\right\}$ with $x_{j}$ and $x_{j}^{\prime}$ decreased by 1 also satisfy (1) for a sequence $\left\{b_{i}\right\}$ where $b_{j-1}, b_{j}, b_{j+1}$ is replaced with $b_{j-1}+1, b_{j}-2, b_{j+1}+1$. This contradicts the assumption of minimal $\min \left\{\sum_{i \in \mathbb{Z}} x_{i}, \sum_{i \in \mathbb{Z}} x_{i}^{\prime}\right\}$ for the initial $\left\{b_{i}\right\}$.


Solution: 3. Since $a_{1}>2$, it can be written as $a_{1}=b+b^{-1}$ for some $b>0$. Furthermore, $a_{1}^{2}-2=b^{2}+b^{-2}$ and hence $a_{2}=\left(b^{2}+b^{-2}\right)\left(b+b^{-1}\right)$. We prove that  $$ a_{n}=\left(b+b^{-1}\right)\left(b^{2}+b^{-2}\right)\left(b^{4}+b^{-4}\right) \cdots\left(b^{2^{n-1}}+b^{-2^{n-1}}\right) $$  by induction. Indeed, $\frac{a_{n+1}}{a_{n}}=\left(\frac{a_{n}}{a_{n-1}}\right)^{2}-2=\left(b^{2^{n-1}}+b^{-2^{n-1}}\right)^{2}-2=$ $b^{2^{n}}+b^{-2^{n}}$. Now we have  $$ \begin{aligned} \sum_{i=1}^{n} \frac{1}{a_{i}}= & 1+\frac{b}{b^{2}+1}+\frac{b^{3}}{\left(b^{2}+1\right)\left(b^{4}+1\right)}+\cdots \\ & \cdots+\frac{b^{2^{n}-1}}{\left(b^{2}+1\right)\left(b^{4}+1\right) \ldots\left(b^{2}+1\right)} \end{aligned} $$  Note that $\frac{1}{2}\left(a+2-\sqrt{a^{2}-4}\right)=1+\frac{1}{b}$; hence we must prove that the right side in (1) is less than $\frac{1}{b}$. This follows from the fact that  $$ \begin{aligned} & \frac{b^{2^{k}}}{\left(b^{2}+1\right)\left(b^{4}+1\right) \cdots\left(b^{2^{k}}+1\right)} \\ & \quad=\frac{1}{\left(b^{2}+1\right)\left(b^{4}+1\right) \cdots\left(b^{2^{k-1}}+1\right)}-\frac{1}{\left(b^{2}+1\right)\left(b^{4}+1\right) \cdots\left(b^{2^{k}}+1\right)} \end{aligned} $$  hence the right side in (1) equals $\frac{1}{b}\left(1-\frac{1}{\left(b^{2}+1\right)\left(b^{4}+1\right) \ldots\left(b^{2^{n}}+1\right)}\right)$, and this is clearly less than $1 / b$.


30. C7 (IRE) Let $U$ be a finite set and let $f, g$ be bijective functions from $U$ onto itself. Let $S=\{w \in U: f(f(w))=g(g(w))\}, \quad T=\{w \in U: f(g(w))=g(f(w))\}$, and suppose that $U=S \cup T$. Prove that for $w \in U, f(w) \in S$ if and only if $g(w) \in S$.

Solution: 30. For convenience, we shall write $f^{2}, f g, \ldots$ for the functions $f \circ f, f \circ g, \ldots$ We need two lemmas. Lemma 1. If $f(x) \in S$ and $g(x) \in T$, then $x \in S \cap T$. Proof. The given condition means that $f^{3}(x)=g^{2} f(x)$ and $g f g(x)=$ $f g^{2}(x)$. Since $x \in S \cup T=U$, we have two cases: $x \in S$. Then $f^{2}(x)=g^{2}(x)$, which also implies $f^{3}(x)=f g^{2}(x)$. Therefore $g f g(x)=f g^{2}(x)=f^{3}(x)=g^{2} f(x)$, and since $g$ is a bijection, we obtain $f g(x)=g f(x)$, i.e., $x \in T$. $x \in T$. Then $f g(x)=g f(x)$, so $g^{2} f(x)=g f g(x)$. It follows that $f^{3}(x)=g^{2} f(x)=g f g(x)=f g^{2}(x)$, and since $f$ is a bijection, we obtain $x \in S$. Hence $x \in S \cap T$ in both cases. Similarly, $f(x) \in T$ and $g(x) \in S$ again imply $x \in S \cap T$. Lemma 2. $f(S \cap T)=g(S \cap T)=S \cap T$. Proof. By symmetry, it is enough to prove $f(S \cap T)=S \cap T$, or in other words that $f^{-1}(S \cap T)=S \cap T$. Since $S \cap T$ is finite, this is equivalent to $f(S \cap T) \subseteq S \cap T$. Let $f(x) \in S \cap T$. Then if $g(x) \in S$ (since $f(x) \in T$ ), Lemma 1 gives $x \in S \cap T$; similarly, if $g(x) \in T$, then by Lemma $1, x \in S \cap T$. Now we return to the problem. Assume that $f(x) \in S$. If $g(x) \notin S$, then $g(x) \in T$, so from Lemma 1 we deduce that $x \in S \cap T$. Then Lemma 2 claims that $g(x) \in S \cap T$ too, a contradiction. Analogously, from $g(x) \in S$ we are led to $f(x) \in S$. This finishes the proof.


4. A4 (KOR) Let $a_{1}, a_{2}, \ldots, a_{n}$ be nonnegative real numbers, not all zero. (a) Prove that $x^{n}-a_{1} x^{n-1}-\cdots-a_{n-1} x-a_{n}=0$ has precisely one positive real root. (b) Let $A=\sum_{j=1}^{n} a_{j}, B=\sum_{j=1}^{n} j a_{j}$, and let $R$ be the positive real root of the equation in part (a). Prove that  $$ A^{A} \leq R^{B} $$

Solution: 4. Consider the function  $$ f(x)=\frac{a_{1}}{x}+\frac{a_{2}}{x^{2}}+\cdots+\frac{a_{n}}{x^{n}} . $$  Since $f$ is strictly decreasing from $+\infty$ to 0 on the interval $(0,+\infty)$, there exists exactly one $R>0$ for which $f(R)=1$. This $R$ is also the only positive real root of the given polynomial. Since $\ln x$ is a concave function on $(0,+\infty)$, Jensen's inequality gives us  $$ \sum_{j=1}^{n} \frac{a_{j}}{A}\left(\ln \frac{A}{R^{j}}\right) \leq \ln \left(\sum_{j=1}^{n} \frac{a_{j}}{A} \cdot \frac{A}{R^{j}}\right)=\ln f(R)=0 . $$  Therefore $\sum_{j=1}^{n} a_{j}(\ln A-j \ln R) \leq 0$, which is equivalent to $A \ln A \leq$ $B \ln R$, i.e., $A^{A} \leq R^{B}$.


5. A5 (ROM) Let $P(x)$ be the real polynomial function $P(x)=a x^{3}+$ $b x^{2}+c x+d$. Prove that if $|P(x)| \leq 1$ for all $x$ such that $|x| \leq 1$, then  $$ |a|+|b|+|c|+|d| \leq 7 $$

Solution: 5. Considering the polynomials $\pm P( \pm x)$ we may assume w.l.o.g. that $a, b \geq$ 0 . We have four cases: (1) $c \geq 0, d \geq 0$. Then $|a|+|b|+|c|+|d|=a+b+c+d=P(1) \leq 1$. (2) $c \geq 0, d<0$. Then $|a|+|b|+|c|+|d|=a+b+c-d=P(1)-2 P(0) \leq 3$. (3) $c<0, d \geq 0$. Then  $$ \begin{aligned} |a|+|b|+|c|+|d| & =a+b-c+d \\ & =\frac{4}{3} P(1)-\frac{1}{3} P(-1)-\frac{8}{3} P(1 / 2)+\frac{8}{3} P(-1 / 2) \leq 7 . \end{aligned} $$  (4) $c<0, d<0$. Then  $$ \begin{aligned} |a|+|b|+|c|+|d| & =a+b-c-d \\ & =\frac{5}{3} P(1)-4 P(1 / 2)+\frac{4}{3} P(-1 / 2) \leq 7 \end{aligned} $$  Remark. It can be shown that the maximum of 7 is attained only for $P(x)= \pm\left(4 x^{3}-3 x\right)$.


6. A6 (IRE) Let $n$ be an even positive integer. Prove that there exists a positive integer $k$ such that  $$ k=f(x)(x+1)^{n}+g(x)\left(x^{n}+1\right) $$  for some polynomials $f(x), g(x)$ having integer coefficients. If $k_{0}$ denotes the least such $k$, determine $k_{0}$ as a function of $n$.  A6 ${ }^{\prime}$ Let $n$ be an even positive integer. Prove that there exists a positive integer $k$ such that  $$ k=f(x)(x+1)^{n}+g(x)\left(x^{n}+1\right) $$  for some polynomials $f(x), g(x)$ having integer coefficients. If $k_{0}$ denotes the least such $k$, show that $k_{0}=2^{q}$, where $q$ is the odd integer determined by $n=q 2^{r}, r \in \mathbb{N}$. A6" Prove that for each positive integer $n$, there exist polynomials $f(x), g(x)$ having integer coefficients such that  $$ f(x)(x+1)^{2^{n}}+g(x)\left(x^{2^{n}}+1\right)=2 . $$

Solution: 6. Let $f(x), g(x)$ be polynomials with integer coefficients such that  $$ f(x)(x+1)^{n}+g(x)\left(x^{n}+1\right)=k_{0} $$  Write $n=2^{r} m$ for $m$ odd and note that $x^{n}+1=\left(x^{2^{r}}+1\right) B(x)$, where $B(x)=x^{2^{r}(m-1)}-x^{2^{r}(m-2)}+\cdots-x^{2^{r}}+1$. Moreover, $B(-1)=1$; hence $B(x)-1=(x+1) c(x)$ and thus  $$ R(x) B(x)+1=(B(x)-1)^{n}=(x+1)^{n} c(x)^{n} $$  for some polynomials $c(x)$ and $R(x)$. The zeros of the polynomial $x^{2^{r}}+1$ are $\omega_{j}$, with $\omega_{1}=\cos \frac{\pi}{2^{r}}+i \sin \frac{\pi}{2^{r}}$, and $\omega_{j}=\omega^{2 j-1}$ for $1 \leq j \leq 2^{r}$. We have  $$ \left(\omega_{1}+1\right)\left(\omega_{2}+1\right) \cdots\left(\omega_{2^{r+1}}+1\right)=2 $$  From $(*)$ we also get $f\left(\omega_{j}\right)\left(\omega_{j}+1\right)^{n}=k_{0}$ for $j=1,2, \ldots, 2^{r}$. Since $A=f\left(\omega_{1}\right) f\left(\omega_{2}\right) \cdots f\left(\omega_{2^{r}}\right)$ is a symmetric polynomial in $\omega_{1}, \ldots, \omega_{2^{r}}$ with integer coefficients, $A$ is an integer. Consequently, taking the product over $j=1,2, \ldots, 2^{r}$ and using (2) we deduce that $2^{n} A=k_{0}^{2^{r}}$ is divisible by $2^{n}=2^{2^{r} m}$. Hence $2^{m} \mid k_{0}$. Furthermore, since $\omega_{j}+1=\left(\omega_{1}+1\right) p_{j}\left(\omega_{1}\right)$ for some polynomial $p_{j}$ with integer coefficients, (2) gives $\left(\omega_{1}+1\right)^{2^{r}} p\left(\omega_{1}\right)=2$, where $p(x)=$ $p_{2}(x) \cdots p_{2^{r}}(x)$ has integer coefficients. But then the polynomial $(x+$ $1)^{2^{2}} p(x)-2$ has a zero $x=\omega_{1}$, so it is divisible by its minimal polynomial $x^{2^{r}}+1$. Therefore  $$ (x+1)^{2^{r}} p(x)=2+\left(x^{2^{r}}+1\right) q(x) $$  for some polynomial $q(x)$. Raising (3) to the $m$ th power we get $(x+$ $1)^{n} p(x)^{n}=2^{m}+\left(x^{2^{r}}+1\right) Q(x)$ for some polynomial $Q(x)$ with integer coefficients. Now using (1) we obtain  $$ \begin{aligned} (x+1)^{n} c(x)^{n}\left(x^{2^{r}}+1\right) Q(x) & =\left(x^{2^{r}}+1\right) Q(x)+\left(x^{2^{r}}+1\right) Q(x) B(x) R(x) \\ & =(x+1)^{n} p(x)^{n}-2^{m}+\left(x^{n}+1\right) Q(X) R(x) . \end{aligned} $$  Therefore $(x+1)^{n} f(x)+\left(x^{n}+1\right) g(x)=2^{m}$ for some polynomials $f(x), g(x)$ with integer coefficients, and $k_{0}=2^{m}$.


7. A7 (ARM) Let $f$ be a function from the set of real numbers $\mathbb{R}$ into itself such that for all $x \in \mathbb{R}$, we have $|f(x)| \leq 1$ and  $$ f\left(x+\frac{13}{42}\right)+f(x)=f\left(x+\frac{1}{6}\right)+f\left(x+\frac{1}{7}\right) . $$  Prove that $f$ is a periodic function (that is, there exists a nonzero real number $c$ such that $f(x+c)=f(x)$ for all $x \in \mathbb{R})$.

Solution: 7. We are given that $f(x+a+b)-f(x+a)=f(x+b)-f(x)$, where $a=1 / 6$ and $b=1 / 7$. Summing up these equations for $x, x+b, \ldots, x+6 b$ we obtain $f(x+a+1)-f(x+a)=f(x+1)-f(x)$. Summing up the new equations for $x, x+a, \ldots, x+5 a$ we obtain that  $$ f(x+2)-f(x+1)=f(x+1)-f(x) . $$  It follows by induction that $f(x+n)-f(x)=n[f(x+1)-f(x)]$. If $f(x+1) \neq f(x)$, then $f(x+n)-f(x)$ will exceed in absolute value an arbitrarily large number for a sufficiently large $n$, contradicting the assumption that $f$ is bounded. Hence $f(x+1)=f(x)$ for all $x$.


8. A8 (ROM) ${ }^{\mathrm{IMO} 3}$ Let $\mathbb{N}_{0}$ denote the set of nonnegative integers. Find all functions $f$ from $\mathbb{N}_{0}$ into itself such that  $$ f(m+f(n))=f(f(m))+f(n), \quad \forall m, n \in \mathbb{N}_{0} $$

Solution: 8. Putting $m=n=0$ we obtain $f(0)=0$ and consequently $f(f(n))=f(n)$ for all $n$. Thus the given functional equation is equivalent to  $$ f(m+f(n))=f(m)+f(n), \quad f(0)=0 $$  Clearly one solution is $(\forall x) f(x)=0$. Suppose $f$ is not the zero function. We observe that $f$ has nonzero fixed points (for example, any $f(n)$ is a fixed point). Let $a$ be the smallest nonzero fixed point of $f$. By induction, each $k a(k \in \mathbb{N})$ is a fixed point too. We claim that all fixed points of $f$ are of this form. Indeed, suppose that $b=k a+i$ is a fixed point, where $i<a$. Then  $$ b=f(b)=f(k a+i)=f(i+f(k a))=f(i)+f(k a)=f(i)+k a $$  hence $f(i)=i$. Hence $i=0$. Since the set of values of $f$ is a set of its fixed points, it follows that for $i=0,1, \ldots, a-1, f(i)=a n_{i}$ for some integers $n_{i} \geq 0$ with $n_{0}=0$. Let $n=k a+i$ be any positive integer, $0 \leq i<a$. As before, the functional equation gives us  $$ f(n)=f(k a+i)=f(i)+k a=\left(n_{i}+k\right) a $$  Besides the zero function, this is the general solution of the given functional equation. To verify this, we plug in $m=k a+i, n=l a+j$ and obtain  $$ \begin{aligned} f(m+f(n)) & =f(k a+i+f(l a+j))=f\left(\left(k+l+n_{j}\right) a+i\right) \\ & =\left(k+l+n_{j}+n_{i}\right) a=f(m)+f(n) . \end{aligned} $$


9. A9 (POL) Let the sequence $a(n), n=1,2,3, \ldots$, be generated as follows: $a(1)=0$, and for $n>1$,  $$ a(n)=a([n / 2])+(-1)^{\frac{n(n+1)}{2}} . \quad(\text { Here }[t]=\text { the greatest integer } \leq t .) $$  (a) Determine the maximum and minimum value of $a(n)$ over $n \leq 1996$ and find all $n \leq 1996$ for which these extreme values are attained. (b) How many terms $a(n), n \leq 1996$, are equal to 0 ?

Solution: 9. From the definition of $a(n)$ we obtain  $$ a(n)-a([n / 2])=\left\{\begin{array}{r} 1 \text { if } n \equiv 0 \text { or } n \equiv 3(\bmod 4) \\ -1 \text { if } n \equiv 1 \text { or } n \equiv 2(\bmod 4) . \end{array}\right. $$  Let $n=\overline{b_{k} b_{k-1} \ldots b_{1} b_{0}}$ be the binary representation of $n$, where we assume $b_{k}=1$. If we define $p(n)$ and $q(n)$ to be the number of indices $i=0,1, \ldots, k-1$ with $b_{i}=b_{i+1}$ and the number of $i=0,1, \ldots, k-1$ with $b_{i} \neq b_{i+1}$ respectively, we get  $$ a(n)=p(n)-q(n) $$  (a) The maximum value of $a(n)$ for $n \leq 1996$ is 9 when $p(n)=9$ and $q(n)=0$, i.e., in the case $n=\overline{1111111111}_{2}=1023$. The minimum value is -10 and is attained when $p(n)=0$ and $q(n)=$ 10, i.e., only for $n=\overline{10101010101}_{2}=1365$. (b) From (1) we have that $a(n)=0$ is equivalent to $p(n)=q(n)=k / 2$. Hence $k$ must be even, and the $k / 2$ indices $i$ for which $b_{i}=b_{i+1}$ can be chosen in exactly $\binom{k}{k / 2}$ ways. Thus the number of positive integers $n<2^{11}=2048$ with $a(n)=0$ is equal to  $$ \binom{0}{0}+\binom{2}{1}+\binom{4}{2}+\binom{6}{3}+\binom{8}{4}+\binom{10}{5}=351 $$  But five of these numbers exceed 1996: these are $2002=\overline{11111010010}_{2}$, $2004=\overline{11111010100}_{2}, 2006=\overline{11111010110}_{2}, 2010=\overline{11111011010}_{2}$, $2026=\overline{11111101010}_{2}$. Therefore there are 346 numbers $n \leq 1996$ for which $a(n)=0$.


1. (BLR) $)^{\mathrm{IMO}} \mathrm{An}$ infinite square grid is colored in the chessboard pattern. For any pair of positive integers $m, n$ consider a right-angled triangle whose vertices are grid points and whose legs, of lengths $m$ and $n$, run along the lines of the grid. Let $S_{b}$ be the total area of the black part of the triangle and $S_{w}$ the total area of its white part. Define the function $f(m, n)=\left|S_{b}-S_{w}\right|$. (a) Calculate $f(m, n)$ for all $m, n$ that have the same parity. (b) Prove that $f(m, n) \leq \frac{1}{2} \max (m, n)$. (c) Show that $f(m, n)$ is not bounded from above.

Solution: 1. Let $A B C$ be the given triangle, with $\angle B=90^{\circ}$ and $A B=m, B C=n$. For an arbitrary polygon $\mathcal{P}$ we denote by $w(\mathcal{P})$ and $b(\mathcal{P})$ respectively the total areas of the white and black parts of $\mathcal{P}$. (a) Let $D$ be the fourth vertex of the rectangle $A B C D$. When $m$ and $n$ are of the same parity, the coloring of the rectangle $A B C D$ is centrally symmetric with respect to the midpoint of $A C$. It follows that $w(A B C)=\frac{1}{2} w(A B C D)$ and $b(A B C)=\frac{1}{2} b(A B C D)$; thus $f(m, n)=\frac{1}{2}|w(A B C D)-b(A B C D)|$. Hence $f(m, n)$ equals $\frac{1}{2}$ if $m$ and $n$ are both odd, and 0 otherwise. (b) The result when $m, n$ are of the same parity follows from (a). Suppose that $m>n$, where $m$ and $n$ are of different parity. Choose a point $E$ on $A B$ such that $A E=1$. Since by (a) $|w(E B C)-b(E B C)|=$ $f(m-1, n) \leq \frac{1}{2}$, we have $f(m, n) \leq \frac{1}{2}+|w(E A C)-b(E A C)| \leq$ $\frac{1}{2}+S(E A C)=\frac{1}{2}+\frac{n-1}{2}=\frac{n}{2}$. Therefore $f(m, n) \leq \frac{1}{2} \min (m, n)$. (c) Let us calculate $f(m, n)$ for $m=2 k+1, n=2 k, k \in \mathbb{N}$. With $E$ defined as in (b), we have $B E=B C=2 k$. If the square at $B$ is w.l.o.g. white, $C E$ passes only through black squares. The white part of $\triangle E A C$ then consists of $2 k$ similar triangles with areas $\frac{1}{2} \frac{i}{2 k} \frac{i}{2 k+1}=\frac{i^{2}}{4 k(2 k+1)}$, where $i=1,2, \ldots, 2 k$. The total white area of $E A C$ is  $$ \frac{1}{4 k(2 k+1)}\left(1^{2}+2^{2}+\cdots+(2 k)^{2}\right)=\frac{4 k+1}{12} . $$  Therefore the black area is $(8 k-1) / 12$, and $f(2 k+1,2 k)=(2 k-1) / 6$, which is not bounded.


10. ( $\mathbf{C Z E}$ ) Find all positive integers $k$ for which the following statement is true: If $F(x)$ is a polynomial with integer coefficients satisfying the condition  $$ 0 \leq F(c) \leq k \quad \text { for each } c \in\{0,1, \ldots, k+1\} $$  then $F(0)=F(1)=\cdots=F(k+1)$.

Solution: 10. Suppose that $k \geq 4$. Consider any polynomial $F(x)$ with integer coefficients such that $0 \leq F(x) \leq k$ for $x=0,1, \ldots, k+1$. Since $F(k+1)-F(0)$ is divisible by $k+1$, we must have $F(k+1)=F(0)$. Hence  $$ F(x)-F(0)=x(x-k-1) Q(x) $$  for some polynomial $Q(x)$ with integer coefficients. In particular, $F(x)-$ $F(0)$ is divisible by $x(k+1-x)>k+1$ for every $x=2,3, \ldots, k-1$, so $F(x)=F(0)$ must hold for any $x=2,3, \ldots, k-1$. It follows that  $$ F(x)-F(0)=x(x-2)(x-3) \cdots(x-k+1)(x-k-1) R(x) $$  for some polynomial $R(x)$ with integer coefficients. Thus $k \geq \mid F(1)-$ $F(0)|=k(k-2)!| R(1) \mid$, although $k(k-2)!>k$ for $k \geq 4$. In this case we have $F(1)=F(0)$ and similarly $F(k)=F(0)$. Hence, the statement is true for $k \geq 4$. It is easy to find counterexamples for $k \leq 3$. These are, for example,  $$ F(x)= \begin{cases}x(2-x) & \text { for } k=1 \\ x(3-x) & \text { for } k=2 \\ x(2-x)^{2}(4-x) & \text { for } k=3\end{cases} $$


11. (NET) Let $P(x)$ be a polynomial with real coefficients such that $P(x)>$ 0 for all $x \geq 0$. Prove that there exists a positive integer $n$ such that $(1+x)^{n} P(x)$ is a polynomial with nonnegative coefficients.

Solution: 11. All real roots of $P(x)$ (if any) are negative: say $-a_{1},-a_{2}, \ldots,-a_{k}$. Then $P(x)$ can be factored as  $$ P(x)=C\left(x+a_{1}\right) \cdots\left(x+a_{k}\right)\left(x^{2}-b_{1} x+c_{1}\right) \cdots\left(x^{2}-b_{m} x+c_{m}\right) $$  where $x^{2}-b_{i} x+c_{i}$ are quadratic polynomials without real roots. Since the product of polynomials with positive coefficients is again a polynomial with positive coefficients, it will be sufficient to prove the result for each of the factors in (1). The case of $x+a_{j}$ is trivial. It remains only to prove the claim for every polynomial $x^{2}-b x+c$ with $b^{2}<4 c$. From the binomial formula, we have for any $n \in \mathbb{N}$,  $$ (1+x)^{n}\left(x^{2}-b x+c\right)=\sum_{i=0}^{n+2}\left[\binom{n}{i-2}-b\binom{n}{i-1}+c\binom{n}{i}\right] x^{i}=\sum_{i=0}^{n+2} C_{i} x^{i} $$  where  $$ C_{i}=\frac{n!\left((b+c+1) i^{2}-((b+2 c) n+(2 b+3 c+1)) i+c\left(n^{2}+3 n+2\right)\right) x^{i}}{i!(n-i+2)!} $$  The coefficients $C_{i}$ of $x^{i}$ appear in the form of a quadratic polynomial in $i$ depending on $n$. We claim that for large enough $n$ this polynomial has negative discriminant, and is thus positive for every $i$. Indeed, this discriminant equals $D=((b+2 c) n+(2 b+3 c+1))^{2}-4(b+c+1) c\left(n^{2}+\right.$ $3 n+2)=\left(b^{2}-4 c\right) n^{2}-2 U n+V$, where $U=2 b^{2}+b c+b-4 c$ and $V=(2 b+c+1)^{2}-4 c$, and since $b^{2}-4 c<0$, for large $n$ it clearly holds that $D<0$.


12. (ITA) Let $p$ be a prime number and let $f(x)$ be a polynomial of degree $d$ with integer coefficients such that: (i) $f(0)=0, f(1)=1$; (ii) for every positive integer $n$, the remainder of the division of $f(n)$ by $p$ is either 0 or 1. Prove that $d \geq p-1$.

Solution: 12. Lemma. For any polynomial $P$ of degree at most $n$, the following equality holds:  $$ \sum_{i=0}^{n+1}(-1)^{i}\binom{n+1}{i} P(i)=0 $$  Proof. See (SL81-13). Suppose to the contrary that the degree of $f$ is at most $p-2$. Then it follows from the lemma that  $$ 0=\sum_{i=0}^{p-1}(-1)^{i}\binom{p-1}{i} f(i) \equiv \sum_{i=0}^{p-1} f(i)(\bmod p) $$  since $\binom{p-1}{i}=\frac{(p-1)(p-2) \cdots(p-i)}{i!} \equiv(-1)^{i}(\bmod p)$. But this is clearly impossible if $f(i)$ equals 0 or 1 modulo $p$ and $f(0)=0, f(1)=1$. Remark. In proving the essential relation $\sum_{i=0}^{p-1} f(i) \equiv 0(\bmod p)$, it is clearly enough to show that $S_{k}=1^{k}+2^{k}+\cdots+(p-1)^{k}$ is divisible by $p$ for every $k \leq p-2$. This can be shown in two other ways. (1) By induction. Assume that $S_{0} \equiv \cdots \equiv S_{k-1}(\bmod p)$. By the binomial formula we have  $$ 0 \equiv \sum_{n=0}^{p-1}\left[(n+1)^{k+1}-n^{k+1}\right] \equiv(k+1) S_{k}+\sum_{i=0}^{k-1}\binom{k+1}{i} S_{i}(\bmod p), $$  and the inductive step follows. (2) Using the primitive root $g$ modulo $p$. Then  $$ S_{k} \equiv 1+g^{k}+\cdots+g^{k(p-2)}=\frac{g^{k(p-1)}-1}{g^{k}-1} \equiv 0(\bmod p) . $$


13. (IND) In town $A$, there are $n$ girls and $n$ boys, and each girl knows each boy. In town $B$, there are $n$ girls $g_{1}, g_{2}, \ldots, g_{n}$ and $2 n-1$ boys $b_{1}, b_{2}, \ldots$, $b_{2 n-1}$. The girl $g_{i}, i=1,2, \ldots, n$, knows the boys $b_{1}, b_{2}, \ldots, b_{2 i-1}$, and no others. For all $r=1,2, \ldots, n$, denote by $A(r), B(r)$ the number of different ways in which $r$ girls from town $A$, respectively town $B$, can dance with $r$ boys from their own town, forming $r$ pairs, each girl with a boy she knows. Prove that $A(r)=B(r)$ for each $r=1,2, \ldots, n$.

Solution: 13. Denote $A(r)$ and $B(r)$ by $A(n, r)$ and $B(n, r)$ respectively. The numbers $A(n, r)$ can be found directly: one can choose $r$ girls and $r$ boys in $\binom{n}{r}^{2}$ ways, and pair them in $r$ ! ways. Hence  $$ A(n, r)=\binom{n}{r}^{2} \cdot r!=\frac{n!^{2}}{(n-r)!^{2} r!} $$  Now we establish a recurrence relation between the $B(n, r)$ 's. Let $n \geq 2$ and $2 \leq r \leq n$. There are two cases for a desired selection of $r$ pairs of girls and boys: (i) One of the girls dancing is $g_{n}$. Then the other $r-1$ girls can choose their partners in $B(n-1, r-1)$ ways and $g_{n}$ can choose any of the remaining $2 n-r$ boys. Thus, the total number of choices in this case is $(2 n-r) B(n-1, r-1)$. (ii) $g_{n}$ is not dancing. Then there are exactly $B(n-1, r)$ possible choices. Therefore, for every $n \geq 2$ it holds that  $$ B(n, r)=(2 n-r) B(n-1, r-1)+B(n-1, r) \quad \text { for } r=2, \ldots, n $$  Here we assume that $B(n, r)=0$ for $r>n$, while $B(n, 1)=1+3+\cdots+$ $(2 n-1)=n^{2}$ 。 It is directly verified that the numbers $A(n, r)$ satisfy the same initial conditions and recurrence relations, from which it follows that $A(n, r)=$ $B(n, r)$ for all $n$ and $r \leq n$.


14. (IND) Let $b, m, n$ be positive integers such that $b>1$ and $m \neq n$. Prove that if $b^{m}-1$ and $b^{n}-1$ have the same prime divisors, then $b+1$ is a power of 2 .

Solution: 14. We use the following nonstandard notation: ( $1^{\circ}$ ) for $x, y \in \mathbb{N}, x \sim y$ means that $x$ and $y$ have the same prime divisors; $\left(2^{\circ}\right)$ for a prime $p$ and integers $r \geq 0$ and $x>0, p^{r} \| x$ means that $x$ is divisible by $p^{r}$, but not by $p^{r+1}$. First, $b^{m}-1 \sim b^{n}-1$ is obviously equivalent to $b^{m}-1 \sim \operatorname{gcd}\left(b^{m}-1, b^{n}-\right.$ $1)=b^{d}-1$, where $d=\operatorname{gcd}(m, n)$. Setting $b^{d}=a$ and $m=k d$, we reduce the condition of the problem to $a^{k}-1 \sim a-1$. We are going to show that this implies that $a+1$ is a power of 2 . This will imply that $d$ is odd (for even $d$, $a+1=b^{d}+1$ cannot be divisible by 4 , and consequently $b+1$, as a divisor of $a+1$, is also a power of 2 . But before that, we need the following important lemma (Theorem 2.126). Lemma. Let $a, k$ be positive integers and $p$ an odd prime. If $\alpha \geq 1$ and $\beta \geq 0$ are such that $p^{\alpha} \| a-1$ and $p^{\beta} \| k$, then $p^{\alpha+\beta} \| a^{k}-1$. Proof. We use induction on $\beta$. If $\beta=0$, then $\frac{a^{k}-1}{a-1}=a^{k-1}+\cdots+a+1 \equiv k$ $(\bmod p)($ because $a \equiv 1$ ), and it is not divisible by $p$. Suppose that the lemma is true for some $\beta \geq 0$, and let $k=p^{\beta+1} t$ where $p \nmid t$. By the induction hypothesis, $a^{k / p}=a^{p^{\beta} t}=m p^{\alpha+\beta}+1$ for some $m$ not divisible by $p$. Furthermore,  $$ a^{k}-1=\left(m p^{\alpha+\beta}+1\right)^{p}-1=\left(m p^{\alpha+\beta}\right)^{p}+\cdots+\binom{p}{2}\left(m p^{\alpha+\beta}\right)^{2}+m p^{\alpha+\beta+1} $$  Since $p \left\lvert\,\binom{ p}{2}=\frac{p(p-1)}{2}\right.$, all summands except for the last one are divisible by $p^{\alpha+\beta+2}$. Hence $p^{\alpha+\beta+1} \| a^{k}-1$, completing the induction. Now let $a^{k}-1 \sim a-1$ for some $a, k>1$. Suppose that $p$ is an odd prime divisor of $k$, with $p^{\beta} \| k$. Then putting $X=a^{p^{\beta}-1}+\cdots+a+1$ we also have $(a-1) X=a^{p^{\beta}}-1 \sim a-1$; hence each prime divisor $q$ of $X$ must also divide $a-1$. But then $a^{i} \equiv 1(\bmod q)$ for each $i \in \mathbb{N}_{0}$, which gives us $X \equiv p^{\beta}(\bmod q)$. Therefore $q \mid p^{\beta}$, i.e., $q=p$; hence $X$ is a power of $p$. On the other hand, since $p \mid a-1$, we put $p^{\alpha} \| a-1$. From the lemma we obtain $p^{\alpha+\beta} \| a^{p^{\beta}}-1$, and deduce that $p^{\beta} \| X$. But $X$ has no prime divisors other than $p$, so we must have $X=p^{\beta}$. This is clearly impossible, because $X>p^{\beta}$ for $a>1$. Thus our assumption that $k$ has an odd prime divisor leads to a contradiction: in other words, $k$ must be a power of 2 . Now $a^{k}-1 \sim a-1$ implies $a-1 \sim a^{2}-1=(a-1)(a+1)$, and thus every prime divisor $q$ of $a+1$ must also divide $a-1$. Consequently $q=2$, so it follows that $a+1$ is a power of 2 . As we explained above, this gives that $b+1$ is also a power of 2 . Remark. In fact, one can continue and show that $k$ must be equal to 2 . It is not possible for $a^{4}-1 \sim a^{2}-1$ to hold. Similarly, we must have $d=1$. Therefore all possible triples $(b, m, n)$ with $m>n$ are $\left(2^{s}-1,2,1\right)$.


15. (RUS) An infinite arithmetic progression whose terms are positive integers contains the square of an integer and the cube of an integer. Show that it contains the sixth power of an integer.

Solution: 15. Let $a+b t, t=0,1,2, \ldots$, be a given arithmetic progression that contains a square and a cube $(a, b>0)$. We use induction on the progression step $b$ to prove that the progression contains a sixth power. (i) $b=1$ : this case is trivial. (ii) $b=p^{m}$ for some prime $p$ and $m>0$. The case $p^{m} \mid a$ trivially reduces to the previous case, so let us have $p^{m} \nmid a$. Suppose that $\operatorname{gcd}(a, p)=1$. If $x, y$ are integers such that $x^{2} \equiv y^{3} \equiv a$ (here all the congruences will be $\bmod p^{m}$ ), then $x^{6} \equiv a^{3}$ and $y^{6} \equiv a^{2}$. Consider an integer $y_{1}$ such that $y y_{1} \equiv 1$. It satisfies $a^{2}\left(x y_{1}\right)^{6} \equiv$ $x^{6} y^{6} y_{1}^{6} \equiv x^{6} \equiv a^{3}$, and consequently $\left(x y_{1}\right)^{6} \equiv a$. Hence a sixth power exists in the progression. If $\operatorname{gcd}(a, p)>1$, we can write $a=p^{k} c$, where $k<m$ and $p \nmid c$. Since the arithmetic progression $x_{t}=a+b t=p^{k}\left(c+p^{m-k} t\right)$ contains a square, $k$ must be even; similarly, it contains a cube, so $3 \mid k$. It follows that $6 \mid k$. The progression $c+p^{m-k} t$ thus also contains a square and a cube; hence by the previous case it contains a sixth power and thus $x_{t}$ does also. (iii) $b$ is not a power of a prime, and thus can be expressed as $b=b_{1} b_{2}$, where $b_{1}, b_{2}>1$ and $\operatorname{gcd}\left(b_{1}, b_{2}\right)=1$. It is given that progressions $a+b_{1} t$ and $a+b_{2} t$ both contain a square and a cube, and therefore by the inductive hypothesis they both contain sixth powers: say $z_{1}^{6}$ and $z_{2}^{6}$, respectively. By the Chinese remainder theorem, there exists $z \in \mathbb{N}$ such that $z \equiv z_{1}\left(\bmod b_{1}\right)$ and $z \equiv z_{2}\left(\bmod b_{2}\right)$. But then $z^{6}$ belongs to both of the progressions $a+b_{1} t$ and $a+b_{2} t$. Hence $z^{6}$ is a member of the progression $a+b t$.


16. (BLR) In an acute-angled triangle $A B C$, let $A D, B E$ be altitudes and $A P, B Q$ internal bisectors. Denote by $I$ and $O$ the incenter and the circumcenter of the triangle, respectively. Prove that the points $D, E$, and $I$ are collinear if and only if the points $P, Q$, and $O$ are collinear.

Solution: 16. Let $d_{a}(X), d_{b}(X), d_{c}(X)$ denote the distances of a point $X$ interior to $\triangle A B C$ from the lines $B C, C A, A B$ respectively. We claim that $X \in P Q$ if and only if $d_{a}(X)+d_{b}(X)=d_{c}(X)$. Indeed, if $X \in P Q$ and $P X=$ $k P Q$ then $d_{a}(X)=k d_{a}(Q), d_{b}(X)=(1-k) d_{b}(P)$, and $d_{c}(X)=(1-$ $k) d_{c}(P)+k d_{c}(Q)$, and simple substitution yields $d_{a}(X)+d_{b}(X)=d_{c}(X)$. The converse follows easily. In particular, $O \in P Q$ if and only if $d_{a}(O)+$ $d_{b}(O)=d_{c}(O)$, i.e., $\cos \alpha+\cos \beta=\cos \gamma$. We shall now show that $I \in D E$ if and only if $A E+B D=D E$. Let $K$ be the point on the segment $D E$ such that $A E=E K$. Then $\angle E K A=$ $\frac{1}{2} \angle D E C=\frac{1}{2} \angle C B A=\angle I B A$; hence the points $A, B, I, K$ are concyclic. The point $I$ lies on $D E$ if and only if $\angle B K D=\angle B A I=\frac{1}{2} \angle B A C=$ $\frac{1}{2} \angle C D E=\angle D B K$, which is equivalent to $K D=B D$, i.e., to $A E+B D=$ $D E$. But since $A E=A B \cos \alpha, B D=A B \cos \beta$, and $D E=A B \cos \gamma$, we have that $I \in D E \Leftrightarrow \cos \alpha+\cos \beta=\cos \gamma$. The conditions for $O \in P Q$ and $I \in D E$ are thus equivalent.  Second solution. We know that three points $X, Y, Z$ are collinear if and only if for some $\lambda, \mu \in \mathbb{R}$ with sum 1 , we have $\lambda \overrightarrow{C X}+\mu \overrightarrow{C Y}=\overrightarrow{C Z}$. Specially, if $\overrightarrow{C X}=p \overrightarrow{C A}$ and $\overrightarrow{C Y}=q \overrightarrow{C B}$ for some $p, q$, and $\overrightarrow{C Z}=k \overrightarrow{C A}+$ $l \overrightarrow{C B}$, then $Z$ lies on $X Y$ if and only if $k q+l p=p q$. Using known relations in a triangle we directly obtain  $$ \begin{array}{rlrl} \overrightarrow{C P} & =\frac{\sin \beta}{\sin \beta+\sin \gamma} \overrightarrow{C B}, & \overrightarrow{C Q}=\frac{\sin \alpha}{\sin \alpha+\sin \gamma} \overrightarrow{C A} \\ \overrightarrow{C O} & =\frac{\sin 2 \alpha \cdot \overrightarrow{C A}+\sin 2 \beta \cdot \overrightarrow{C B}}{\sin 2 \alpha+\sin 2 \beta+\sin 2 \gamma} ; & \overrightarrow{C D}=\frac{\tan \beta}{\tan \beta+\tan \gamma} \overrightarrow{C B} \\ \overrightarrow{C E} & =\frac{\tan \beta}{\tan \beta+\tan \gamma} \overrightarrow{C A}, & \overrightarrow{C I} & =\frac{\sin \alpha \cdot \overrightarrow{C A}+\sin \beta \cdot \overrightarrow{C B}}{\sin \alpha+\sin \beta+\sin \gamma} \end{array} $$  Now by the above considerations we get that the conditions (1) $P, Q, O$ are collinear and (2) $D, E, I$ are collinear are both equivalent to $\cos \alpha+\cos \beta=$ $\cos \gamma$.


17. $(\mathbf{C Z E})^{\mathrm{IMO} 5}$ Find all pairs of integers $x, y \geq 1$ satisfying the equation $x^{y^{2}}=y^{x}$.

Solution: 17. We note first that $x$ and $y$ must be powers of the same positive integer. Indeed, if $x=p_{1}^{\alpha_{1}} \cdots p_{k}^{\alpha_{k}}$ and $y=p_{1}^{\beta_{1}} \cdots p_{k}^{\beta_{k}}$ (some of $\alpha_{i}$ and $\beta_{i}$ may be 0 , but not both for the same index $i$ ), then $x^{y^{2}}=y^{x}$ implies $\frac{\alpha_{i}}{\beta_{i}}=\frac{x}{y^{2}}=\frac{p}{q}$ for some $p, q>0$ with $\operatorname{gcd}(p, q)=1$, so for $a=p_{1}^{\alpha_{1} / p} \cdots p_{k}^{\alpha_{k} / p}$ we can take $x=a^{p}$ and $y=a^{q}$. If $a=1$, then $(x, y)=(1,1)$ is the trivial solution. Let $a>1$. The given equation becomes $a^{p a^{2 q}}=a^{q a^{p}}$, which reduces to $p a^{2 q}=q a^{p}$. Hence $p \neq q$, so we distinguish two cases: (i) $p>q$. Then from $a^{2 q}<a^{p}$ we deduce $p>2 q$. We can rewrite the equation as $p=a^{p-2 q} q$, and putting $p=2 q+d, d>0$, we obtain $d=q\left(a^{d}-2\right)$. By induction, $2^{d}-2>d$ for each $d>2$, so we must have $d \leq 2$. For $d=1$ we get $q=1$ and $a=p=3$, and therefore $(x, y)=(27,3)$, which is indeed a solution. For $d=2$ we get $q=1$, $a=2$, and $p=4$, so $(x, y)=(16,2)$, which is another solution. (ii) $p<q$. As above, we get $q / p=a^{2 q-p}$, and setting $d=2 q-p>0$, this is transformed to $a^{d}=a^{\left(2 a^{d}-1\right) p}$, or equivalently to $d=\left(2 a^{d}-1\right) p$. However, this equality cannot hold, because $2 a^{d}-1>d$ for each $a \geq 2$, $d \geq 1$. The only solutions are thus $(1,1),(16,2)$, and $(27,3)$.


18. (GBR) The altitudes through the vertices $A, B, C$ of an acute-angled triangle $A B C$ meet the opposite sides at $D, E, F$, respectively. The line through $D$ parallel to $E F$ meets the lines $A C$ and $A B$ at $Q$ and $R$, respectively. The line $E F$ meets $B C$ at $P$. Prove that the circumcircle of the triangle $P Q R$ passes through the midpoint of $B C$.

Solution: 18. By symmetry, assume that $A B>A C$. The point $D$ lies between $M$ and $P$ as well as between $Q$ and $R$, and if we show that $D M \cdot D P=D Q \cdot D R$, it will imply that $M, P, Q, R$ lie on a circle. Since the triangles $A B C, A E F, A Q R$ are similar, the points $B, C, Q, R$ lie on a circle. Hence $D B \cdot D C=D Q \cdot D R$, and it remains to prove that  $$ D B \cdot D C=D M \cdot D P $$  However, the points $B, C, E, F$ are concyclic, but so are the points $E, F, D, M$ (they lie on the nine-point circle), and we obtain $P B \cdot P C=$ $P E \cdot P F=P D \cdot P M$. Set $P B=x$ and $P C=y$. We have $P M=\frac{x+y}{2}$ and hence $P D=\frac{2 x y}{x+y}$. It follows that $D B=P B-P D=\frac{x(x-y)}{x+y}$, $D C=\frac{y(x-y)}{x+y}$, and $D M=\frac{(x-y)^{2}}{2(x+y)}$, from which we immediately obtain $D B \cdot D C=D M \cdot D P=\frac{x y(x-y)^{2}}{(x+y)^{2}}$, as needed.


19. (IRE) Let $a_{1} \geq \cdots \geq a_{n} \geq a_{n+1}=0$ be a sequence of real numbers. Prove that  $$ \sqrt{\sum_{k=1}^{n} a_{k}} \leq \sum_{k=1}^{n} \sqrt{k}\left(\sqrt{a_{k}}-\sqrt{a_{k+1}}\right) $$

Solution: 19. Using that $a_{n+1}=0$ we can transform the desired inequality into  $$ \begin{aligned} & \sqrt{a_{1}+}+a_{2}+\cdots+a_{n+1} \\ & \quad \leq \sqrt{1} \sqrt{a_{1}}+(\sqrt{2}-\sqrt{1}) \sqrt{a_{2}}+\cdots+(\sqrt{n+1}-\sqrt{n}) \sqrt{a_{n+1}} \end{aligned} $$  We shall prove by induction on $n$ that (1) holds for any $a_{1} \geq a_{2} \geq \cdots \geq$ $a_{n+1} \geq 0$, i.e., not only when $a_{n+1}=0$. For $n=0$ the inequality is obvious. For the inductive step from $n-1$ to $n$, where $n \geq 1$, we need to prove the inequality  $$ \sqrt{a_{1}+\cdots+a_{n+1}}-\sqrt{a_{1}+\cdots+a_{n}} \leq(\sqrt{n+1}-\sqrt{n}) \sqrt{a_{n+1}} $$  Putting $S=a_{1}+a_{2}+\cdots+a_{n}$, this simplifies to $\sqrt{S+a_{n+1}}-\sqrt{S} \leq$ $\sqrt{n a_{n+1}+a_{n+1}}-\sqrt{n a_{n+1}}$. For $a_{n+1}=0$ the inequality is obvious. For $a_{n+1}>0$ we have that the function $f(x)=\sqrt{x+a_{n+1}}-\sqrt{x}=$ $\frac{a_{n+1}}{\sqrt{x+a_{n+1}}+\sqrt{x}}$ is strictly decreasing on $\mathbb{R}^{+}$; hence (2) will follow if we show that $S \geq n a_{n+1}$. However, this last is true because $a_{1}, \ldots, a_{n} \geq a_{n+1}$. Equality holds if and only if $a_{1}=a_{2}=\cdots=a_{k}$ and $a_{k+1}=\cdots=a_{n+1}=$ 0 for some $k$.  Second solution. Setting $b_{k}=\sqrt{a_{k}}-\sqrt{a_{k+1}}$ for $k=1, \ldots, n$ we have $a_{i}=\left(b_{i}+\cdots+b_{n}\right)^{2}$, so the desired inequality after squaring becomes  $$ \sum_{k=1}^{n} k b_{k}^{2}+2 \sum_{1 \leq k<l \leq n} k b_{k} b_{l} \leq \sum_{k=1}^{n} k b_{k}^{2}+2 \sum_{1 \leq k<l \leq n} \sqrt{k l} b_{k} b_{l}, $$  which clearly holds.


2. (CAN) Let $R_{1}, R_{2}, \ldots$ be the family of finite sequences of positive integers defined by the following rules: $R_{1}=(1)$, and if $R_{n-1}=\left(x_{1}, \ldots, x_{s}\right)$, then  $$ R_{n}=\left(1,2, \ldots, x_{1}, 1,2, \ldots, x_{2}, \ldots, 1,2, \ldots, x_{s}, n\right) $$  For example, $R_{2}=(1,2), R_{3}=(1,1,2,3), R_{4}=(1,1,1,2,1,2,3,4)$. Prove that if $n>1$, then the $k$ th term from the left in $R_{n}$ is equal to 1 if and only if the $k$ th term from the right in $R_{n}$ is different from 1.

Solution: 2. For any sequence $X=\left(x_{1}, x_{2}, \ldots, x_{n}\right)$ let us define  $$ \bar{X}=\left(1,2, \ldots, x_{1}, 1,2, \ldots, x_{2}, \ldots, 1,2, \ldots, x_{n}\right) $$  Also, for any two sequences $A, B$ we denote their concatenation by $A B$. It clearly holds that $\overline{A B}=\bar{A} \bar{B}$. The sequences $R_{1}, R_{2}, \ldots$ are given by $R_{1}=(1)$ and $R_{n}=\overline{R_{n-1}}(n)$ for $n>1$. We consider the family of sequences $Q_{n i}$ for $n, i \in \mathbb{N}, i \leq n$, defined as follows: $Q_{n 1}=(1), \quad Q_{n n}=(n), \quad$ and $\quad Q_{n i}=Q_{n-1, i-1} Q_{n-1, i} \quad$ if $1<i<n$. These sequences form a Pascal-like triangle, as shown in the picture below:  | $Q_{1 i}:$ |  | 1 |  |  |  |  |  |  | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | $Q_{2 i}$ : |  |  |  | 1 |  | 2 |  |  | | $Q_{3 i}$ : |  |  | 1 |  | 12 |  | 3 |  | | $Q_{4 i}$ : |  | 1 |  | 112 |  | 123 |  | 4 | | $Q_{5 i}$ : | 1 |  | 1112 |  | 2123 |  | 1234 |  |  We claim that $R_{n}$ is in fact exactly $Q_{n 1} Q_{n 2} \ldots Q_{n n}$. Before proving this, we observe that $Q_{n i}=\overline{Q_{n-1, i}}$. This follows by induction, because $Q_{n i}=$ $Q_{n-1, i-1} Q_{n-1, i}=\overline{Q_{n-2, i-1}} \overline{Q_{n-2, i}}=\overline{Q_{n-1, i}}$ for $n \geq 3, i \geq 2$ (the cases $i=1$ and $n=1,2$ are trivial). Now $R_{1}=Q_{11}$ and  $$ R_{n}=\overline{R_{n-1}}(n)=\overline{Q_{n-1,1} \ldots Q_{n-1, n-1}}(n)=Q_{n, 1} \ldots Q_{n, n-1} Q_{n, n} $$  for $n \geq 2$, which justifies our claim by induction. Now we know enough about the sequence $R_{n}$ to return to the question of the problem. We use induction on $n$ once again. The result is obvious for $n=1$ and $n=2$. Given any $n \geq 3$, consider the $k$ th elements of $R_{n}$ from the left, say $u$, and from the right, say $v$. Assume that $u$ is a member of $Q_{n j}$, and consequently that $v$ is a member of $Q_{n, n+1-j}$. Then $u$ and $v$ come from symmetric positions of $R_{n-1}$ (either from $Q_{n-1, j}, Q_{n-1, n-j}$, or from $\left.Q_{n-1, j-1}, Q_{n-1, n+1-j}\right)$, and by the inductive hypothesis exactly one of them is 1 .


20. (IRE) Let $D$ be an internal point on the side $B C$ of a triangle $A B C$. The line $A D$ meets the circumcircle of $A B C$ again at $X$. Let $P$ and $Q$ be the feet of the perpendiculars from $X$ to $A B$ and $A C$, respectively, and let $\gamma$ be the circle with diameter $X D$. Prove that the line $P Q$ is tangent to $\gamma$ if and only if $A B=A C$.

Solution: 20. To avoid dividing into cases regarding the position of the point $X$, we use oriented angles. Let $R$ be the foot of the perpendicular from $X$ to $B C$. It is well known that the points $P, Q, R$ lie on the corresponding Simson line. This line is a tangent to $\gamma$ (i.e., the circle $X D R$ ) if and only if $\angle P R D=\angle R X D$. We have  $$ \begin{aligned} \angle P R D & =\angle P X B=90^{\circ}-\angle X B A=90^{\circ}-\angle X B C+\angle A B C \\ & =90^{\circ}-\angle D A C+\angle A B C \end{aligned} $$  and  $$ \angle R X D=90^{\circ}-\angle A D B=90^{\circ}+\angle B C A-\angle D A C $$  hence $\angle P R D=\angle R X D$ if and only if $\angle A B C=\angle B C A$, i.e, $A B=A C$.


21. (RUS) ${ }^{\mathrm{IMO} 3}$ Let $x_{1}, x_{2}, \ldots, x_{n}$ be real numbers satisfying the conditions  $$ \left|x_{1}+x_{2}+\cdots+x_{n}\right|=1 \quad \text { and } \quad\left|x_{i}\right| \leq \frac{n+1}{2} \quad \text { for } \quad i=1,2, \ldots, n $$  Show that there exists a permutation $y_{1}, \ldots, y_{n}$ of the sequence $x_{1}, \ldots, x_{n}$ such that  $$ \left|y_{1}+2 y_{2}+\cdots+n y_{n}\right| \leq \frac{n+1}{2} $$

Solution: 21. For any permutation $\pi=\left(y_{1}, y_{2}, \ldots, y_{n}\right)$ of $\left(x_{1}, x_{2}, \ldots, x_{n}\right)$, denote by $S(\pi)$ the sum $y_{1}+2 y_{2}+\cdots+n y_{n}$. Suppose, contrary to the claim, that $|S(\pi)|>\frac{n+1}{2}$ for any $\pi$. Further, we note that if $\pi^{\prime}$ is obtained from $\pi$ by interchanging two neighboring elements, say $y_{k}$ and $y_{k+1}$, then $S(\pi)$ and $S\left(\pi^{\prime}\right)$ differ by $\left|y_{k}+y_{k+1}\right| \leq n+1$, and consequently they must be of the same sign. Now consider the identity permutation $\pi_{0}=\left(x_{1}, \ldots, x_{n}\right)$ and the reverse permutation $\overline{\pi_{0}}=\left(x_{n}, \ldots, x_{1}\right)$. There is a sequence of permutations $\pi_{0}, \pi_{1}, \ldots, \pi_{m}=\overline{\pi_{0}}$ such that for each $i, \pi_{i+1}$ is obtained from $\pi_{i}$ by interchanging two neighboring elements. Indeed, by successive interchanges we can put $x_{n}$ in the first place, then $x_{n-1}$ in the second place, etc. Hence all $S\left(\pi_{0}\right), \ldots, S\left(\pi_{m}\right)$ are of the same sign. However, since $\left|S\left(\pi_{0}\right)+S\left(\pi_{m}\right)\right|=(n+1)\left|x_{1}+\cdots+x_{n}\right|=n+1$, this implies that one of $S\left(\pi_{0}\right)$ and $S\left(\overline{\pi_{0}}\right)$ is smaller than $\frac{n+1}{2}$ in absolute value, contradicting the initial assumption.


22. (UKR) (a) Do there exist functions $f: \mathbb{R} \rightarrow \mathbb{R}$ and $g: \mathbb{R} \rightarrow \mathbb{R}$ such that  $$ f(g(x))=x^{2} \quad \text { and } \quad g(f(x))=x^{3} \quad \text { for all } x \in \mathbb{R} ? $$  (b) Do there exist functions $f: \mathbb{R} \rightarrow \mathbb{R}$ and $g: \mathbb{R} \rightarrow \mathbb{R}$ such that  $$ f(g(x))=x^{2} \quad \text { and } \quad g(f(x))=x^{4} \quad \text { for all } x \in \mathbb{R} ? $$

Solution: 22. (a) Suppose that $f$ and $g$ are such functions. From $g(f(x))=x^{3}$ we have $f\left(x_{1}\right) \neq f\left(x_{2}\right)$ whenever $x_{1} \neq x_{2}$. In particular, $f(-1), f(0)$, and $f(1)$ are three distinct numbers. However, since $f(x)^{2}=f(g(f(x)))=$ $f\left(x^{3}\right)$, each of the numbers $f(-1), f(0), f(1)$ is equal to its square, and so must be either 0 or 1 . This contradiction shows that no such $f, g$ exist. (b) The answer is yes. We begin with constructing functions $F, G:(1, \infty)$ $\rightarrow(1, \infty)$ with the property $F(G(x))=x^{2}$ and $G(F(x))=x^{4}$ for $x>$ 1. Define the functions $\varphi, \psi$ by $F\left(2^{2^{t}}\right)=2^{2^{\varphi(t)}}$ and $G\left(2^{2^{t}}\right)=2^{2^{\psi(t)}}$. These functions determine $F$ and $G$ on the entire interval $(1, \infty)$, and satisfy $\varphi(\psi(t))=t+1$ and $\psi(\varphi(t))=t+2$. It is easy to find examples of $\varphi$ and $\psi$ : for example, $\varphi(t)=\frac{1}{2} t+1, \psi(t)=2 t$. Thus we also arrive at an example for $F, G$ :  $$ F(x)=2^{2^{\frac{1}{2} \log _{2} \log _{2} x+1}}=2^{2 \sqrt{\log _{2} x}}, \quad G(x)=2^{2^{2 \log _{2} \log _{2} x}}=2^{\log _{2}^{2} x} $$  It remains only to extend these functions to the whole of $\mathbb{R}$. This can be done as follows:  $$ \widetilde{f}(x)= \begin{cases}F(x) & \text { for } x>1 \\ 1 / F(1 / x) & \text { for } 0<x<1, \widetilde{g}(x)=\left\{\begin{array} { c l }  { G ( x ) } & { \text { for } x > 1 } \\ { x } & { \text { for } x \in \{ 0 , 1 \} ; } \end{array} \left\{\begin{array}{cl} 1 / G(1 / x) & \text { for } 0<x<1 \\ x & \text { for } x \in\{0,1\} \end{array}\right.\right.\end{cases} $$  and then $\quad f(x)=\widetilde{f}(|x|), \quad g(x)=\widetilde{g}(|x|) \quad$ for $x \in \mathbb{R}$. It is directly verified that these functions have the required property.


23. (GBR) Let $A B C D$ be a convex quadrilateral and $O$ the intersection of its diagonals $A C$ and $B D$. If  $$ O A \sin \angle A+O C \sin \angle C=O B \sin \angle B+O D \sin \angle D, $$  prove that $A B C D$ is cyclic.

Solution: 23. Let $K, L, M$, and $N$ be the projections of $O$ onto the lines $A B, B C, C D$, and $D A$, and let $\alpha_{1}, \alpha_{2}, \alpha_{3}, \alpha_{4}, \beta_{1}, \beta_{2}, \beta_{3}, \beta_{4}$ denote the angles $O A B$, $O B C, O C D, O D A, O A D, O B A, O C B, O D C$, respectively. We start with the following observation: Since $N K$ is a chord of the circle with diameter $O A$, we have $O A \sin \angle A=N K=O N \cos \alpha_{1}+O K \cos \beta_{1}$ (because $\angle O N K=\alpha_{1}$ and $\angle O K N=\beta_{1}$ ). Analogous equalities also hold: $O B \sin \angle B=K L=O K \cos \alpha_{2}+O L \cos \beta_{2}, O C \sin \angle C=L M=$ $O L \cos \alpha_{3}+O M \cos \beta_{3}$ and $O D \sin \angle D=M N=O M \cos \alpha_{4}+O N \cos \beta_{4}$. Now the condition in the problem can be restated as $N K+L M=K L+$ $M N$ (i.e., $K L M N$ is circumscribed), i.e.,  $$ \begin{aligned} O K\left(\cos \beta_{1}-\cos \alpha_{2}\right)+O L\left(\cos \alpha_{3}-\cos \beta_{2}\right) \\ +O M\left(\cos \beta_{3}-\cos \alpha_{4}\right)+O N\left(\cos \alpha_{1}-\cos \beta_{4}\right)=0 \end{aligned} $$  To prove that $A B C D$ is cyclic, it suffices to show that $\alpha_{1}=\beta_{4}$. Assume the contrary, and let w.l.o.g. $\alpha_{1}>\beta_{4}$. Then point $A$ lies inside the circle $B C D$, which is further equivalent to $\beta_{1}>\alpha_{2}$. On the other hand, from $\alpha_{1}+\beta_{2}=\alpha_{3}+\beta_{4}$ we deduce $\alpha_{3}>\beta_{2}$, and similarly $\beta_{3}>\alpha_{4}$. Therefore, since the cosine is strictly decreasing on $(0, \pi)$, the left side of (1) is strictly negative, yielding a contradiction.


24. (LIT) ${ }^{\mathrm{IMO} 6}$ For a positive integer $n$, let $f(n)$ denote the number of ways to represent $n$ as the sum of powers of 2 with nonnegative integer exponents. Representations that differ only in the ordering in their summands are not considered to be distinct. (For instance, $f(4)=4$ because the number 4 can be represented in the following four ways: $4 ; 2+2 ; 2+1+1 ; 1+1+1+1$.) Prove that the inequality  $$ 2^{n^{2} / 4}<f\left(2^{n}\right)<2^{n^{2} / 2} $$  holds for any integer $n \geq 3$.

Solution: 24. There is a bijective correspondence between representations in the given form of $2 k$ and $2 k+1$ for $k=0,1, \ldots$, since adding 1 to every representation of $2 k$, we obtain a representation of $2 k+1$, and conversely, every representation of $2 k+1$ contains at least one 1 , which can be removed. Hence, $f(2 k+1)=f(2 k)$. Consider all representations of $2 k$. The number of those that contain at least one 1 equals $f(2 k-1)=f(2 k-2)$, while the number of those not containing a 1 equals $f(k)$ (the correspondence is given by division of summands by 2). Therefore  $$ f(2 k)=f(2 k-2)+f(k) . $$  Summing these equalities over $k=1, \ldots, n$, we obtain  $$ f(2 n)=f(0)+f(1)+\cdots+f(n) $$  We first prove the right-hand inequality. Since $f$ is increasing, and $f(0)+$ $f(1)=f(2)$, (2) yields $f(2 n) \leq n f(n)$ for $n \geq 2$. Now $f\left(2^{3}\right)=f(0)+$ $\cdots+f(4)=10<2^{3^{2} / 2}$, and one can easily conclude by induction that $f\left(2^{n+1}\right) \leq 2^{n} f\left(2^{n}\right)<2^{n} \cdot 2^{n^{2} / 2}<2^{(n+1)^{2} / 2}$ for each $n \geq 3$. We now derive the lower estimate. It follows from (1) that $f(x+2)-f(x)$ is increasing. Consequently, for each $m$ and $k<m$ we have $f(2 m+2 k)-$ $f(2 m) \geq f(2 m+2 k-2)-f(2 m-2) \geq \cdots \geq f(2 m)-f(2 m-2 k)$, so $f(2 m+2 k)+f(2 m-2 k) \geq 2 f(2 m)$. Adding all these inequalities for $k=1,2, \ldots, m$, we obtain $f(0)+f(2)+\cdots+f(4 m) \geq(2 m+1) f(2 m)$. But since $f(2)=f(3), f(4)=f(5)$ etc., we also have $f(1)+f(3)+\cdots+$ $f(4 m-1)>(2 m-1) f(2 m)$, which together with the above inequality gives  $$ f(8 m)=f(0)+f(1)+\cdots+f(4 m)>4 m f(2 m) . $$  Finally, we have that the inequality $f\left(2^{n}\right)>2^{n^{2} / 4}$ holds for $n=2$ and $n=3$, while for larger $n$ we have by induction $f\left(2^{n}\right)>2^{n-1} f\left(2^{n-2}\right)>$ $2^{n-1+(n-2)^{2} / 4}=2^{n^{2} / 4}$. This completes the proof. Remark. Despite the fact that the lower estimate is more difficult, it is much weaker than the upper estimate. It can be shown that $f\left(2^{n}\right)$ eventually (for large $n$ ) exceeds $2^{c n^{2}}$ for any $c<\frac{1}{2}$.


25. (POL) The bisectors of angles $A, B, C$ of a triangle $A B C$ meet its circumcircle again at the points $K, L, M$, respectively. Let $R$ be an internal point on the side $A B$. The points $P$ and $Q$ are defined by the following conditions: $R P$ is parallel to $A K$, and $B P$ is perpendicular to $B L ; R Q$ is parallel to $B L$, and $A Q$ is perpendicular to $A K$. Show that the lines $K P, L Q, M R$ have a point in common.

Solution: 25. Let $M R$ meet the circumcircle of triangle $A B C$ again at a point $X$. We claim that $X$ is the common point of the lines $K P, L Q, M R$. By symmetry, it will be enough to show that $X$ lies on $K P$. It is easy to see that $X$ and $P$ lie on the same side of $A B$ as $K$. Let $I_{a}=A K \cap B P$ be the excenter of $\triangle A B C$ corresponding to $A$. It is easy to calculate that $\angle A I_{a} B=\gamma / 2$, from which we get $\angle R P B=\angle A I_{a} B=\angle M C B=\angle R X B$. Therefore $R, B, P, X$ are concyclic. Now if $P$ and $K$ are on distinct sides of $B X$ (the other case is similar), we have $\angle R X P=180^{\circ}-\angle R B P=90^{\circ}-$ $\beta / 2=\angle M A K=180^{\circ}-\angle R X K$, from which it follows that $K, X, P$ are collinear, as claimed. Remark. It is not essential for the statement of the problem that $R$ be an internal point of $A B$. Work with cases can be avoided using oriented ![](https://cdn.mathpix.com/cropped/2024_11_18_8e985d6b9c83aa3e9d0eg-640.jpg?height=399&width=439&top_left_y=248&top_left_x=858) angles.


26. (ITA) For every integer $n \geq 2$ determine the minimum value that the sum $a_{0}+a_{1}+\cdots+a_{n}$ can take for nonnegative numbers $a_{0}, a_{1}, \ldots, a_{n}$ satisfying the condition  $$ a_{0}=1, \quad a_{i} \leq a_{i+1}+a_{i+2} \quad \text { for } i=0, \ldots, n-2 $$  ### 3.39 The Thirty-Ninth IMO

Solution: 26. Let us first examine the case that all the inequalities in the problem are actually equalities. Then $a_{n-2}=a_{n-1}+a_{n}, a_{n-3}=2 a_{n-1}+a_{n}, \ldots, a_{0}=$ $F_{n} a_{n-1}+F_{n-1} a_{n}=1$, where $F_{n}$ is the $n$th Fibonacci number. Then it is easy to see (from $F_{1}+F_{2}+\cdots+F_{k}=F_{k+2}$ ) that $a_{0}+\cdots+a_{n}=$ $\left(F_{n+2}-1\right) a_{n-1}+F_{n+1} a_{n}=\frac{F_{n+2}-1}{F_{n}}+\left(F_{n+1}-\frac{F_{n-1}\left(F_{n+2}-1\right)}{F_{n}}\right) a_{n}$. Since $\frac{F_{n-1}\left(F_{n+2}-1\right)}{F_{n}} \leq F_{n+1}$, it follows that $a_{0}+a_{1}+\cdots+a_{n} \geq \frac{F_{n+2}-1}{F_{n}}$, with equality holding if and only if $a_{n}=0$ and $a_{n-1}=\frac{1}{F_{n}}$. We denote by $M_{n}$ the required minimum in the general case. We shall prove by induction that $M_{n}=\frac{F_{n+2}-1}{F_{n}}$. For $M_{1}=1$ and $M_{2}=2$ it is easy to show that the formula holds; hence the inductive basis is true. Suppose that $n>2$. The sequences $1, \frac{a_{2}}{a_{1}}, \ldots, \frac{a_{n}}{a_{1}}$ and $1, \frac{a_{3}}{a_{2}}, \ldots, \frac{a_{n}}{a_{2}}$ also satisfy the conditions of the problem. Hence we have  $$ a_{0}+\cdots+a_{n}=a_{0}+a_{1}\left(1+\frac{a_{2}}{a_{1}}+\cdots+\frac{a_{n}}{a_{1}}\right) \geq 1+a_{1} M_{n-1} $$  and  $$ a_{0}+\cdots+a_{n}=a_{0}+a_{1}+a_{2}\left(1+\frac{a_{3}}{a_{2}}+\cdots+\frac{a_{n}}{a_{2}}\right) \geq 1+a_{1}+a_{2} M_{n-2} $$  Multiplying the first inequality by $M_{n-2}-1$ and the second one by $M_{n-1}$, adding the inequalities and using that $a_{1}+a_{2} \geq 1$, we obtain ( $M_{n-1}+$ $\left.M_{n-2}+1\right)\left(a_{0}+\cdots+a_{n}\right) \geq M_{n-1} M_{n-2}+M_{n-1}+M_{n-2}+1$, so  $$ M_{n} \geq \frac{M_{n-1} M_{n-2}+M_{n-1}+M_{n-2}+1}{M_{n-1}+M_{n-2}+1} $$  Since $M_{n-1}=\frac{F_{n+1}-1}{F_{n-1}}$ and $M_{n-2}=\frac{F_{n}-1}{F_{n-2}}$, the above inequality easily yields $M_{n} \geq \frac{F_{n+2}-1}{F_{n}}$. However, we have shown above that equality can occur; hence $\frac{F_{n+2}-1}{F_{n}}$ is indeed the required minimum.


3. (GER) For each finite set $U$ of nonzero vectors in the plane we define $l(U)$ to be the length of the vector that is the sum of all vectors in $U$. Given a finite set $V$ of nonzero vectors in the plane, a subset $B$ of $V$ is said to be maximal if $l(B)$ is greater than or equal to $l(A)$ for each nonempty subset $A$ of $V$. (a) Construct sets of 4 and 5 vectors that have 8 and 10 maximal subsets respectively. (b) Show that for any set $V$ consisting of $n \geq 1$ vectors, the number of maximal subsets is less than or equal to $2 n$.

Solution: 3. (a) For $n=4$, consider a convex quadrilateral $A B C D$ in which $A B=$ $B C=A C=B D$ and $A D=D C$, and take the vectors $\overrightarrow{A B}, \overrightarrow{B C}$, $\overrightarrow{C D}, \overrightarrow{D A}$. For $n=5$, take the vectors $\overrightarrow{A B}, \overrightarrow{B C}, \overrightarrow{C D}, \overrightarrow{D E}, \overrightarrow{E A}$ for any regular pentagon $A B C D E$. (b) Let us draw the vectors of $V$ as originated from the same point $O$. Consider any maximal subset $B \subset V$, and denote by $u$ the sum of all vectors from $B$. If $l$ is the line through $O$ perpendicular to $u$, then $B$ contains exactly those vectors from $V$ that lie on the same side of $l$ as $u$ does, and no others. Indeed, if any $v \notin B$ lies on the same side of $l$, then $|u+v| \geq|u|$; similarly, if some $v \in B$ lies on the other side of $l$, then $|u-v| \geq|u|$. Therefore every maximal subset is determined by some line $l$ as the set of vectors lying on the same side of $l$. It is obvious that in this way we get at most $2 n$ sets.


4. (IRN) ${ }^{\mathrm{IMO} 4} \mathrm{An} n \times n$ matrix with entries from $\{1,2, \ldots, 2 n-1\}$ is called a coveralls matrix if for each $i$ the union of the $i$ th row and the $i$ th column contains $2 n-1$ distinct entries. Show that: (a) There exist no coveralls matrices for $n=1997$. (b) Coveralls matrices exist for infinitely many values of $n$.

Solution: 4. (a) Suppose that an $n \times n$ coveralls matrix $A$ exists for some $n>1$. Let $x \in\{1,2, \ldots, 2 n-1\}$ be a fixed number that does not appear on the fixed diagonal of $A$. Such an element must exist, since the diagonal can contain at most $n$ different numbers. Let us call the union of the $i$ th row and the $i$ th column the $i$ th cross. There are $n$ crosses, and each of them contains exactly one $x$. On the other hand, each entry $x$ of $A$ is contained in exactly two crosses. Hence $n$ must be even. However, 1997 is an odd number; hence no coveralls matrix exists for $n=1997$. (b) For $n=2, A_{2}=\left[\begin{array}{ll}1 & 2 \\ 3 & 1\end{array}\right]$ is a coveralls matrix. For $n=4$, one such matrix is, for example,  $$ A_{4}=\left[\begin{array}{llll} 1 & 2 & 5 & 6 \\ 3 & 1 & 7 & 5 \\ 4 & 6 & 1 & 2 \\ 7 & 4 & 3 & 1 \end{array}\right] $$  This construction can be generalized. Suppose that we are given an $n \times n$ coveralls matrix $A_{n}$. Let $B_{n}$ be the matrix obtained from $A_{n}$ by adding $2 n$ to each entry, and $C_{n}$ the matrix obtained from $B_{n}$ by replacing each diagonal entry (equal to $2 n+1$ by induction) with $2 n$. Then the matrix  $$ A_{2 n}=\left[\begin{array}{ll} A_{n} & B_{n} \\ C_{n} & A_{n} \end{array}\right] $$  is coveralls. To show this, suppose that $i \leq n$ (the case $i>n$ is similar). The $i$ th cross is composed of the $i$ th cross of $A_{n}$, the $i$ th row of $B_{n}$, and the $i$ th column of $C_{n}$. The $i$ th cross of $A_{i}$ covers $1,2, \ldots, 2 n-1$. The $i$ th row of $B_{n}$ covers all numbers of the form $2 n+j$, where $j$ is covered by the $i$ th row of $A_{n}$ (including $j=1$ ). Similarly, the $i$ th column of $C_{n}$ covers $2 n$ and all numbers of the form $2 n+k$, where $k>1$ is covered by the $i$ th column of $A_{n}$. Thus we see that all numbers are accounted for in the $i$ th cross of $A_{2 n}$, and hence $A_{2 n}$ is a desired coveralls matrix. It follows that we can find a coveralls matrix whenever $n$ is a power of 2 . Second solution for part $b$. We construct a coveralls matrix explicitly for $n=2^{k}$. We consider the coordinates/cells of the matrix elements modulo $n$ throughout the solution. We define the $i$-diagonal $(0 \leq i<$ $n$ ) to be the set of cells of the form $(j, j+i)$, for all $j$. We note that each cross contains exactly one cell from the 0 -diagonal (the main diagonal) and two cells from each $i$-diagonal. For two cells within an $i$ diagonal, $x$ and $y$, we define $x$ and $y$ to be related if there exists a cross containing both $x$ and $y$. Evidently, for every cell $x$ not on the 0 -diagonal there are exactly two other cells related to it. The relation thus breaks up each $i$-diagonal $(i>0)$ into cycles of length larger than 1 . Due to the diagonal translational symmetry (modulo $n$ ), all the cycles within a given $i$-diagonal must be of equal length and thus of an even length, since $n=2^{k}$. The construction of a coveralls matrix is now obvious. We select a number, say 1, to place on all the cells of the 0-diagonal. We pair up the remaining numbers and assign each pair to an $i$-diagonal, say $(2 i, 2 i+1)$. Going along each cycle within the $i$-diagonal we alternately assign values of $2 i$ and $2 i+1$. Since the cycle has an even length, a cell will be related only to a cell of a different number, and hence each cross will contain both $2 i$ and $2 i+1$.


5. (ROM) Let $A B C D$ be a regular tetrahedron and $M, N$ distinct points in the planes $A B C$ and $A D C$ respectively. Show that the segments $M N, B N, M D$ are the sides of a triangle.

Solution: 5. We shall prove first the 2-dimensional analogue:  Lemma. Given an equilateral triangle $A B C$ and two points $M, N$ on the sides $A B$ and $A C$ respectively, there exists a triangle with sides $C M, B N, M N$. Proof. Consider a regular tetrahedron $A B C D$. Since $C M=D M$ and $B N=D N$, one such triangle is $D M N$.  Now, to solve the problem for a regular tetrahedron $A B C D$, we consider a 4-dimensional polytope $A B C D E$ whose faces $A B C D, A B C E, A B D E$, $A C D E, B C D E$ are regular tetrahedra. We don't know what it looks like, but it yields a desired triangle: for $M \in A B C$ and $N \in A D C$, we have $D M=E M$ and $B N=E N$; hence the desired triangle is $E M N$. Remark. A solution that avoids embedding in $\mathbb{R}^{4}$ is possible, but no longer so short.


6. (IRE) (a) Let $n$ be a positive integer. Prove that there exist distinct positive integers $x, y, z$ such that  $$ x^{n-1}+y^{n}=z^{n+1} . $$  (b) Let $a, b, c$ be positive integers such that $a$ and $b$ are relatively prime and $c$ is relatively prime either to $a$ or to $b$. Prove that there exist infinitely many triples $(x, y, z)$ of distinct positive integers $x, y, z$ such that  $$ x^{a}+y^{b}=z^{c} . $$  Original formulation: Let $a, b, c, n$ be positive integers such that $n$ is odd and $a c$ is relatively prime to $2 b$. Prove that there exist distinct positive integers $x, y, z$ such that (i) $x^{a}+y^{b}=z^{c}$, and (ii) $x y z$ is relatively prime to $n$.

Solution: 6. (a) One solution is  $$ x=2^{n^{2}} 3^{n+1}, \quad y=2^{n^{2}-n} 3^{n}, \quad z=2^{n^{2}-2 n+2} 3^{n-1} . $$  (b) Suppose w.l.o.g. that $\operatorname{gcd}(c, a)=1$. We look for a solution of the form  $$ x=p^{m}, \quad y=p^{n}, \quad z=q p^{r}, \quad p, q, m, n, r \in \mathbb{N} . $$  Then $x^{a}+y^{b}=p^{m a}+p^{n b}$ and $z^{c}=q^{c} p^{r c}$, and we see that it is enough to assume $m a-1=n b=r c$ (there are infinitely many such triples $(m, n, r))$ and $q^{c}=p+1$.


7. (RUS) Let $A B C D E F$ be a convex hexagon such that $A B=B C, C D=$ $D E, E F=F A$. Prove that  $$ \frac{B C}{B E}+\frac{D E}{D A}+\frac{F A}{F C} \geq \frac{3}{2} $$  When does equality occur?

Solution: 7. Let us set $A C=a, C E=b, E A=c$. Applying Ptolemy's inequality for the quadrilateral $A C E F$ we get  $$ A C \cdot E F+C E \cdot A F \geq A E \cdot C F $$  Since $E F=A F$, this implies $\frac{F A}{F C} \geq \frac{c}{a+b}$. Similarly $\frac{B C}{B E} \geq \frac{a}{b+c}$ and $\frac{D E}{D A} \geq$ $\frac{b}{c+a}$. Now,  $$ \frac{B C}{B E}+\frac{D E}{D A}+\frac{F A}{F C} \geq \frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b} $$  Hence it is enough to prove that  $$ \frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b} \geq \frac{3}{2} $$  If we now substitute $x=b+c, y=c+a, z=a+b$ and $S=a+b+c$ the inequality (1) becomes equivalent to $S(1 / x+1 / y+1 / y)-3 \geq 3 / 2$ which follows immediately form $1 / x+1 / y+1 / z \geq 9 /(x+y+z)=9 /(2 S)$. Equality occurs if it holds in Ptolemy's inequalities and also $a=b=c$. The former happens if and only if the hexagon is cyclic. Hence the only case of equality is when $A B C D E F$ is regular.


8. (GBR) ${ }^{\mathrm{IMO} 2}$ Four different points $A, B, C, D$ are chosen on a circle $\Gamma$ such that the triangle $B C D$ is not right-angled. Prove that: (a) The perpendicular bisectors of $A B$ and $A C$ meet the line $A D$ at certain points $W$ and $V$, respectively, and that the lines $C V$ and $B W$ meet at a certain point $T$. (b) The length of one of the line segments $A D, B T$, and $C T$ is the sum of the lengths of the other two. Original formulation. In triangle $A B C$ the angle at $A$ is the smallest. A line through $A$ meets the circumcircle again at the point $U$ lying on the $\operatorname{arc} B C$ opposite to $A$. The perpendicular bisectors of $C A$ and $A B$ meet $A U$ at $V$ and $W$, respectively, and the lines $C V, B W$ meet at $T$. Show that $A U=T B+T C$.

Solution: 8. (a) Denote by $b$ and $c$ the perpendicular bisectors of $A B$ and $A C$ respectively. If w.l.o.g. $b$ and $A D$ do not intersect (are parallel), then $\angle B C D=\angle B A D=90^{\circ}$, a contradiction. Hence $V, W$ are well-defined. Now, $\angle D W B=2 \angle D A B$ and $\angle D V C=2 \angle D A C$ as oriented angles, and therefore $\angle(W B, V C)=2(\angle D V C-\angle D W B)=2 \angle B A C=$ $2 \angle B C D$ is not equal to 0 . Consequently $C V$ and $B W$ meet at some $T$ with $\angle B T C=2 \angle B A C$. (b) Let $B^{\prime}$ be the second point of intersection of $B W$ with $\Gamma$. Clearly $A D=B B^{\prime}$. But we also have $\angle B T C=2 \angle B A C=2 \angle B B^{\prime} C$, which implies that $C T=T B^{\prime}$. It follows that $A D=B B^{\prime}=\left|B T \pm T B^{\prime}\right|=$ $|B T \pm C T|$. Remark. This problem is also solved easily using trigonometry.


9. (USA) Let $A_{1} A_{2} A_{3}$ be a nonisosceles triangle with incenter $I$. Let $C_{i}$, $i=1,2,3$, be the smaller circle through $I$ tangent to $A_{i} A_{i+1}$ and $A_{i} A_{i+2}$ (the addition of indices being mod 3 ). Let $B_{i}, i=1,2,3$, be the second point of intersection of $C_{i+1}$ and $C_{i+2}$. Prove that the circumcenters of the triangles $A_{1} B_{1} I, A_{2} B_{2} I, A_{3} B_{3} I$ are collinear.

Solution: 9. For $i=1,2,3$ (all indices in this problem will be modulo 3 ) we denote by $O_{i}$ the center of $C_{i}$ and by $M_{i}$ the midpoint of the $\operatorname{arc} A_{i+1} A_{i+2}$ that does not contain $A_{i}$. First we have that $O_{i+1} O_{i+2}$ is the perpendicular bisector of $I B_{i}$, and thus it contains the circumcenter $R_{i}$ of $A_{i} B_{i} I$. Additionally, it is easy to show that $T_{i+1} A_{i}=T_{i+1} I$ and $T_{i+2} A_{i}=$ $T_{i+2} I$, which implies that $R_{i}$ lies on the line $T_{i+1} T_{i+2}$. Therefore $R_{i}=$ $O_{i+1} O_{i+2} \cap T_{i+1} T_{i+2}$. ![](https://cdn.mathpix.com/cropped/2024_11_18_8e985d6b9c83aa3e9d0eg-631.jpg?height=360&width=548&top_left_y=579&top_left_x=806)  Now, the lines $T_{1} O_{1}, T_{2} O_{2}, T_{3} O_{3}$ are concurrent at $I$. By Desargues's theorem, the points of intersection of $O_{i+1} O_{i+2}$ and $T_{i+1} T_{i+2}$, i.e., the $R_{i}$ 's, lie on a line for $i=1,2,3$.  Second solution. The centers of three circles passing through the same point $I$ and not touching each other are collinear if and only if they have another common point. Hence it is enough to show that the circles $A_{i} B_{i} I$ have a common point other than $I$. Now apply inversion at center $I$ and with an arbitrary power. We shall denote by $X^{\prime}$ the image of $X$ under this inversion. In our case, the image of the circle $C_{i}$ is the line $B_{i+1}^{\prime} B_{i+2}^{\prime}$ while the image of the line $A_{i+1} A_{i+2}$ is the circle $I A_{i+1}^{\prime} A_{i+2}^{\prime}$ that is tangent to $B_{i}^{\prime} B_{i+2}^{\prime}$, and $B_{i}^{\prime} B_{i+2}^{\prime}$. These three circles have equal radii, so their centers $P_{1}, P_{2}, P_{3}$ form a triangle also homothetic to $\triangle B_{1}^{\prime} B_{2}^{\prime} B_{3}^{\prime}$. Consequently, points $A_{1}^{\prime}, A_{2}^{\prime}, A_{3}^{\prime}$, that are the reflections of $I$ across the sides of $P_{1} P_{2} P_{3}$, are vertices of a triangle also homothetic to $B_{1}^{\prime} B_{2}^{\prime} B_{3}^{\prime}$. It follows that $A_{1}^{\prime} B_{1}^{\prime}, A_{2}^{\prime} B_{2}^{\prime}, A_{3}^{\prime} B_{3}^{\prime}$ are concurrent at some point $J^{\prime}$, i.e., that the circles $A_{i} B_{i} I$ all pass through $J$.


1. (LUX) ${ }^{\mathrm{IMO}} \mathrm{A}$ convex quadrilateral $A B C D$ has perpendicular diagonals. The perpendicular bisectors of $A B$ and $C D$ meet at a unique point $P$ inside $A B C D$. Prove that $A B C D$ is cyclic if and only if triangles $A B P$ and $C D P$ have equal areas.

Solution: 1. We begin with the following observation: Suppose that $P$ lies in $\triangle A E B$, where $E$ is the intersection of $A C$ and $B D$ (the other cases are similar). Let $M, N$ be the feet of the perpendiculars from $P$ to $A C$ and $B D$ respectively. We have $S_{A B P}=S_{A B E}-S_{A E P}-S_{B E P}=\frac{1}{2}(A E \cdot B E-A E \cdot E N-B E$. $E M)=\frac{1}{2}(A M \cdot B N-E M \cdot E N)$. Similarly, $S_{C D P}=\frac{1}{2}(C M \cdot D N-E M$. $E N)$. Therefore, we obtain  $$ S_{A B P}-S_{C D P}=\frac{A M \cdot B N-C M \cdot D N}{2} $$  Now suppose that $A B C D$ is cyclic. Then $P$ is the circumcenter of $A B C D$; hence $M$ and $N$ are the midpoints of $A C$ and $B D$. Hence $A M=C M$ and $B N=D N$; thus (1) gives us $S_{A B P}=S_{C D P}$. On the other hand, suppose that ![](https://cdn.mathpix.com/cropped/2024_11_18_8e985d6b9c83aa3e9d0eg-641.jpg?height=311&width=410&top_left_y=703&top_left_x=875) $A B C D$ is not cyclic and let w.l.o.g. $P A=P B>P C=P D$. Then we must have $A M>C M$ and $B N>$ $D N$, and consequently by (1), $S_{A B P}>S_{C D P}$. This proves the other implication.  Second solution. Let $F$ and $G$ denote the midpoints of $A B$ and $C D$, and assume that $P$ is on the same side of $F G$ as $B$ and $C$. Since $P F \perp A B$, $P G \perp C D$, and $\angle F E B=\angle A B E, \angle G E C=\angle D C E$, a direct computation yields $\angle F P G=\angle F E G=90^{\circ}+\angle A B E+\angle D C E$. Taking into account that $S_{A B P}=\frac{1}{2} A B \cdot F P=F E \cdot F P$, we note that $S_{A B P}=S_{C D P}$ is equivalent to $F E \cdot F P=G E \cdot G P$, i.e., to $F E / E G=$ $G P / P F$. But this last is equivalent to triangles $E F G$ and $P G F$ being similar, which holds if and only if $E F P G$ is a parallelogram. This last is equivalent to $\angle E F P=\angle E G P$, or $2 \angle A B E=2 \angle D C E$. Thus $S_{A B P}=$ $S_{C D P}$ is equivalent to $A B C D$ being cyclic. Remark. The problems also allows an analytic solution, for example putting the $x$ and $y$ axes along the diagonals $A C$ and $B D$.


10. (AUS) Let $r_{1}, r_{2}, \ldots, r_{n}$ be real numbers greater than or equal to 1 . Prove that  $$ \frac{1}{r_{1}+1}+\frac{1}{r_{2}+1}+\cdots+\frac{1}{r_{n}+1} \geq \frac{n}{\sqrt[n]{r_{1} r_{2} \cdots r_{n}}+1} $$

Solution: 10. We shall first prove the inequality for $n$ of the form $2^{k}, k=0,1,2, \ldots$ The case $k=0$ is clear. For $k=1$, we have  $$ \frac{1}{r_{1}+1}+\frac{1}{r_{2}+1}-\frac{2}{\sqrt{r_{1} r_{2}}+1}=\frac{\left(\sqrt{r_{1} r_{2}}-1\right)\left(\sqrt{r_{1}}-\sqrt{r_{2}}\right)^{2}}{\left(r_{1}+1\right)\left(r_{2}+1\right)\left(\sqrt{r_{1} r_{2}}+1\right)} \geq 0 $$  For the inductive step it suffices to show that the claim for $k$ and 2 implies that for $k+1$. Indeed,  $$ \begin{aligned} \sum_{i=1}^{2^{k+1}} \frac{1}{r_{i}+1} & \geq \frac{2^{k}}{\sqrt[2^{k}]{r_{1} r_{2} \cdots r_{2^{k}}}+1}+\frac{2^{k}}{\sqrt[2^{k}]{r_{2^{k}+1^{\prime} r_{2^{k}}+2^{\cdots r_{2^{k+1}}}+1}}} \\ & \geq \frac{2^{k+1}}{\sqrt[2^{k+1}]{r_{1} r_{2} \cdots r_{2^{k+1}}}+1} \end{aligned} $$  and the induction is complete. We now show that if the statement holds for $2^{k}$, then it holds for every $n<2^{k}$ as well. Put $r_{n+1}=r_{n+2}=\cdots=r_{2^{k}}=\sqrt[n]{r_{1} r_{2} \ldots r_{n}}$. Then (1) becomes  $$ \frac{1}{r_{1}+1}+\cdots+\frac{1}{r_{n}+1}+\frac{2^{k}-n}{\sqrt[n]{r_{1} \cdots r_{n}}+1} \geq \frac{2^{k}}{\sqrt[n]{r_{1} \cdots r_{n}}+1} $$  This proves the claim. Second solution. Define $r_{i}=e^{x_{i}}$, where $x_{i}>0$. The function $f(x)=\frac{1}{1+e^{x}}$ is convex for $x>0$ : indeed, $f^{\prime \prime}(x)=\frac{e^{x}\left(e^{x}-1\right)}{\left(e^{x}+1\right)^{3}}>0$. Thus by Jensen's inequality applied to $f\left(x_{1}\right), \ldots, f\left(x_{n}\right)$, we get $\frac{1}{r_{1}+1}+\cdots+\frac{1}{r_{n}+1} \geq \frac{n}{\sqrt[n]{r_{1} \cdots r_{n}}+1}$.


11. (RUS) Let $x, y$, and $z$ be positive real numbers such that $x y z=1$. Prove that  $$ \frac{x^{3}}{(1+y)(1+z)}+\frac{y^{3}}{(1+z)(1+x)}+\frac{z^{3}}{(1+x)(1+y)} \geq \frac{3}{4} $$

Solution: 11. The given inequality is equivalent to $x^{3}(x+1)+y^{3}(y+1)+z^{3}(z+1) \geq$ $\frac{3}{4}(x+1)(y+1)(z+1)$. By the A-G mean inequality, it will be enough to prove a stronger inequality:  $$ x^{4}+x^{3}+y^{4}+y^{3}+z^{4}+z^{3} \geq \frac{1}{4}\left[(x+1)^{3}+(y+1)^{3}+(z+1)^{3}\right] . $$  If we set $S_{k}=x^{k}+y^{k}+z^{k}$, (1) takes the form $S_{4}+S_{3} \geq \frac{1}{4} S_{3}+\frac{3}{4} S_{2}+\frac{3}{4} S_{1}+\frac{3}{4}$. Note that by the A-G mean inequality, $S_{1}=x+y+z \geq 3$. Thus it suffices to prove the following:  $$ \text { If } S_{1} \geq 3 \text { and } m>n \text { are positive integers, then } S_{m} \geq S_{n} \text {. } $$  This can be shown in many ways. For example, by Hölder's inequality,  $$ \left(x^{m}+y^{m}+z^{m}\right)^{n / m}(1+1+1)^{(m-n) / m} \geq x^{n}+y^{n}+z^{n} . $$  (Another way is using the Chebyshev inequality: if $x \geq y \geq z$ then $x^{k-1} \geq$ $y^{k-1} \geq z^{k-1}$; hence $S_{k}=x \cdot x^{k-1}+y \cdot y^{k-1}+z \cdot z^{k-1} \geq \frac{1}{3} S_{1} S_{k-1}$, and the claim follows by induction.)  Second solution. Assume that $x \geq y \geq z$. Then also $\frac{1}{(y+1)(z+1)} \geq$ $\frac{1}{(x+1)(z+1)} \geq \frac{1}{(x+1)(y+1)}$. Hence Chebyshev's inequality gives that  $$ \begin{aligned} & \frac{x^{3}}{(1+y)(1+z)}+\frac{y^{3}}{(1+x)(1+z)}+\frac{z^{3}}{(1+x)(1+y)} \\ \geq & \frac{1}{3} \frac{\left(x^{3}+y^{3}+z^{3}\right) \cdot(3+x+y+z)}{(1+x)(1+y)(1+z)} \end{aligned} $$  Now if we put $x+y+z=3 S$, we have $x^{3}+y^{3}+z^{3} \geq 3 S$ and $(1+$ $x)(1+y)(1+z) \leq(1+a)^{3}$ by the A-G mean inequality. Thus the needed inequality reduces to $\frac{6 S^{3}}{(1+S)^{3}} \geq \frac{3}{4}$, which is obviously true because $S \geq 1$. Remark. Both these solutions use only that $x+y+z \geq 3$.


12. (POL) Let $n \geq k \geq 0$ be integers. The numbers $c(n, k)$ are defined as follows:  $$ \begin{aligned} c(n, 0) & =c(n, n)=1 & & \text { for all } n \geq 0 \\ c(n+1, k) & =2^{k} c(n, k)+c(n, k-1) & & \text { for } n \geq k \geq 1 \end{aligned} $$  Prove that $c(n, k)=c(n, n-k)$ for all $n \geq k \geq 0$.

Solution: 12. The assertion is clear for $n=0$. We shall prove the general case by induction on $n$. Suppose that $c(m, i)=c(m, m-i)$ for all $i$ and $m \leq n$. Then by the induction hypothesis and the recurrence formula we have $c(n+1, k)=2^{k} c(n, k)+c(n, k-1)$ and $c(n+1, n+1-k)=$ $2^{n+1-k} c(n, n+1-k)+c(n, n-k)=2^{n+1-k} c(n, k-1)+c(n, k)$. Thus it remains only to show that  $$ \left(2^{k}-1\right) c(n, k)=\left(2^{n+1-k}-1\right) c(n, k-1) $$  We prove this also by induction on $n$. By the induction hypothesis,  $$ c(n-1, k)=\frac{2^{n-k}-1}{2^{k}-1} c(n-1, k-1) $$  and  $$ c(n-1, k-2)=\frac{2^{k-1}-1}{2^{n+1-k}-1} c(n-1, k-1) $$  Using these formulas and the recurrence formula we obtain $\left(2^{k}-1\right) c(n, k)-$ $\left(2^{n+1-k}-1\right) c(n, k-1)=\left(2^{2 k}-2^{k}\right) c(n-1, k)-\left(2^{n}-3 \cdot 2^{k-1}+1\right) c(n-$ $1, k-1)-\left(2^{n+1-k}-1\right) c(n-1, k-2)=\left(2^{n}-2^{k}\right) c(n-1, k-1)-\left(2^{n}-\right.$ $\left.3 \cdot 2^{k-1}+1\right) c(n-1, k-1)-\left(2^{k-1}-1\right) c(n-1, k-1)=0$. This completes the proof. Second solution. The given recurrence formula resembles that of binomial coefficients, so it is natural to search for an explicit formula of the form $c(n, k)=\frac{F(n)}{F(k) F(n-k)}$, where $F(m)=f(1) f(2) \cdots f(m)($ with $F(0)=1$ ) and $f$ is a certain function from the natural numbers to the real numbers. If there is such an $f$, then $c(n, k)=c(n, n-k)$ follows immediately. After substitution of the above relation, the recurrence equivalently reduces to $f(n+1)=2^{k} f(n-k+1)+f(k)$. It is easy to see that $f(m)=2^{m}-1$ satisfies this relation. Remark. If we introduce the polynomial $P_{n}(x)=\sum_{k=0}^{n} c(n, k) x^{k}$, the recurrence relation gives $P_{0}(x)=1$ and $P_{n+1}(x)=x P_{n}(x)+P_{n}(2 x)$. As a consequence of the problem, all polynomials in this sequence are symmetric, i.e., $P_{n}(x)=x^{n} P_{n}\left(x^{-1}\right)$.


13. (BUL) ${ }^{\mathrm{IMO} 6}$ Determine the least possible value of $f(1998)$, where $f$ is a function from the set $\mathbb{N}$ of positive integers into itself such that for all $m, n \in \mathbb{N}$,  $$ f\left(n^{2} f(m)\right)=m[f(n)]^{2} $$

Solution: 13. Denote by $\mathcal{F}$ the set of functions considered. Let $f \in \mathcal{F}$, and let $f(1)=a$. Putting $n=1$ and $m=1$ we obtain $f(f(z))=a^{2} z$ and $f\left(a z^{2}\right)=f(z)^{2}$ for all $z \in \mathbb{N}$. These equations, together with the original one, imply $f(x)^{2} f(y)^{2}=f(x)^{2} f\left(a y^{2}\right)=f\left(x^{2} f\left(f\left(a y^{2}\right)\right)\right)=f\left(x^{2} a^{3} y^{2}\right)=$ $f\left(a(a x y)^{2}\right)=f(a x y)^{2}$, or $f(a x y)=f(x) f(y)$ for all $x, y \in \mathbb{N}$. Thus $f(a x)=a f(x)$, and we conclude that  $$ a f(x y)=f(x) f(y) \quad \text { for all } x, y \in \mathbb{N} $$  We now prove that $f(x)$ is divisible by $a$ for each $x \in \mathbb{N}$. In fact, we inductively get that $f(x)^{k}=a^{k-1} f\left(x^{k}\right)$ is divisible by $a^{k-1}$ for every $k$. If $p^{\alpha}$ and $p^{\beta}$ are the exact powers of a prime $p$ that divide $f(x)$ and $a$ respectively, we deduce that $k \alpha \geq(k-1) \beta$ for all $k$, so we must have $\alpha \geq \beta$ for any $p$. Therefore $a \mid f(x)$. Now we consider the function on natural numbers $g(x)=f(x) / a$. The above relations imply  $$ g(1)=1, \quad g(x y)=g(x) g(y), \quad g(g(x))=x \quad \text { for all } x, y \in \mathbb{N} $$  Since $g \in \mathcal{F}$ and $g(x) \leq f(x)$ for all $x$, we may restrict attention to the functions $g$ only. Clearly $g$ is bijective. We observe that $g$ maps a prime to a prime. Assume to the contrary that $g(p)=u v, u, v>1$. Then $g(u v)=p$, so either $g(u)=1$ and $g(v)=1$. Thus either $g(1)=u$ or $g(1)=v$, which is impossible. We return to the problem of determining the least possible value of $g(1998)$. Since $g(1998)=g\left(2 \cdot 3^{3} \cdot 37\right)=g(2) \cdot g(3)^{3} \cdot g(37)$, and $g(2)$, $g(3), g(37)$ are distinct primes, $g(1998)$ is not smaller than $2^{3} \cdot 3 \cdot 5=120$. On the other hand, the value of 120 is attained for any function $g$ satisfying (2) and $g(2)=3, g(3)=2, g(5)=37, g(37)=5$. Hence the answer is 120 .


14. $(\mathbf{G B R})^{\mathrm{IMO} 4}$ Determine all pairs $(x, y)$ of positive integers such that $x^{2} y+$ $x+y$ is divisible by $x y^{2}+y+7$.

Solution: 14. If $x^{2} y+x+y$ is divisible by $x y^{2}+y+7$, then so is the number $y\left(x^{2} y+\right.$ $x+y)-x\left(x y^{2}+y+7\right)=y^{2}-7 x$. If $y^{2}-7 x \geq 0$, then since $y^{2}-7 x<x y^{2}+y+7$, it follows that $y^{2}-7 x=0$. Hence $(x, y)=\left(7 t^{2}, 7 t\right)$ for some $t \in \mathbb{N}$. It is easy to check that these pairs really are solutions. If $y^{2}-7 x<0$, then $7 x-y^{2}>0$ is divisible by $x y^{2}+y+7$. But then $x y^{2}+y+7 \leq 7 x-y^{2}<7 x$, from which we obtain $y \leq 2$. For $y=1$, we are led to $x+8 \mid 7 x-1$, and hence $x+8 \mid 7(x+8)-(7 x-1)=57$. Thus the only possibilities are $x=11$ and $x=49$, and the obtained pairs $(11,1),(49,1)$ are indeed solutions. For $y=2$, we have $4 x+9 \mid 7 x-4$, so that $7(4 x+9)-4(7 x-4)=79$ is divisible by $4 x+9$. We do not get any new solutions in this case. Therefore all required pairs $(x, y)$ are $\left(7 t^{2}, 7 t\right)(t \in \mathbb{N}),(11,1)$, and $(49,1)$.


15. (AUS) Determine all pairs $(a, b)$ of real numbers such that $a\lfloor b n\rfloor=b\lfloor a n\rfloor$ for all positive integers $n$. (Note that $\lfloor x\rfloor$ denotes the greatest integer less than or equal to $x$.)

Solution: 15. The condition is obviously satisfied if $a=0$ or $b=0$ or $a=b$ or $a, b$ are both integers. We claim that these are the only solutions.  Suppose that $a, b$ belong to none of the above categories. The quotient $a / b=\lfloor a\rfloor /\lfloor b\rfloor$ is a nonzero rational number: let $a / b=p / q$, where $p$ and $q$ are coprime nonzero integers. Suppose that $p \notin\{-1,1\}$. Then $p$ divides $\lfloor a n\rfloor$ for all $n$, so in particular $p$ divides $\lfloor a\rfloor$ and thus $a=k p+\varepsilon$ for some $k \in \mathbb{N}$ and $0 \leq \varepsilon<1$. Note that $\varepsilon \neq 0$, since otherwise $b=k q$ would also be an integer. It follows that there exists an $n \in \mathbb{N}$ such that $1 \leq n \varepsilon<2$. But then $\lfloor n a\rfloor=\lfloor k n p+n \varepsilon\rfloor=k n p+1$ is not divisible by $p$, a contradiction. Similarly, $q \notin\{-1,1\}$ is not possible. Therefore we must have $p, q= \pm 1$, and since $a \neq b$, the only possibility is $b=-a$. However, this leads to $\lfloor-a\rfloor=-\lfloor a\rfloor$, which is not valid if $a$ is not an integer.


16. (UKR) Determine the smallest integer $n \geq 4$ for which one can choose four different numbers $a, b, c$, and $d$ from any $n$ distinct integers such that $a+b-c-d$ is divisible by 20 .

Solution: 16. Let $S$ be a set of integers such that for no four distinct elements $a, b, c, d \in$ $S$, it holds that $20 \mid a+b-c-d$. It is easily seen that there cannot exist distinct elements $a, b, c, d$ with $a \equiv b$ and $c \equiv d(\bmod 20)$. Consequently, if the elements of $S$ give $k$ different residues modulo 20, then $S$ itself has at most $k+2$ elements. Next, consider these $k$ elements of $S$ with different residues modulo 20. They give $\frac{k(k-1)}{2}$ different sums of two elements. For $k \geq 7$ there are at least 21 such sums, and two of them, say $a+b$ and $c+d$, are equal modulo 20 ; it is easy to see that $a, b, c, d$ are discinct. It follows that $k$ cannot exceed 6 , and consequently $S$ has at most 8 elements. An example of a set $S$ with 8 elements is $\{0,20,40,1,2,4,7,12\}$. Hence the answer is $n=9$.


17. (GBR) A sequence of integers $a_{1}, a_{2}, a_{3}, \ldots$ is defined as follows: $a_{1}=1$, and for $n \geq 1, a_{n+1}$ is the smallest integer greater than $a_{n}$ such that $a_{i}+a_{j} \neq 3 a_{k}$ for any $i, j, k$ in $\{1,2, \ldots, n+1\}$, not necessarily distinct. Determine $a_{1998}$.

Solution: 17. Initially, we determine that the first few values for $a_{n}$ are $1,3,4,7,10$, $12,13,16,19,21,22,25$. Since these are exactly the numbers of the forms $3 k+1$ and $9 k+3$, we conjecture that this is the general pattern. In fact, it is easy to see that the equation $x+y=3 z$ has no solution in the set $K=\{3 k+1,9 k+3 \mid k \in \mathbb{N}\}$. We shall prove that the sequence $\left\{a_{n}\right\}$ is actually this set ordered increasingly. Suppose $a_{n}>25$ is the first member of the sequence not belonging to $K$. We have several cases: (i) $a_{n}=3 r+2, r \in \mathbb{N}$. By the assumption, one of $r+1, r+2, r+3$ is of the form $3 k+1$ (and smaller than $a_{n}$ ), and therefore is a member $a_{i}$ of the sequence. Then $3 a_{i}$ equals $a_{n}+1$, $a_{n}+4$, or $a_{n}+7$, which is a contradiction because $1,4,7$ are in the sequence. (ii) $a_{n}=9 r, r \in \mathbb{N}$. Then $a_{n}+a_{2}=3(3 r+1)$, although $3 r+1$ is in the sequence, a contradiction. (iii) $a_{n}=9 r+6, r \in \mathbb{N}$. Then one of the numbers $3 r+3,3 r+6,3 r+9$ is a member $a_{j}$ of the sequence, and thus $3 a_{j}$ is equal to $a_{n}+3$, $a_{n}+12$, or $a_{n}+21$, where $3,12,21$ are members of the sequence, again a contradiction. Once we have revealed the structure of the sequence, it is easy to compute $a_{1998}$. We have $1998=4 \cdot 499+2$, which implies $a_{1998}=9 \cdot 499+a_{2}=4494$.