Let $n$ be a positive integer and let $a_{1}, \ldots, a_{n-1}$ be arbitrary real numbers. Define the sequences $u_{0}, \ldots, u_{n}$ and $v_{0}, \ldots, v_{n}$ inductively by $u_{0}=u_{1}=v_{0}=v_{1}=1$, and  $$ u_{k+1}=u_{k}+a_{k} u_{k-1}, \quad v_{k+1}=v_{k}+a_{n-k} v_{k-1} \quad \text { for } k=1, \ldots, n-1 . $$  Prove that $u_{n}=v_{n}$.  (France)

Solution: We prove by induction on $k$ that  $$ u_{k}=\sum_{\substack{0<i_{1}<\ldots<i_{t}<k \\ i_{j}+1-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}} $$  Note that we have one trivial summand equal to 1 (which corresponds to $t=0$ and the empty sequence, whose product is 1 ).  For $k=0,1$ the sum on the right-hand side only contains the empty product, so (1) holds due to $u_{0}=u_{1}=1$. For $k \geqslant 1$, assuming the result is true for $0,1, \ldots, k$, we have  $$ \begin{aligned} u_{k+1} & =\sum_{\substack{0<i_{1}<\ldots<i_{t}<k, i_{j+1}-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}}+\sum_{\substack{0<i_{1}<\ldots<i_{t}<k-1, i_{j+1}-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}} \cdot a_{k} \\ & =\sum_{\substack{0<i_{1}<\ldots<i_{t}<k+1, i_{j+1}-i_{j} \geqslant 2, k \notin\left\{i_{1}, \ldots, i_{t}\right\}}} a_{i_{1}} \ldots a_{i_{t}}+\sum_{\substack{0<i_{1}<\ldots<i_{t}<k+1, i_{j+1}-i_{j} \geqslant 2, k \in\left\{i_{1}, \ldots, i_{t}\right\}}} a_{i_{1}} \ldots a_{i_{t}} \\ & =\sum_{\substack{0<i_{1}<\ldots<i_{t}<k+1, i_{j+1}-i_{j} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}}, \end{aligned} $$  as required.  Applying (1) to the sequence $b_{1}, \ldots, b_{n}$ given by $b_{k}=a_{n-k}$ for $1 \leqslant k \leqslant n$, we get  $$ v_{k}=\sum_{\substack{0<i_{1}<\ldots<i_{t}<k, i_{j+1}-i_{j} \geqslant 2}} b_{i_{1}} \ldots b_{i_{t}}=\sum_{\substack{n>i_{1}>\ldots>i_{t}>n-k \\ i_{j}-i_{j+1} \geqslant 2}} a_{i_{1}} \ldots a_{i_{t}} $$  For $k=n$ the expressions (1) and (2) coincide, so indeed $u_{n}=v_{n}$.


Solution: Define recursively a sequence of multivariate polynomials by  $$ P_{0}=P_{1}=1, \quad P_{k+1}\left(x_{1}, \ldots, x_{k}\right)=P_{k}\left(x_{1}, \ldots, x_{k-1}\right)+x_{k} P_{k-1}\left(x_{1}, \ldots, x_{k-2}\right), $$  so $P_{n}$ is a polynomial in $n-1$ variables for each $n \geqslant 1$. Two easy inductive arguments show that  $$ u_{n}=P_{n}\left(a_{1}, \ldots, a_{n-1}\right), \quad v_{n}=P_{n}\left(a_{n-1}, \ldots, a_{1}\right) $$  so we need to prove $P_{n}\left(x_{1}, \ldots, x_{n-1}\right)=P_{n}\left(x_{n-1}, \ldots, x_{1}\right)$ for every positive integer $n$. The cases $n=1,2$ are trivial, and the cases $n=3,4$ follow from $P_{3}(x, y)=1+x+y$ and $P_{4}(x, y, z)=$ $1+x+y+z+x z$.  Now we proceed by induction, assuming that $n \geqslant 5$ and the claim hold for all smaller cases. Using $F(a, b)$ as an abbreviation for $P_{|a-b|+1}\left(x_{a}, \ldots, x_{b}\right)$ (where the indices $a, \ldots, b$ can be either in increasing or decreasing order),  $$ \begin{aligned} F(n, 1) & =F(n, 2)+x_{1} F(n, 3)=F(2, n)+x_{1} F(3, n) \\ & =\left(F(2, n-1)+x_{n} F(2, n-2)\right)+x_{1}\left(F(3, n-1)+x_{n} F(3, n-2)\right) \\ & =\left(F(n-1,2)+x_{1} F(n-1,3)\right)+x_{n}\left(F(n-2,2)+x_{1} F(n-2,3)\right) \\ & =F(n-1,1)+x_{n} F(n-2,1)=F(1, n-1)+x_{n} F(1, n-2) \\ & =F(1, n), \end{aligned} $$  as we wished to show.


Solution: Using matrix notation, we can rewrite the recurrence relation as  $$ \left(\begin{array}{c} u_{k+1} \\ u_{k+1}-u_{k} \end{array}\right)=\left(\begin{array}{c} u_{k}+a_{k} u_{k-1} \\ a_{k} u_{k-1} \end{array}\right)=\left(\begin{array}{cc} 1+a_{k} & -a_{k} \\ a_{k} & -a_{k} \end{array}\right)\left(\begin{array}{c} u_{k} \\ u_{k}-u_{k-1} \end{array}\right) $$  for $1 \leqslant k \leqslant n-1$, and similarly  $$ \left(v_{k+1} ; v_{k}-v_{k+1}\right)=\left(v_{k}+a_{n-k} v_{k-1} ;-a_{n-k} v_{k-1}\right)=\left(v_{k} ; v_{k-1}-v_{k}\right)\left(\begin{array}{cc} 1+a_{n-k} & -a_{n-k} \\ a_{n-k} & -a_{n-k} \end{array}\right) $$  for $1 \leqslant k \leqslant n-1$. Hence, introducing the $2 \times 2$ matrices $A_{k}=\left(\begin{array}{cc}1+a_{k} & -a_{k} \\ a_{k} & -a_{k}\end{array}\right)$ we have  $$ \left(\begin{array}{c} u_{k+1} \\ u_{k+1}-u_{k} \end{array}\right)=A_{k}\left(\begin{array}{c} u_{k} \\ u_{k}-u_{k-1} \end{array}\right) \quad \text { and } \quad\left(v_{k+1} ; v_{k}-v_{k+1}\right)=\left(v_{k} ; v_{k-1}-v_{k}\right) A_{n-k} . $$  for $1 \leqslant k \leqslant n-1$. Since $\left(\begin{array}{c}u_{1} \\ u_{1}-u_{0}\end{array}\right)=\left(\begin{array}{l}1 \\ 0\end{array}\right)$ and $\left(v_{1} ; v_{0}-v_{1}\right)=(1 ; 0)$, we get  $$ \left(\begin{array}{c} u_{n} \\ u_{n}-u_{n-1} \end{array}\right)=A_{n-1} A_{n-2} \cdots A_{1} \cdot\left(\begin{array}{l} 1 \\ 0 \end{array}\right) \quad \text { and } \quad\left(v_{n} ; v_{n-1}-v_{n}\right)=(1 ; 0) \cdot A_{n-1} A_{n-2} \cdots A_{1} \text {. } $$  It follows that  $$ \left(u_{n}\right)=(1 ; 0)\left(\begin{array}{c} u_{n} \\ u_{n}-u_{n-1} \end{array}\right)=(1 ; 0) \cdot A_{n-1} A_{n-2} \cdots A_{1} \cdot\left(\begin{array}{l} 1 \\ 0 \end{array}\right)=\left(v_{n} ; v_{n-1}-v_{n}\right)\left(\begin{array}{l} 1 \\ 0 \end{array}\right)=\left(v_{n}\right) . $$  Comment 1. These sequences are related to the Fibonacci sequence; when $a_{1}=\cdots=a_{n-1}=1$, we have $u_{k}=v_{k}=F_{k+1}$, the $(k+1)$ st Fibonacci number. Also, for every positive integer $k$, the polynomial $P_{k}\left(x_{1}, \ldots, x_{k-1}\right)$ from Solution 2 is the sum of $F_{k+1}$ monomials.  Comment 2. One may notice that the condition is equivalent to  $$ \frac{u_{k+1}}{u_{k}}=1+\frac{a_{k}}{1+\frac{a_{k-1}}{1+\ldots+\frac{a_{2}}{1+a_{1}}}} \quad \text { and } \quad \frac{v_{k+1}}{v_{k}}=1+\frac{a_{n-k}}{1+\frac{a_{n-k+1}}{1+\ldots+\frac{a_{n-2}}{1+a_{n-1}}}} $$  so the problem claims that the corresponding continued fractions for $u_{n} / u_{n-1}$ and $v_{n} / v_{n-1}$ have the same numerator.  Comment 3. An alternative variant of the problem is the following.  Let $n$ be a positive integer and let $a_{1}, \ldots, a_{n-1}$ be arbitrary real numbers. Define the sequences $u_{0}, \ldots, u_{n}$ and $v_{0}, \ldots, v_{n}$ inductively by $u_{0}=v_{0}=0, u_{1}=v_{1}=1$, and  $$ u_{k+1}=a_{k} u_{k}+u_{k-1}, \quad v_{k+1}=a_{n-k} v_{k}+v_{k-1} \quad \text { for } k=1, \ldots, n-1 $$  Prove that $u_{n}=v_{n}$.  All three solutions above can be reformulated to prove this statement; one may prove  $$ u_{n}=v_{n}=\sum_{\substack{0=i_{0}<i_{1}<\ldots<i_{t}=n, i_{j+1}-i_{j} \text { is odd }}} a_{i_{1}} \ldots a_{i_{t-1}} \quad \text { for } n>0 $$  or observe that  $$ \left(\begin{array}{c} u_{k+1} \\ u_{k} \end{array}\right)=\left(\begin{array}{cc} a_{k} & 1 \\ 1 & 0 \end{array}\right)\left(\begin{array}{c} u_{k} \\ u_{k-1} \end{array}\right) \quad \text { and } \quad\left(v_{k+1} ; v_{k}\right)=\left(v_{k} ; v_{k-1}\right)\left(\begin{array}{cc} a_{k} & 1 \\ 1 & 0 \end{array}\right) . $$  Here we have  $$ \frac{u_{k+1}}{u_{k}}=a_{k}+\frac{1}{a_{k-1}+\frac{1}{a_{k-2}+\ldots+\frac{1}{a_{1}}}}=\left[a_{k} ; a_{k-1}, \ldots, a_{1}\right] $$  and  $$ \frac{v_{k+1}}{v_{k}}=a_{n-k}+\frac{1}{a_{n-k+1}+\frac{1}{a_{n-k+2}+\ldots+\frac{1}{a_{n-1}}}}=\left[a_{n-k} ; a_{n-k+1}, \ldots, a_{n-1}\right] $$  so this alternative statement is equivalent to the known fact that the continued fractions $\left[a_{n-1} ; a_{n-2}, \ldots, a_{1}\right]$ and $\left[a_{1} ; a_{2}, \ldots, a_{n-1}\right]$ have the same numerator.


Prove that in any set of 2000 distinct real numbers there exist two pairs $a>b$ and $c>d$ with $a \neq c$ or $b \neq d$, such that  $$ \left|\frac{a-b}{c-d}-1\right|<\frac{1}{100000} $$  (Lithuania)

Solution: For any set $S$ of $n=2000$ distinct real numbers, let $D_{1} \leqslant D_{2} \leqslant \cdots \leqslant D_{m}$ be the distances between them, displayed with their multiplicities. Here $m=n(n-1) / 2$. By rescaling the numbers, we may assume that the smallest distance $D_{1}$ between two elements of $S$ is $D_{1}=1$. Let $D_{1}=1=y-x$ for $x, y \in S$. Evidently $D_{m}=v-u$ is the difference between the largest element $v$ and the smallest element $u$ of $S$.  If $D_{i+1} / D_{i}<1+10^{-5}$ for some $i=1,2, \ldots, m-1$ then the required inequality holds, because $0 \leqslant D_{i+1} / D_{i}-1<10^{-5}$. Otherwise, the reverse inequality  $$ \frac{D_{i+1}}{D_{i}} \geqslant 1+\frac{1}{10^{5}} $$  holds for each $i=1,2, \ldots, m-1$, and therefore  $$ v-u=D_{m}=\frac{D_{m}}{D_{1}}=\frac{D_{m}}{D_{m-1}} \cdots \frac{D_{3}}{D_{2}} \cdot \frac{D_{2}}{D_{1}} \geqslant\left(1+\frac{1}{10^{5}}\right)^{m-1} . $$  From $m-1=n(n-1) / 2-1=1000 \cdot 1999-1>19 \cdot 10^{5}$, together with the fact that for all $n \geqslant 1$, $\left(1+\frac{1}{n}\right)^{n} \geqslant 1+\left(\begin{array}{l}n \\ 1\end{array}\right) \cdot \frac{1}{n}=2$, we get  $$ \left(1+\frac{1}{10^{5}}\right)^{19 \cdot 10^{5}}=\left(\left(1+\frac{1}{10^{5}}\right)^{10^{5}}\right)^{19} \geqslant 2^{19}=2^{9} \cdot 2^{10}>500 \cdot 1000>2 \cdot 10^{5}, $$  and so $v-u=D_{m}>2 \cdot 10^{5}$.  Since the distance of $x$ to at least one of the numbers $u, v$ is at least $(u-v) / 2>10^{5}$, we have  $$ |x-z|>10^{5} . $$  for some $z \in\{u, v\}$. Since $y-x=1$, we have either $z>y>x$ (if $z=v$ ) or $y>x>z$ (if $z=u$ ). If $z>y>x$, selecting $a=z, b=y, c=z$ and $d=x$ (so that $b \neq d$ ), we obtain  $$ \left|\frac{a-b}{c-d}-1\right|=\left|\frac{z-y}{z-x}-1\right|=\left|\frac{x-y}{z-x}\right|=\frac{1}{z-x}<10^{-5} . $$  Otherwise, if $y>x>z$, we may choose $a=y, b=z, c=x$ and $d=z$ (so that $a \neq c$ ), and obtain  $$ \left|\frac{a-b}{c-d}-1\right|=\left|\frac{y-z}{x-z}-1\right|=\left|\frac{y-x}{x-z}\right|=\frac{1}{x-z}<10^{-5} $$  The desired result follows.  Comment. As the solution shows, the numbers 2000 and $\frac{1}{100000}$ appearing in the statement of the problem may be replaced by any $n \in \mathbb{Z}_{>0}$ and $\delta>0$ satisfying  $$ \delta(1+\delta)^{n(n-1) / 2-1}>2 $$


Let $\mathbb{Q}_{>0}$ be the set of positive rational numbers. Let $f: \mathbb{Q}_{>0} \rightarrow \mathbb{R}$ be a function satisfying the conditions  $$ f(x) f(y) \geqslant f(x y) \text { and } f(x+y) \geqslant f(x)+f(y) $$  for all $x, y \in \mathbb{Q}_{>0}$. Given that $f(a)=a$ for some rational $a>1$, prove that $f(x)=x$ for all $x \in \mathbb{Q}_{>0}$.  (Bulgaria)

Solution: Denote by $\mathbb{Z}_{>0}$ the set of positive integers.  Plugging $x=1, y=a$ into (1) we get $f(1) \geqslant 1$. Next, by an easy induction on $n$ we get from (2) that  $$ f(n x) \geqslant n f(x) \text { for all } n \in \mathbb{Z}_{>0} \text { and } x \in \mathbb{Q}_{>0} $$  In particular, we have  $$ f(n) \geqslant n f(1) \geqslant n \quad \text { for all } n \in \mathbb{Z}_{>0} $$  From (1) again we have $f(m / n) f(n) \geqslant f(m)$, so $f(q)>0$ for all $q \in \mathbb{Q}_{>0}$.  Now, (2) implies that $f$ is strictly increasing; this fact together with (4) yields  $$ f(x) \geqslant f(\lfloor x\rfloor) \geqslant\lfloor x\rfloor>x-1 \quad \text { for all } x \geqslant 1 $$  By an easy induction we get from (1) that $f(x)^{n} \geqslant f\left(x^{n}\right)$, so  $$ f(x)^{n} \geqslant f\left(x^{n}\right)>x^{n}-1 \quad \Longrightarrow \quad f(x) \geqslant \sqrt[n]{x^{n}-1} \text { for all } x>1 \text { and } n \in \mathbb{Z}_{>0} $$  This yields  $$ f(x) \geqslant x \text { for every } x>1 \text {. } $$  (Indeed, if $x>y>1$ then $x^{n}-y^{n}=(x-y)\left(x^{n-1}+x^{n-2} y+\cdots+y^{n}\right)>n(x-y)$, so for a large $n$ we have $x^{n}-1>y^{n}$ and thus $f(x)>y$.)  Now, (1) and (5) give $a^{n}=f(a)^{n} \geqslant f\left(a^{n}\right) \geqslant a^{n}$, so $f\left(a^{n}\right)=a^{n}$. Now, for $x>1$ let us choose $n \in \mathbb{Z}_{>0}$ such that $a^{n}-x>1$. Then by (2) and (5) we get  $$ a^{n}=f\left(a^{n}\right) \geqslant f(x)+f\left(a^{n}-x\right) \geqslant x+\left(a^{n}-x\right)=a^{n} $$  and therefore $f(x)=x$ for $x>1$. Finally, for every $x \in \mathbb{Q}_{>0}$ and every $n \in \mathbb{Z}_{>0}$, from (1) and (3) we get  $$ n f(x)=f(n) f(x) \geqslant f(n x) \geqslant n f(x) $$  which gives $f(n x)=n f(x)$. Therefore $f(m / n)=f(m) / n=m / n$ for all $m, n \in \mathbb{Z}_{>0}$.  Comment. The condition $f(a)=a>1$ is essential. Indeed, for $b \geqslant 1$ the function $f(x)=b x^{2}$ satisfies (1) and (2) for all $x, y \in \mathbb{Q}_{>0}$, and it has a unique fixed point $1 / b \leqslant 1$.


Let $n$ be a positive integer, and consider a sequence $a_{1}, a_{2}, \ldots, a_{n}$ of positive integers. Extend it periodically to an infinite sequence $a_{1}, a_{2}, \ldots$ by defining $a_{n+i}=a_{i}$ for all $i \geqslant 1$. If  $$ a_{1} \leqslant a_{2} \leqslant \cdots \leqslant a_{n} \leqslant a_{1}+n $$  and  $$ a_{a_{i}} \leqslant n+i-1 \quad \text { for } i=1,2, \ldots, n $$  prove that  $$ a_{1}+\cdots+a_{n} \leqslant n^{2} . $$  (Germany)

Solution: First, we claim that  $$ a_{i} \leqslant n+i-1 \quad \text { for } i=1,2, \ldots, n \text {. } $$  Assume contrariwise that $i$ is the smallest counterexample. From $a_{n} \geqslant a_{n-1} \geqslant \cdots \geqslant a_{i} \geqslant n+i$ and $a_{a_{i}} \leqslant n+i-1$, taking into account the periodicity of our sequence, it follows that  $$ a_{i} \text { cannot be congruent to } i, i+1, \ldots, n-1 \text {, or } n(\bmod n) \text {. } $$  Thus our assumption that $a_{i} \geqslant n+i$ implies the stronger statement that $a_{i} \geqslant 2 n+1$, which by $a_{1}+n \geqslant a_{n} \geqslant a_{i}$ gives $a_{1} \geqslant n+1$. The minimality of $i$ then yields $i=1$, and (4) becomes contradictory. This establishes our first claim.  In particular we now know that $a_{1} \leqslant n$. If $a_{n} \leqslant n$, then $a_{1} \leqslant \cdots \leqslant \cdots a_{n} \leqslant n$ and the desired inequality holds trivially. Otherwise, consider the number $t$ with $1 \leqslant t \leqslant n-1$ such that  $$ a_{1} \leqslant a_{2} \leqslant \ldots \leqslant a_{t} \leqslant n<a_{t+1} \leqslant \ldots \leqslant a_{n} $$  Since $1 \leqslant a_{1} \leqslant n$ and $a_{a_{1}} \leqslant n$ by (2), we have $a_{1} \leqslant t$ and hence $a_{n} \leqslant n+t$. Therefore if for each positive integer $i$ we let $b_{i}$ be the number of indices $j \in\{t+1, \ldots, n\}$ satisfying $a_{j} \geqslant n+i$, we have  $$ b_{1} \geqslant b_{2} \geqslant \ldots \geqslant b_{t} \geqslant b_{t+1}=0 $$  Next we claim that $a_{i}+b_{i} \leqslant n$ for $1 \leqslant i \leqslant t$. Indeed, by $n+i-1 \geqslant a_{a_{i}}$ and $a_{i} \leqslant n$, each $j$ with $a_{j} \geqslant n+i$ (thus $a_{j}>a_{a_{i}}$ ) belongs to $\left\{a_{i}+1, \ldots, n\right\}$, and for this reason $b_{i} \leqslant n-a_{i}$.  It follows from the definition of the $b_{i} \mathrm{~s}$ and (5) that  $$ a_{t+1}+\ldots+a_{n} \leqslant n(n-t)+b_{1}+\ldots+b_{t} . $$  Adding $a_{1}+\ldots+a_{t}$ to both sides and using that $a_{i}+b_{i} \leqslant n$ for $1 \leqslant i \leqslant t$, we get  $$ a_{1}+a_{2}+\cdots+a_{n} \leqslant n(n-t)+n t=n^{2} $$  as we wished to prove.


Solution: In the first quadrant of an infinite grid, consider the increasing "staircase" obtained by shading in dark the bottom $a_{i}$ cells of the $i$ th column for $1 \leqslant i \leqslant n$. We will prove that there are at most $n^{2}$ dark cells.  To do it, consider the $n \times n$ square $S$ in the first quadrant with a vertex at the origin. Also consider the $n \times n$ square directly to the left of $S$. Starting from its lower left corner, shade in light the leftmost $a_{j}$ cells of the $j$ th row for $1 \leqslant j \leqslant n$. Equivalently, the light shading is obtained by reflecting the dark shading across the line $x=y$ and translating it $n$ units to the left. The figure below illustrates this construction for the sequence $6,6,6,7,7,7,8,12,12,14$.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-14.jpg?height=650&width=1052&top_left_y=667&top_left_x=534)  We claim that there is no cell in $S$ which is both dark and light. Assume, contrariwise, that there is such a cell in column $i$. Consider the highest dark cell in column $i$ which is inside $S$. Since it is above a light cell and inside $S$, it must be light as well. There are two cases:  Case 1. $a_{i} \leqslant n$  If $a_{i} \leqslant n$ then this dark and light cell is $\left(i, a_{i}\right)$, as highlighted in the figure. However, this is the $(n+i)$-th cell in row $a_{i}$, and we only shaded $a_{a_{i}}<n+i$ light cells in that row, a contradiction.  Case 2. $a_{i} \geqslant n+1$  If $a_{i} \geqslant n+1$, this dark and light cell is $(i, n)$. This is the $(n+i)$-th cell in row $n$ and we shaded $a_{n} \leqslant a_{1}+n$ light cells in this row, so we must have $i \leqslant a_{1}$. But $a_{1} \leqslant a_{a_{1}} \leqslant n$ by (1) and (2), so $i \leqslant a_{1}$ implies $a_{i} \leqslant a_{a_{1}} \leqslant n$, contradicting our assumption.  We conclude that there are no cells in $S$ which are both dark and light. It follows that the number of shaded cells in $S$ is at most $n^{2}$.  Finally, observe that if we had a light cell to the right of $S$, then by symmetry we would have a dark cell above $S$, and then the cell $(n, n)$ would be dark and light. It follows that the number of light cells in $S$ equals the number of dark cells outside of $S$, and therefore the number of shaded cells in $S$ equals $a_{1}+\cdots+a_{n}$. The desired result follows.


Solution: As in   For $1 \leqslant i<j \leqslant n$ we have $a_{i} \leqslant a_{j}$ and $i<j$, so $c_{i} \leqslant c_{j}$. Also $a_{n} \leqslant a_{1}+n$ and $n<1+n$ imply $c_{n} \leqslant c_{1}+n$. Finally, the definitions imply that $c_{c_{i}} \in\left\{a_{a_{i}}, a_{i}, a_{i}-n, i\right\}$ so $c_{c_{i}} \leqslant n+i-1$ by (2) and (3). This establishes (1) and (2) for $c_{1}, c_{2}, \ldots$.  Our new sequence has the additional property that  $$ c_{i} \geqslant i \quad \text { for } i=1,2, \ldots, n $$  which allows us to construct the following visualization: Consider $n$ equally spaced points on a circle, sequentially labelled $1,2, \ldots, n(\bmod n)$, so point $k$ is also labelled $n+k$. We draw arrows from vertex $i$ to vertices $i+1, \ldots, c_{i}$ for $1 \leqslant i \leqslant n$, keeping in mind that $c_{i} \geqslant i$ by (6). Since $c_{i} \leqslant n+i-1$ by (3), no arrow will be drawn twice, and there is no arrow from a vertex to itself. The total number of arrows is  $$ \text { number of arrows }=\sum_{i=1}^{n}\left(c_{i}-i\right)=\sum_{i=1}^{n} c_{i}-\left(\begin{array}{c} n+1 \\ 2 \end{array}\right) $$  Now we show that we never draw both arrows $i \rightarrow j$ and $j \rightarrow i$ for $1 \leqslant i<j \leqslant n$. Assume contrariwise. This means, respectively, that  $$ i<j \leqslant c_{i} \quad \text { and } \quad j<n+i \leqslant c_{j} \text {. } $$  We have $n+i \leqslant c_{j} \leqslant c_{1}+n$ by (1), so $i \leqslant c_{1}$. Since $c_{1} \leqslant n$ by (3), this implies that $c_{i} \leqslant c_{c_{1}} \leqslant n$ using (1) and (3). But then, using (1) again, $j \leqslant c_{i} \leqslant n$ implies $c_{j} \leqslant c_{c_{i}}$, which combined with $n+i \leqslant c_{j}$ gives us that $n+i \leqslant c_{c_{i}}$. This contradicts (2).  This means that the number of arrows is at most $\left(\begin{array}{l}n \\ 2\end{array}\right)$, which implies that  $$ \sum_{i=1}^{n} c_{i} \leqslant\left(\begin{array}{l} n \\ 2 \end{array}\right)+\left(\begin{array}{c} n+1 \\ 2 \end{array}\right)=n^{2} $$  Recalling that $a_{i} \leqslant c_{i}$ for $1 \leqslant i \leqslant n$, the desired inequality follows.  Comment 1. We sketch an alternative proof by induction. Begin by verifying the initial case $n=1$ and the simple cases when $a_{1}=1, a_{1}=n$, or $a_{n} \leqslant n$. Then, as in Solution 1 , consider the index $t$ such that $a_{1} \leqslant \cdots \leqslant a_{t} \leqslant n<a_{t+1} \leqslant \cdots \leqslant a_{n}$. Observe again that $a_{1} \leqslant t$. Define the sequence $d_{1}, \ldots, d_{n-1}$ by  $$ d_{i}= \begin{cases}a_{i+1}-1 & \text { if } i \leqslant t-1 \\ a_{i+1}-2 & \text { if } i \geqslant t\end{cases} $$  and extend it periodically modulo $n-1$. One may verify that this sequence also satisfies the hypotheses of the problem. The induction hypothesis then gives $d_{1}+\cdots+d_{n-1} \leqslant(n-1)^{2}$, which implies that  $$ \sum_{i=1}^{n} a_{i}=a_{1}+\sum_{i=2}^{t}\left(d_{i-1}+1\right)+\sum_{i=t+1}^{n}\left(d_{i-1}+2\right) \leqslant t+(t-1)+2(n-t)+(n-1)^{2}=n^{2} $$  Comment 2. One unusual feature of this problem is that there are many different sequences for which equality holds. The discovery of such optimal sequences is not difficult, and it is useful in guiding the steps of a proof.  In fact, Solution 2 gives a complete description of the optimal sequences. Start with any lattice path $P$ from the lower left to the upper right corner of the $n \times n$ square $S$ using only steps up and right, such that the total number of steps along the left and top edges of $S$ is at least $n$. Shade the cells of $S$ below $P$ dark, and the cells of $S$ above $P$ light. Now reflect the light shape across the line $x=y$ and shift it up $n$ units, and shade it dark. As Solution 2 shows, the dark region will then correspond to an optimal sequence, and every optimal sequence arises in this way.


Let $\mathbb{Z}_{\geqslant 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\geqslant 0} \rightarrow \mathbb{Z}_{\geqslant 0}$ satisfying the relation  $$ f(f(f(n)))=f(n+1)+1 $$  for all $n \in \mathbb{Z}_{\geqslant 0}$.  (Serbia)

Solution: To start, we get from (*) that  $$ f^{4}(n)=f\left(f^{3}(n)\right)=f(f(n+1)+1) \quad \text { and } \quad f^{4}(n+1)=f^{3}(f(n+1))=f(f(n+1)+1)+1 $$  thus  $$ f^{4}(n)+1=f^{4}(n+1) . $$  I. Let us denote by $R_{i}$ the range of $f^{i}$; note that $R_{0}=\mathbb{Z}_{\geqslant 0}$ since $f^{0}$ is the identity function. Obviously, $R_{0} \supseteq R_{1} \supseteq \ldots$ Next, from (2) we get that if $a \in R_{4}$ then also $a+1 \in R_{4}$. This implies that $\mathbb{Z}_{\geqslant 0} \backslash R_{4}$ - and hence $\mathbb{Z}_{\geqslant 0} \backslash R_{1}$ - is finite. In particular, $R_{1}$ is unbounded.  Assume that $f(m)=f(n)$ for some distinct $m$ and $n$. Then from $(*)$ we obtain $f(m+1)=$ $f(n+1)$; by an easy induction we then get that $f(m+c)=f(n+c)$ for every $c \geqslant 0$. So the function $f(k)$ is periodic with period $|m-n|$ for $k \geqslant m$, and thus $R_{1}$ should be bounded, which is false. So, $f$ is injective.  II. Denote now $S_{i}=R_{i-1} \backslash R_{i}$; all these sets are finite for $i \leqslant 4$. On the other hand, by the injectivity we have $n \in S_{i} \Longleftrightarrow f(n) \in S_{i+1}$. By the injectivity again, $f$ implements a bijection between $S_{i}$ and $S_{i+1}$, thus $\left|S_{1}\right|=\left|S_{2}\right|=\ldots$; denote this common cardinality by $k$. If $0 \in R_{3}$ then $0=f(f(f(n)))$ for some $n$, thus from (*) we get $f(n+1)=-1$ which is impossible. Therefore $0 \in R_{0} \backslash R_{3}=S_{1} \cup S_{2} \cup S_{3}$, thus $k \geqslant 1$.  Next, let us describe the elements $b$ of $R_{0} \backslash R_{3}=S_{1} \cup S_{2} \cup S_{3}$. We claim that each such element satisfies at least one of three conditions $(i) b=0,(i i) b=f(0)+1$, and (iii) $b-1 \in S_{1}$. Otherwise $b-1 \in \mathbb{Z}_{\geqslant 0}$, and there exists some $n>0$ such that $f(n)=b-1$; but then $f^{3}(n-1)=f(n)+1=b$, so $b \in R_{3}$.  This yields  $$ 3 k=\left|S_{1} \cup S_{2} \cup S_{3}\right| \leqslant 1+1+\left|S_{1}\right|=k+2, $$  or $k \leqslant 1$. Therefore $k=1$, and the inequality above comes to equality. So we have $S_{1}=\{a\}$, $S_{2}=\{f(a)\}$, and $S_{3}=\left\{f^{2}(a)\right\}$ for some $a \in \mathbb{Z}_{\geqslant 0}$, and each one of the three options (i), (ii), and (iii) should be realized exactly once, which means that  $$ \left\{a, f(a), f^{2}(a)\right\}=\{0, a+1, f(0)+1\} . $$  III. From (3), we get $a+1 \in\left\{f(a), f^{2}(a)\right\}$ (the case $a+1=a$ is impossible). If $a+1=f^{2}(a)$ then we have $f(a+1)=f^{3}(a)=f(a+1)+1$ which is absurd. Therefore  $$ f(a)=a+1 $$  Next, again from (3) we have $0 \in\left\{a, f^{2}(a)\right\}$. Let us consider these two cases separately. Case 1. Assume that $a=0$, then $f(0)=f(a)=a+1=1$. Also from (3) we get $f(1)=f^{2}(a)=$ $f(0)+1=2$. Now, let us show that $f(n)=n+1$ by induction on $n$; the base cases $n \leqslant 1$ are established. Next, if $n \geqslant 2$ then the induction hypothesis implies  $$ n+1=f(n-1)+1=f^{3}(n-2)=f^{2}(n-1)=f(n), $$  establishing the step. In this case we have obtained the first of two answers; checking that is satisfies (*) is straightforward.  Case 2. Assume now that $f^{2}(a)=0$; then by (3) we get $a=f(0)+1$. By (4) we get $f(a+1)=$ $f^{2}(a)=0$, then $f(0)=f^{3}(a)=f(a+1)+1=1$, hence $a=f(0)+1=2$ and $f(2)=3$ by (4). To summarize,  $$ f(0)=1, \quad f(2)=3, \quad f(3)=0 . $$  Now let us prove by induction on $m$ that (1) holds for all $n=4 k, 4 k+2,4 k+3$ with $k \leqslant m$ and for all $n=4 k+1$ with $k<m$. The base case $m=0$ is established above. For the step, assume that $m \geqslant 1$. From (*) we get $f^{3}(4 m-3)=f(4 m-2)+1=4 m$. Next, by (2) we have  $$ f(4 m)=f^{4}(4 m-3)=f^{4}(4 m-4)+1=f^{3}(4 m-3)+1=4 m+1 . $$  Then by the induction hypothesis together with (*) we successively obtain  $$ \begin{aligned} & f(4 m-3)=f^{3}(4 m-1)=f(4 m)+1=4 m+2, \\ & f(4 m+2)=f^{3}(4 m-4)=f(4 m-3)+1=4 m+3, \\ & f(4 m+3)=f^{3}(4 m-3)=f(4 m-2)+1=4 m, \end{aligned} $$  thus finishing the induction step.  Finally, it is straightforward to check that the constructed function works:  $$ \begin{aligned} & f^{3}(4 k)=4 k+7=f(4 k+1)+1, \quad f^{3}(4 k+1)=4 k+4=f(4 k+2)+1, \\ & f^{3}(4 k+2)=4 k+1=f(4 k+3)+1, \quad f^{3}(4 k+3)=4 k+6=f(4 k+4)+1 . \end{aligned} $$


Solution: I. For convenience, let us introduce the function $g(n)=f(n)+1$. Substituting $f(n)$ instead of $n$ into (*) we obtain  $$ f^{4}(n)=f(f(n)+1)+1, \quad \text { or } \quad f^{4}(n)=g^{2}(n) . $$  Applying $f$ to both parts of (*) and using (5) we get  $$ f^{4}(n)+1=f(f(n+1)+1)+1=f^{4}(n+1) . $$  Thus, if $g^{2}(0)=f^{4}(0)=c$ then an easy induction on $n$ shows that  $$ g^{2}(n)=f^{4}(n)=n+c, \quad n \in \mathbb{Z}_{\geqslant 0} $$  This relation implies that both $f$ and $g$ are injective: if, say, $f(m)=f(n)$ then $m+c=$ $f^{4}(m)=f^{4}(n)=n+c$. Next, since $g(n) \geqslant 1$ for every $n$, we have $c=g^{2}(0) \geqslant 1$. Thus from (7) again we obtain $f(n) \neq n$ and $g(n) \neq n$ for all $n \in \mathbb{Z}_{\geqslant 0}$.  II. Next, application of $f$ and $g$ to (7) yields  $$ f(n+c)=f^{5}(n)=f^{4}(f(n))=f(n)+c \quad \text { and } \quad g(n+c)=g^{3}(n)=g(n)+c \text {. } $$  In particular, this means that if $m \equiv n(\bmod c)$ then $f(m) \equiv f(n)(\bmod c)$. Conversely, if $f(m) \equiv f(n)(\bmod c)$ then we get $m+c=f^{4}(m) \equiv f^{4}(n)=n+c(\bmod c)$. Thus,  $$ m \equiv n \quad(\bmod c) \Longleftrightarrow f(m) \equiv f(n) \quad(\bmod c) \Longleftrightarrow g(m) \equiv g(n) \quad(\bmod c) $$  Now, let us introduce the function $\delta(n)=f(n)-n=g(n)-n-1$. Set  $$ S=\sum_{n=0}^{c-1} \delta(n) $$  Using (8), we get that for every complete residue system $n_{1}, \ldots, n_{c}$ modulo $c$ we also have  $$ S=\sum_{i=1}^{c} \delta\left(n_{i}\right) $$  By (9), we get that $\left\{f^{k}(n): n=0, \ldots, c-1\right\}$ and $\left\{g^{k}(n): n=0, \ldots, c-1\right\}$ are complete residue systems modulo $c$ for all $k$. Thus we have  $$ c^{2}=\sum_{n=0}^{c-1}\left(f^{4}(n)-n\right)=\sum_{k=0}^{3} \sum_{n=0}^{c-1}\left(f^{k+1}(n)-f^{k}(n)\right)=\sum_{k=0}^{3} \sum_{n=0}^{c-1} \delta\left(f^{k}(n)\right)=4 S $$  and similarly  $$ c^{2}=\sum_{n=0}^{c-1}\left(g^{2}(n)-n\right)=\sum_{k=0}^{1} \sum_{n=0}^{c-1}\left(g^{k+1}(n)-g^{k}(n)\right)=\sum_{k=0}^{1} \sum_{n=0}^{c-1}\left(\delta\left(g^{k}(n)\right)+1\right)=2 S+2 c . $$  Therefore $c^{2}=4 S=2 \cdot 2 S=2\left(c^{2}-2 c\right)$, or $c^{2}=4 c$. Since $c \neq 0$, we get $c=4$. Thus, in view of (8) it is sufficient to determine the values of $f$ on the numbers $0,1,2,3$.  III. Let $d=g(0) \geqslant 1$. Then $g(d)=g^{2}(0)=0+c=4$. Now, if $d \geqslant 4$, then we would have $g(d-4)=g(d)-4=0$ which is impossible. Thus $d \in\{1,2,3\}$. If $d=1$ then we have $f(0)=g(0)-1=0$ which is impossible since $f(n) \neq n$ for all $n$. If $d=3$ then $g(3)=g^{2}(0)=4$ and hence $f(3)=3$ which is also impossible. Thus $g(0)=2$ and hence $g(2)=g^{2}(0)=4$.  Next, if $g(1)=1+4 k$ for some integer $k$, then $5=g^{2}(1)=g(1+4 k)=g(1)+4 k=1+8 k$ which is impossible. Thus, since $\{g(n): n=0,1,2,3\}$ is a complete residue system modulo 4 , we get $g(1)=3+4 k$ and hence $g(3)=g^{2}(1)-4 k=5-4 k$, leading to $k=0$ or $k=1$. So, we obtain iether  $$ f(0)=1, f(1)=2, f(2)=3, f(3)=4, \quad \text { or } \quad f(0)=1, f(1)=6, f(2)=3, f(3)=0 $$  thus arriving to the two functions listed in the answer.  Finally, one can check that these two function work as in Solution 1. One may simplify the checking by noticing that (8) allows us to reduce it to $n=0,1,2,3$.


Let $m \neq 0$ be an integer. Find all polynomials $P(x)$ with real coefficients such that  $$ \left(x^{3}-m x^{2}+1\right) P(x+1)+\left(x^{3}+m x^{2}+1\right) P(x-1)=2\left(x^{3}-m x+1\right) P(x) $$  for all real numbers $x$.

Solution: Let $P(x)=a_{n} x^{n}+\cdots+a_{0} x^{0}$ with $a_{n} \neq 0$. Comparing the coefficients of $x^{n+1}$ on both sides gives $a_{n}(n-2 m)(n-1)=0$, so $n=1$ or $n=2 m$.  If $n=1$, one easily verifies that $P(x)=x$ is a solution, while $P(x)=1$ is not. Since the given condition is linear in $P$, this means that the linear solutions are precisely $P(x)=t x$ for $t \in \mathbb{R}$.  Now assume that $n=2 m$. The polynomial $x P(x+1)-(x+1) P(x)=(n-1) a_{n} x^{n}+\cdots$ has degree $n$, and therefore it has at least one (possibly complex) root $r$. If $r \notin\{0,-1\}$, define $k=P(r) / r=P(r+1) /(r+1)$. If $r=0$, let $k=P(1)$. If $r=-1$, let $k=-P(-1)$. We now consider the polynomial $S(x)=P(x)-k x$. It also satisfies (1) because $P(x)$ and $k x$ satisfy it. Additionally, it has the useful property that $r$ and $r+1$ are roots.  Let $A(x)=x^{3}-m x^{2}+1$ and $B(x)=x^{3}+m x^{2}+1$. Plugging in $x=s$ into (1) implies that:  If $s-1$ and $s$ are roots of $S$ and $s$ is not a root of $A$, then $s+1$ is a root of $S$.  If $s$ and $s+1$ are roots of $S$ and $s$ is not a root of $B$, then $s-1$ is a root of $S$.  Let $a \geqslant 0$ and $b \geqslant 1$ be such that $r-a, r-a+1, \ldots, r, r+1, \ldots, r+b-1, r+b$ are roots of $S$, while $r-a-1$ and $r+b+1$ are not. The two statements above imply that $r-a$ is a root of $B$ and $r+b$ is a root of $A$.  Since $r-a$ is a root of $B(x)$ and of $A(x+a+b)$, it is also a root of their greatest common divisor $C(x)$ as integer polynomials. If $C(x)$ was a non-trivial divisor of $B(x)$, then $B$ would have a rational root $\alpha$. Since the first and last coefficients of $B$ are $1, \alpha$ can only be 1 or -1 ; but $B(-1)=m>0$ and $B(1)=m+2>0$ since $n=2 m$.  Therefore $B(x)=A(x+a+b)$. Writing $c=a+b \geqslant 1$ we compute  $$ 0=A(x+c)-B(x)=(3 c-2 m) x^{2}+c(3 c-2 m) x+c^{2}(c-m) . $$  Then we must have $3 c-2 m=c-m=0$, which gives $m=0$, a contradiction. We conclude that $f(x)=t x$ is the only solution.


Solution: Multiplying (1) by $x$, we rewrite it as  $$ x\left(x^{3}-m x^{2}+1\right) P(x+1)+x\left(x^{3}+m x^{2}+1\right) P(x-1)=[(x+1)+(x-1)]\left(x^{3}-m x+1\right) P(x) . $$  After regrouping, it becomes  $$ \left(x^{3}-m x^{2}+1\right) Q(x)=\left(x^{3}+m x^{2}+1\right) Q(x-1) \text {, } $$  where $Q(x)=x P(x+1)-(x+1) P(x)$. If $\operatorname{deg} P \geqslant 2$ then $\operatorname{deg} Q=\operatorname{deg} P$, so $Q(x)$ has a finite multiset of complex roots, which we denote $R_{Q}$. Each root is taken with its multiplicity. Then the multiset of complex roots of $Q(x-1)$ is $R_{Q}+1=\left\{z+1: z \in R_{Q}\right\}$.  Let $\left\{x_{1}, x_{2}, x_{3}\right\}$ and $\left\{y_{1}, y_{2}, y_{3}\right\}$ be the multisets of roots of the polynomials $A(x)=x^{3}-m x^{2}+1$ and $B(x)=x^{3}+m x^{2}+1$, respectively. From (2) we get the equality of multisets  $$ \left\{x_{1}, x_{2}, x_{3}\right\} \cup R_{Q}=\left\{y_{1}, y_{2}, y_{3}\right\} \cup\left(R_{Q}+1\right) . $$  For every $r \in R_{Q}$, since $r+1$ is in the set of the right hand side, we must have $r+1 \in R_{Q}$ or $r+1=x_{i}$ for some $i$. Similarly, since $r$ is in the set of the left hand side, either $r-1 \in R_{Q}$ or $r=y_{i}$ for some $i$. This implies that, possibly after relabelling $y_{1}, y_{2}, y_{3}$, all the roots of (2) may be partitioned into three chains of the form $\left\{y_{i}, y_{i}+1, \ldots, y_{i}+k_{i}=x_{i}\right\}$ for $i=1,2,3$ and some integers $k_{1}, k_{2}, k_{3} \geqslant 0$.  Now we analyze the roots of the polynomial $A_{a}(x)=x^{3}+a x^{2}+1$. Using calculus or elementary methods, we find that the local extrema of $A_{a}(x)$ occur at $x=0$ and $x=-2 a / 3$; their values are $A_{a}(0)=1>0$ and $A_{a}(-2 a / 3)=1+4 a^{3} / 27$, which is positive for integers $a \geqslant-1$ and negative for integers $a \leqslant-2$. So when $a \in \mathbb{Z}, A_{a}$ has three real roots if $a \leqslant-2$ and one if $a \geqslant-1$.  Now, since $y_{i}-x_{i} \in \mathbb{Z}$ for $i=1,2,3$, the cubics $A_{m}$ and $A_{-m}$ must have the same number of real roots. The previous analysis then implies that $m=1$ or $m=-1$. Therefore the real root $\alpha$ of $A_{1}(x)=x^{3}+x^{2}+1$ and the real root $\beta$ of $A_{-1}(x)=x^{3}-x^{2}+1$ must differ by an integer. But this is impossible, because $A_{1}\left(-\frac{3}{2}\right)=-\frac{1}{8}$ and $A_{1}(-1)=1$ so $-1.5<\alpha<-1$, while $A_{-1}(-1)=-1$ and $A_{-1}\left(-\frac{1}{2}\right)=\frac{5}{8}$, so $-1<\beta<-0.5$.  It follows that $\operatorname{deg} P \leqslant 1$. Then, as shown in Solution 1, we conclude that the solutions are $P(x)=t x$ for all real numbers $t$.


Let $n$ be a positive integer. Find the smallest integer $k$ with the following property: Given any real numbers $a_{1}, \ldots, a_{d}$ such that $a_{1}+a_{2}+\cdots+a_{d}=n$ and $0 \leqslant a_{i} \leqslant 1$ for $i=1,2, \ldots, d$, it is possible to partition these numbers into $k$ groups (some of which may be empty) such that the sum of the numbers in each group is at most 1 .  (Poland)

Solution: If $d=2 n-1$ and $a_{1}=\cdots=a_{2 n-1}=n /(2 n-1)$, then each group in such a partition can contain at most one number, since $2 n /(2 n-1)>1$. Therefore $k \geqslant 2 n-1$. It remains to show that a suitable partition into $2 n-1$ groups always exists.  We proceed by induction on $d$. For $d \leqslant 2 n-1$ the result is trivial. If $d \geqslant 2 n$, then since  $$ \left(a_{1}+a_{2}\right)+\ldots+\left(a_{2 n-1}+a_{2 n}\right) \leqslant n $$  we may find two numbers $a_{i}, a_{i+1}$ such that $a_{i}+a_{i+1} \leqslant 1$. We "merge" these two numbers into one new number $a_{i}+a_{i+1}$. By the induction hypothesis, a suitable partition exists for the $d-1$ numbers $a_{1}, \ldots, a_{i-1}, a_{i}+a_{i+1}, a_{i+2}, \ldots, a_{d}$. This induces a suitable partition for $a_{1}, \ldots, a_{d}$.


Solution: We will show that it is even possible to split the sequence $a_{1}, \ldots, a_{d}$ into $2 n-1$ contiguous groups so that the sum of the numbers in each groups does not exceed 1. Consider a segment $S$ of length $n$, and partition it into segments $S_{1}, \ldots, S_{d}$ of lengths $a_{1}, \ldots, a_{d}$, respectively, as shown below. Consider a second partition of $S$ into $n$ equal parts by $n-1$ "empty dots".  | $a_{1}$ | $a_{2}$ | $a_{3}$ | $a_{4}$ | $a_{5}$ | $a_{6}$ | $a_{7}$ | $a_{8}, a_{9}, a_{10}$ | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | |  |  |  |  |  |  |  |  |  Assume that the $n-1$ empty dots are in segments $S_{i_{1}}, \ldots, S_{i_{n-1}}$. (If a dot is on the boundary of two segments, we choose the right segment). These $n-1$ segments are distinct because they have length at most 1. Consider the partition:  $$ \left\{a_{1}, \ldots, a_{i_{1}-1}\right\},\left\{a_{i_{1}}\right\},\left\{a_{i_{1}+1}, \ldots, a_{i_{2}-1}\right\},\left\{a_{i_{2}}\right\}, \ldots\left\{a_{i_{n-1}}\right\},\left\{a_{i_{n-1}+1}, \ldots, a_{d}\right\} $$  In the example above, this partition is $\left\{a_{1}, a_{2}\right\},\left\{a_{3}\right\},\left\{a_{4}, a_{5}\right\},\left\{a_{6}\right\}, \varnothing,\left\{a_{7}\right\},\left\{a_{8}, a_{9}, a_{10}\right\}$. We claim that in this partition, the sum of the numbers in this group is at most 1 .  For the sets $\left\{a_{i_{t}}\right\}$ this is obvious since $a_{i_{t}} \leqslant 1$. For the sets $\left\{a_{i_{t}}+1, \ldots, a_{i_{t+1}-1}\right\}$ this follows from the fact that the corresponding segments lie between two neighboring empty dots, or between an endpoint of $S$ and its nearest empty dot. Therefore the sum of their lengths cannot exceed 1.


Solution: First put all numbers greater than $\frac{1}{2}$ in their own groups. Then, form the remaining groups as follows: For each group, add new $a_{i} \mathrm{~S}$ one at a time until their sum exceeds $\frac{1}{2}$. Since the last summand is at most $\frac{1}{2}$, this group has sum at most 1 . Continue this procedure until we have used all the $a_{i}$ s. Notice that the last group may have sum less than $\frac{1}{2}$. If the sum of the numbers in the last two groups is less than or equal to 1, we merge them into one group. In the end we are left with $m$ groups. If $m=1$ we are done. Otherwise the first $m-2$ have sums greater than $\frac{1}{2}$ and the last two have total sum greater than 1 . Therefore $n>(m-2) / 2+1$ so $m \leqslant 2 n-1$ as desired.  Comment 1. The original proposal asked for the minimal value of $k$ when $n=2$.  Comment 2. More generally, one may ask the same question for real numbers between 0 and 1 whose sum is a real number $r$. In this case the smallest value of $k$ is $k=\lceil 2 r\rceil-1$, as Solution 3 shows.  Solutions 1 and 2 lead to the slightly weaker bound $k \leqslant 2\lceil r\rceil-1$. This is actually the optimal bound for partitions into consecutive groups, which are the ones contemplated in these two solutions. To see this, assume that $r$ is not an integer and let $c=(r+1-\lceil r\rceil) /(1+\lceil r\rceil)$. One easily checks that $0<c<\frac{1}{2}$ and $\lceil r\rceil(2 c)+(\lceil r\rceil-1)(1-c)=r$, so the sequence  $$ 2 c, 1-c, 2 c, 1-c, \ldots, 1-c, 2 c $$  of $2\lceil r\rceil-1$ numbers satisfies the given conditions. For this sequence, the only suitable partition into consecutive groups is the trivial partition, which requires $2\lceil r\rceil-1$ groups.


In the plane, 2013 red points and 2014 blue points are marked so that no three of the marked points are collinear. One needs to draw $k$ lines not passing through the marked points and dividing the plane into several regions. The goal is to do it in such a way that no region contains points of both colors.  Find the minimal value of $k$ such that the goal is attainable for every possible configuration of 4027 points.  (Australia)

Solution: Firstly, let us present an example showing that $k \geqslant 2013$. Mark 2013 red and 2013 blue points on some circle alternately, and mark one more blue point somewhere in the plane. The circle is thus split into 4026 arcs, each arc having endpoints of different colors. Thus, if the goal is reached, then each arc should intersect some of the drawn lines. Since any line contains at most two points of the circle, one needs at least 4026/2 $=2013$ lines.  It remains to prove that one can reach the goal using 2013 lines. First of all, let us mention that for every two points $A$ and $B$ having the same color, one can draw two lines separating these points from all other ones. Namely, it suffices to take two lines parallel to $A B$ and lying on different sides of $A B$ sufficiently close to it: the only two points between these lines will be $A$ and $B$.  Now, let $P$ be the convex hull of all marked points. Two cases are possible.  Case 1. Assume that $P$ has a red vertex $A$. Then one may draw a line separating $A$ from all the other points, pair up the other 2012 red points into 1006 pairs, and separate each pair from the other points by two lines. Thus, 2013 lines will be used.  Case 2. Assume now that all the vertices of $P$ are blue. Consider any two consecutive vertices of $P$, say $A$ and $B$. One may separate these two points from the others by a line parallel to $A B$. Then, as in the previous case, one pairs up all the other 2012 blue points into 1006 pairs, and separates each pair from the other points by two lines. Again, 2013 lines will be used.  Comment 1. Instead of considering the convex hull, one may simply take a line containing two marked points $A$ and $B$ such that all the other marked points are on one side of this line. If one of $A$ and $B$ is red, then one may act as in Case 1; otherwise both are blue, and one may act as in Case 2.


Solution: Let us present a different proof of the fact that $k=2013$ suffices. In fact, we will prove a more general statement:  If $n$ points in the plane, no three of which are collinear, are colored in red and blue arbitrarily, then it suffices to draw $\lfloor n / 2\rfloor$ lines to reach the goal.  We proceed by induction on $n$. If $n \leqslant 2$ then the statement is obvious. Now assume that $n \geqslant 3$, and consider a line $\ell$ containing two marked points $A$ and $B$ such that all the other marked points are on one side of $\ell$; for instance, any line containing a side of the convex hull works.  Remove for a moment the points $A$ and $B$. By the induction hypothesis, for the remaining configuration it suffices to draw $\lfloor n / 2\rfloor-1$ lines to reach the goal. Now return the points $A$ and $B$ back. Three cases are possible.  Case 1. If $A$ and $B$ have the same color, then one may draw a line parallel to $\ell$ and separating $A$ and $B$ from the other points. Obviously, the obtained configuration of $\lfloor n / 2\rfloor$ lines works.  Case 2. If $A$ and $B$ have different colors, but they are separated by some drawn line, then again the same line parallel to $\ell$ works.  Case 3. Finally, assume that $A$ and $B$ have different colors and lie in one of the regions defined by the drawn lines. By the induction assumption, this region contains no other points of one of the colors - without loss of generality, the only blue point it contains is $A$. Then it suffices to draw a line separating $A$ from all other points.  Thus the step of the induction is proved.  Comment 2. One may ask a more general question, replacing the numbers 2013 and 2014 by any positive integers $m$ and $n$, say with $m \leqslant n$. Denote the answer for this problem by $f(m, n)$.  One may show along the lines of Solution 1 that $m \leqslant f(m, n) \leqslant m+1$; moreover, if $m$ is even then $f(m, n)=m$. On the other hand, for every odd $m$ there exists an $N$ such that $f(m, n)=m$ for all $m \leqslant n \leqslant N$, and $f(m, n)=m+1$ for all $n>N$.


A crazy physicist discovered a new kind of particle which he called an imon, after some of them mysteriously appeared in his lab. Some pairs of imons in the lab can be entangled, and each imon can participate in many entanglement relations. The physicist has found a way to perform the following two kinds of operations with these particles, one operation at a time.  (i) If some imon is entangled with an odd number of other imons in the lab, then the physicist can destroy it.  (ii) At any moment, he may double the whole family of imons in his lab by creating a copy $I^{\prime}$ of each imon $I$. During this procedure, the two copies $I^{\prime}$ and $J^{\prime}$ become entangled if and only if the original imons $I$ and $J$ are entangled, and each copy $I^{\prime}$ becomes entangled with its original imon $I$; no other entanglements occur or disappear at this moment.  Prove that the physicist may apply a sequence of such operations resulting in a family of imons, no two of which are entangled.  (Japan)

Solution: Let us consider a graph with the imons as vertices, and two imons being connected if and only if they are entangled. Recall that a proper coloring of a graph $G$ is a coloring of its vertices in several colors so that every two connected vertices have different colors.  Lemma. Assume that a graph $G$ admits a proper coloring in $n$ colors $(n>1)$. Then one may perform a sequence of operations resulting in a graph which admits a proper coloring in $n-1$ colors.  Proof. Let us apply repeatedly operation $(i)$ to any appropriate vertices while it is possible. Since the number of vertices decreases, this process finally results in a graph where all the degrees are even. Surely this graph also admits a proper coloring in $n$ colors $1, \ldots, n$; let us fix this coloring.  Now apply the operation (ii) to this graph. A proper coloring of the resulting graph in $n$ colors still exists: one may preserve the colors of the original vertices and color the vertex $I^{\prime}$ in a color $k+1(\bmod n)$ if the vertex $I$ has color $k$. Then two connected original vertices still have different colors, and so do their two connected copies. On the other hand, the vertices $I$ and $I^{\prime}$ have different colors since $n>1$.  All the degrees of the vertices in the resulting graph are odd, so one may apply operation $(i)$ to delete consecutively all the vertices of color $n$ one by one; no two of them are connected by an edge, so their degrees do not change during the process. Thus, we obtain a graph admitting a proper coloring in $n-1$ colors, as required. The lemma is proved.  Now, assume that a graph $G$ has $n$ vertices; then it admits a proper coloring in $n$ colors. Applying repeatedly the lemma we finally obtain a graph admitting a proper coloring in one color, that is - a graph with no edges, as required.


Solution: Again, we will use the graph language.  I. We start with the following observation.  Lemma. Assume that a graph $G$ contains an isolated vertex $A$, and a graph $G^{\circ}$ is obtained from $G$ by deleting this vertex. Then, if one can apply a sequence of operations which makes a graph with no edges from $G^{\circ}$, then such a sequence also exists for $G$.  Proof. Consider any operation applicable to $G^{\circ}$ resulting in a graph $G_{1}^{\circ}$; then there exists a sequence of operations applicable to $G$ and resulting in a graph $G_{1}$ differing from $G_{1}^{\circ}$ by an addition of an isolated vertex $A$. Indeed, if this operation is of type $(i)$, then one may simply repeat it in $G$.  Otherwise, the operation is of type (ii), and one may apply it to $G$ and then delete the vertex $A^{\prime}$ (it will have degree 1 ).  Thus one may change the process for $G^{\circ}$ into a corresponding process for $G$ step by step.  In view of this lemma, if at some moment a graph contains some isolated vertex, then we may simply delete it; let us call this operation (iii).  II. Let $V=\left\{A_{1}^{0}, \ldots, A_{n}^{0}\right\}$ be the vertices of the initial graph. Let us describe which graphs can appear during our operations. Assume that operation (ii) was applied $m$ times. If these were the only operations applied, then the resulting graph $G_{n}^{m}$ has the set of vertices which can be enumerated as  $$ V_{n}^{m}=\left\{A_{i}^{j}: 1 \leqslant i \leqslant n, 0 \leqslant j \leqslant 2^{m}-1\right\} $$  where $A_{i}^{0}$ is the common "ancestor" of all the vertices $A_{i}^{j}$, and the binary expansion of $j$ (adjoined with some zeroes at the left to have $m$ digits) "keeps the history" of this vertex: the $d$ th digit from the right is 0 if at the $d$ th doubling the ancestor of $A_{i}^{j}$ was in the original part, and this digit is 1 if it was in the copy.  Next, the two vertices $A_{i}^{j}$ and $A_{k}^{\ell}$ in $G_{n}^{m}$ are connected with an edge exactly if either (1) $j=\ell$ and there was an edge between $A_{i}^{0}$ and $A_{k}^{0}$ (so these vertices appeared at the same application of operation (ii)); or (2) $i=k$ and the binary expansions of $j$ and $\ell$ differ in exactly one digit (so their ancestors became connected as a copy and the original vertex at some application of (ii)).  Now, if some operations $(i)$ were applied during the process, then simply some vertices in $G_{n}^{m}$ disappeared. So, in any case the resulting graph is some induced subgraph of $G_{n}^{m}$.  III. Finally, we will show that from each (not necessarily induced) subgraph of $G_{n}^{m}$ one can obtain a graph with no vertices by applying operations $(i),(i i)$ and $(i i i)$. We proceed by induction on $n$; the base case $n=0$ is trivial.  For the induction step, let us show how to apply several operations so as to obtain a graph containing no vertices of the form $A_{n}^{j}$ for $j \in \mathbb{Z}$. We will do this in three steps.  Step 1. We apply repeatedly operation (i) to any appropriate vertices while it is possible. In the resulting graph, all vertices have even degrees.  Step 2. Apply operation (ii) obtaining a subgraph of $G_{n}^{m+1}$ with all degrees being odd. In this graph, we delete one by one all the vertices $A_{n}^{j}$ where the sum of the binary digits of $j$ is even; it is possible since there are no edges between such vertices, so all their degrees remain odd. After that, we delete all isolated vertices.  Step 3. Finally, consider any remaining vertex $A_{n}^{j}$ (then the sum of digits of $j$ is odd). If its degree is odd, then we simply delete it. Otherwise, since $A_{n}^{j}$ is not isolated, we consider any vertex adjacent to it. It has the form $A_{k}^{j}$ for some $k<n$ (otherwise it would have the form $A_{n}^{\ell}$, where $\ell$ has an even digit sum; but any such vertex has already been deleted at Step 2). No neighbor of $A_{k}^{j}$ was deleted at Steps 2 and 3, so it has an odd degree. Then we successively delete $A_{k}^{j}$ and $A_{n}^{j}$.  Notice that this deletion does not affect the applicability of this step to other vertices, since no two vertices $A_{i}^{j}$ and $A_{k}^{\ell}$ for different $j, \ell$ with odd digit sum are connected with an edge. Thus we will delete all the remaining vertices of the form $A_{n}^{j}$, obtaining a subgraph of $G_{n-1}^{m+1}$. The application of the induction hypothesis finishes the proof.  Comment. In fact, the graph $G_{n}^{m}$ is a Cartesian product of $G$ and the graph of an $m$-dimensional hypercube.


Let $n$ be a positive integer, and let $A$ be a subset of $\{1, \ldots, n\}$. An $A$-partition of $n$ into $k$ parts is a representation of $n$ as a sum $n=a_{1}+\cdots+a_{k}$, where the parts $a_{1}, \ldots, a_{k}$ belong to $A$ and are not necessarily distinct. The number of different parts in such a partition is the number of (distinct) elements in the set $\left\{a_{1}, a_{2}, \ldots, a_{k}\right\}$.  We say that an $A$-partition of $n$ into $k$ parts is optimal if there is no $A$-partition of $n$ into $r$ parts with $r<k$. Prove that any optimal $A$-partition of $n$ contains at most $\sqrt[3]{6 n}$ different parts.  (Germany)

Solution: If there are no $A$-partitions of $n$, the result is vacuously true. Otherwise, let $k_{\min }$ be the minimum number of parts in an $A$-partition of $n$, and let $n=a_{1}+\cdots+a_{k_{\min }}$ be an optimal partition. Denote by $s$ the number of different parts in this partition, so we can write $S=\left\{a_{1}, \ldots, a_{k_{\min }}\right\}=\left\{b_{1}, \ldots, b_{s}\right\}$ for some pairwise different numbers $b_{1}<\cdots<b_{s}$ in $A$.  If $s>\sqrt[3]{6 n}$, we will prove that there exist subsets $X$ and $Y$ of $S$ such that $|X|<|Y|$ and $\sum_{x \in X} x=\sum_{y \in Y} y$. Then, deleting the elements of $Y$ from our partition and adding the elements of $X$ to it, we obtain an $A$-partition of $n$ into less than $k_{\text {min }}$ parts, which is the desired contradiction.  For each positive integer $k \leqslant s$, we consider the $k$-element subset  $$ S_{1,0}^{k}:=\left\{b_{1}, \ldots, b_{k}\right\} $$  as well as the following $k$-element subsets $S_{i, j}^{k}$ of $S$ :  $$ S_{i, j}^{k}:=\left\{b_{1}, \ldots, b_{k-i}, b_{k-i+j+1}, b_{s-i+2}, \ldots, b_{s}\right\}, \quad i=1, \ldots, k, \quad j=1, \ldots, s-k $$  Pictorially, if we represent the elements of $S$ by a sequence of dots in increasing order, and represent a subset of $S$ by shading in the appropriate dots, we have:  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-27.jpg?height=124&width=967&top_left_y=1388&top_left_x=579)  Denote by $\Sigma_{i, j}^{k}$ the sum of elements in $S_{i, j}^{k}$. Clearly, $\Sigma_{1,0}^{k}$ is the minimum sum of a $k$-element subset of $S$. Next, for all appropriate indices $i$ and $j$ we have  $$ \Sigma_{i, j}^{k}=\Sigma_{i, j+1}^{k}+b_{k-i+j+1}-b_{k-i+j+2}<\Sigma_{i, j+1}^{k} \quad \text { and } \quad \sum_{i, s-k}^{k}=\sum_{i+1,1}^{k}+b_{k-i}-b_{k-i+1}<\Sigma_{i+1,1}^{k} \text {. } $$  Therefore  $$ 1 \leqslant \Sigma_{1,0}^{k}<\Sigma_{1,1}^{k}<\Sigma_{1,2}^{k}<\cdots<\Sigma_{1, s-k}^{k}<\Sigma_{2,1}^{k}<\cdots<\Sigma_{2, s-k}^{k}<\Sigma_{3,1}^{k}<\cdots<\Sigma_{k, s-k}^{k} \leqslant n . $$  To see this in the picture, we start with the $k$ leftmost points marked. At each step, we look for the rightmost point which can move to the right, and move it one unit to the right. We continue until the $k$ rightmost points are marked. As we do this, the corresponding sums clearly increase.  For each $k$ we have found $k(s-k)+1$ different integers of the form $\Sigma_{i, j}^{k}$ between 1 and $n$. As we vary $k$, the total number of integers we are considering is  $$ \sum_{k=1}^{s}(k(s-k)+1)=s \cdot \frac{s(s+1)}{2}-\frac{s(s+1)(2 s+1)}{6}+s=\frac{s\left(s^{2}+5\right)}{6}>\frac{s^{3}}{6}>n . $$  Since they are between 1 and $n$, at least two of these integers are equal. Consequently, there exist $1 \leqslant k<k^{\prime} \leqslant s$ and $X=S_{i, j}^{k}$ as well as $Y=S_{i^{\prime}, j^{\prime}}^{k^{\prime}}$ such that  $$ \sum_{x \in X} x=\sum_{y \in Y} y, \quad \text { but } \quad|X|=k<k^{\prime}=|Y| $$  as required. The result follows.


Solution: Assume, to the contrary, that the statement is false, and choose the minimum number $n$ for which it fails. So there exists a set $A \subseteq\{1, \ldots, n\}$ together with an optimal $A$ partition $n=a_{1}+\cdots+a_{k_{\min }}$ of $n$ refuting our statement, where, of course, $k_{\min }$ is the minimum number of parts in an $A$-partition of $n$. Again, we define $S=\left\{a_{1}, \ldots, a_{k_{\min }}\right\}=\left\{b_{1}, \ldots, b_{s}\right\}$ with $b_{1}<\cdots<b_{s}$; by our assumption we have $s>\sqrt[3]{6 n}>1$. Without loss of generality we assume that $a_{k_{\min }}=b_{s}$. Let us distinguish two cases.  Case 1. $b_{s} \geqslant \frac{s(s-1)}{2}+1$.  Consider the partition $n-b_{s}=a_{1}+\cdots+a_{k_{\min }-1}$, which is clearly a minimum $A$-partition of $n-b_{s}$ with at least $s-1 \geqslant 1$ different parts. Now, from $n<\frac{s^{3}}{6}$ we obtain  $$ n-b_{s} \leqslant n-\frac{s(s-1)}{2}-1<\frac{s^{3}}{6}-\frac{s(s-1)}{2}-1<\frac{(s-1)^{3}}{6} $$  so $s-1>\sqrt[3]{6\left(n-b_{s}\right)}$, which contradicts the choice of $n$.  Case 2. $b_{s} \leqslant \frac{s(s-1)}{2}$.  Set $b_{0}=0, \Sigma_{0,0}=0$, and $\Sigma_{i, j}=b_{1}+\cdots+b_{i-1}+b_{j}$ for $1 \leqslant i \leqslant j<s$. There are $\frac{s(s-1)}{2}+1>b_{s}$ such sums; so at least two of them, say $\Sigma_{i, j}$ and $\Sigma_{i^{\prime}, j^{\prime}}$, are congruent modulo $b_{s}$ (where $(i, j) \neq\left(i^{\prime}, j^{\prime}\right)$ ). This means that $\Sigma_{i, j}-\Sigma_{i^{\prime}, j^{\prime}}=r b_{s}$ for some integer $r$. Notice that for $i \leqslant j<k<s$ we have  $$ 0<\Sigma_{i, k}-\Sigma_{i, j}=b_{k}-b_{j}<b_{s} $$  so the indices $i$ and $i^{\prime}$ are distinct, and we may assume that $i>i^{\prime}$. Next, we observe that $\Sigma_{i, j}-\Sigma_{i^{\prime}, j^{\prime}}=\left(b_{i^{\prime}}-b_{j^{\prime}}\right)+b_{j}+b_{i^{\prime}+1}+\cdots+b_{i-1}$ and $b_{i^{\prime}} \leqslant b_{j^{\prime}}$ imply  $$ -b_{s}<-b_{j^{\prime}}<\Sigma_{i, j}-\Sigma_{i^{\prime}, j^{\prime}}<\left(i-i^{\prime}\right) b_{s}, $$  so $0 \leqslant r \leqslant i-i^{\prime}-1$.  Thus, we may remove the $i$ terms of $\Sigma_{i, j}$ in our $A$-partition, and replace them by the $i^{\prime}$ terms of $\Sigma_{i^{\prime}, j^{\prime}}$ and $r$ terms equal to $b_{s}$, for a total of $r+i^{\prime}<i$ terms. The result is an $A$-partition of $n$ into a smaller number of parts, a contradiction.  Comment. The original proposal also contained a second part, showing that the estimate appearing in the problem has the correct order of magnitude:  For every positive integer $n$, there exist a set $A$ and an optimal $A$-partition of $n$ that contains $\lfloor\sqrt[3]{2 n}\rfloor$ different parts.  The Problem Selection Committee removed this statement from the problem, since it seems to be less suitable for the competiton; but for completeness we provide an outline of its proof here.  Let $k=\lfloor\sqrt[3]{2 n}\rfloor-1$. The statement is trivial for $n<4$, so we assume $n \geqslant 4$ and hence $k \geqslant 1$. Let $h=\left\lfloor\frac{n-1}{k}\right\rfloor$. Notice that $h \geqslant \frac{n}{k}-1$.  Now let $A=\{1, \ldots, h\}$, and set $a_{1}=h, a_{2}=h-1, \ldots, a_{k}=h-k+1$, and $a_{k+1}=n-\left(a_{1}+\cdots+a_{k}\right)$. It is not difficult to prove that $a_{k}>a_{k+1} \geqslant 1$, which shows that  $$ n=a_{1}+\ldots+a_{k+1} $$  is an $A$-partition of $n$ into $k+1$ different parts. Since $k h<n$, any $A$-partition of $n$ has at least $k+1$ parts. Therefore our $A$-partition is optimal, and it has $\lfloor\sqrt[3]{2 n}\rfloor$ distinct parts, as desired.


Let $r$ be a positive integer, and let $a_{0}, a_{1}, \ldots$ be an infinite sequence of real numbers. Assume that for all nonnegative integers $m$ and $s$ there exists a positive integer $n \in[m+1, m+r]$ such that  $$ a_{m}+a_{m+1}+\cdots+a_{m+s}=a_{n}+a_{n+1}+\cdots+a_{n+s} $$  Prove that the sequence is periodic, i. e. there exists some $p \geqslant 1$ such that $a_{n+p}=a_{n}$ for all $n \geqslant 0$.

Solution: For every indices $m \leqslant n$ we will denote $S(m, n)=a_{m}+a_{m+1}+\cdots+a_{n-1}$; thus $S(n, n)=0$. Let us start with the following lemma.  Lemma. Let $b_{0}, b_{1}, \ldots$ be an infinite sequence. Assume that for every nonnegative integer $m$ there exists a nonnegative integer $n \in[m+1, m+r]$ such that $b_{m}=b_{n}$. Then for every indices $k \leqslant \ell$ there exists an index $t \in[\ell, \ell+r-1]$ such that $b_{t}=b_{k}$. Moreover, there are at most $r$ distinct numbers among the terms of $\left(b_{i}\right)$.  Proof. To prove the first claim, let us notice that there exists an infinite sequence of indices $k_{1}=k, k_{2}, k_{3}, \ldots$ such that $b_{k_{1}}=b_{k_{2}}=\cdots=b_{k}$ and $k_{i}<k_{i+1} \leqslant k_{i}+r$ for all $i \geqslant 1$. This sequence is unbounded from above, thus it hits each segment of the form $[\ell, \ell+r-1]$ with $\ell \geqslant k$, as required.  To prove the second claim, assume, to the contrary, that there exist $r+1$ distinct numbers $b_{i_{1}}, \ldots, b_{i_{r+1}}$. Let us apply the first claim to $k=i_{1}, \ldots, i_{r+1}$ and $\ell=\max \left\{i_{1}, \ldots, i_{r+1}\right\}$; we obtain that for every $j \in\{1, \ldots, r+1\}$ there exists $t_{j} \in[s, s+r-1]$ such that $b_{t_{j}}=b_{i_{j}}$. Thus the segment $[s, s+r-1]$ should contain $r+1$ distinct integers, which is absurd.  Setting $s=0$ in the problem condition, we see that the sequence $\left(a_{i}\right)$ satisfies the condition of the lemma, thus it attains at most $r$ distinct values. Denote by $A_{i}$ the ordered $r$-tuple $\left(a_{i}, \ldots, a_{i+r-1}\right)$; then among $A_{i}$ 's there are at most $r^{r}$ distinct tuples, so for every $k \geqslant 0$ two of the tuples $A_{k}, A_{k+1}, \ldots, A_{k+r^{r}}$ are identical. This means that there exists a positive integer $p \leqslant r^{r}$ such that the equality $A_{d}=A_{d+p}$ holds infinitely many times. Let $D$ be the set of indices $d$ satisfying this relation.  Now we claim that $D$ coincides with the set of all nonnegative integers. Since $D$ is unbounded, it suffices to show that $d \in D$ whenever $d+1 \in D$. For that, denote $b_{k}=S(k, p+k)$. The sequence $b_{0}, b_{1}, \ldots$ satisfies the lemma conditions, so there exists an index $t \in[d+1, d+r]$ such that $S(t, t+p)=S(d, d+p)$. This last relation rewrites as $S(d, t)=S(d+p, t+p)$. Since $A_{d+1}=A_{d+p+1}$, we have $S(d+1, t)=S(d+p+1, t+p)$, therefore we obtain  $$ a_{d}=S(d, t)-S(d+1, t)=S(d+p, t+p)-S(d+p+1, t+p)=a_{d+p} $$  and thus $A_{d}=A_{d+p}$, as required.  Finally, we get $A_{d}=A_{d+p}$ for all $d$, so in particular $a_{d}=a_{d+p}$ for all $d$, QED.  Comment 1. In the present proof, the upper bound for the minimal period length is $r^{r}$. This bound is not sharp; for instance, one may improve it to $(r-1)^{r}$ for $r \geqslant 3$..  On the other hand, this minimal length may happen to be greater than $r$. For instance, it is easy to check that the sequence with period $(3,-3,3,-3,3,-1,-1,-1)$ satisfies the problem condition for $r=7$.  Comment 2. The conclusion remains true even if the problem condition only holds for every $s \geqslant N$ for some positive integer $N$. To show that, one can act as follows. Firstly, the sums of the form $S(i, i+N)$ attain at most $r$ values, as well as the sums of the form $S(i, i+N+1)$. Thus the terms $a_{i}=S(i, i+N+1)-$ $S(i+1, i+N+1)$ attain at most $r^{2}$ distinct values. Then, among the tuples $A_{k}, A_{k+N}, \ldots, A_{k+r^{2 r} N}$ two are identical, so for some $p \leqslant r^{2 r}$ the set $D=\left\{d: A_{d}=A_{d+N p}\right\}$ is infinite. The further arguments apply almost literally, with $p$ being replaced by $N p$.  After having proved that such a sequence is also necessarily periodic, one may reduce the bound for the minimal period length to $r^{r}$ - essentially by verifying that the sequence satisfies the original version of the condition.


In some country several pairs of cities are connected by direct two-way flights. It is possible to go from any city to any other by a sequence of flights. The distance between two cities is defined to be the least possible number of flights required to go from one of them to the other. It is known that for any city there are at most 100 cities at distance exactly three from it. Prove that there is no city such that more than 2550 other cities have distance exactly four from it.  (Russia)

Solution: Let us denote by $d(a, b)$ the distance between the cities $a$ and $b$, and by  $$ S_{i}(a)=\{c: d(a, c)=i\} $$  the set of cities at distance exactly $i$ from city $a$.  Assume that for some city $x$ the set $D=S_{4}(x)$ has size at least 2551 . Let $A=S_{1}(x)$. A subset $A^{\prime}$ of $A$ is said to be substantial, if every city in $D$ can be reached from $x$ with four flights while passing through some member of $A^{\prime}$; in other terms, every city in $D$ has distance 3 from some member of $A^{\prime}$, or $D \subseteq \bigcup_{a \in A^{\prime}} S_{3}(a)$. For instance, $A$ itself is substantial. Now let us fix some substantial subset $A^{*}$ of $A$ having the minimal cardinality $m=\left|A^{*}\right|$.  Since  $$ m(101-m) \leqslant 50 \cdot 51=2550 $$  there has to be a city $a \in A^{*}$ such that $\left|S_{3}(a) \cap D\right| \geqslant 102-m$. As $\left|S_{3}(a)\right| \leqslant 100$, we obtain that $S_{3}(a)$ may contain at most $100-(102-m)=m-2$ cities $c$ with $d(c, x) \leqslant 3$. Let us denote by $T=\left\{c \in S_{3}(a): d(x, c) \leqslant 3\right\}$ the set of all such cities, so $|T| \leqslant m-2$. Now, to get a contradiction, we will construct $m-1$ distinct elements in $T$, corresponding to $m-1$ elements of the set $A_{a}=A^{*} \backslash\{a\}$.  Firstly, due to the minimality of $A^{*}$, for each $y \in A_{a}$ there exists some city $d_{y} \in D$ which can only be reached with four flights from $x$ by passing through $y$. So, there is a way to get from $x$ to $d_{y}$ along $x-y-b_{y}-c_{y}-d_{y}$ for some cities $b_{y}$ and $c_{y}$; notice that $d\left(x, b_{y}\right)=2$ and $d\left(x, c_{y}\right)=3$ since this path has the minimal possible length.  Now we claim that all $2(m-1)$ cities of the form $b_{y}, c_{y}$ with $y \in A_{a}$ are distinct. Indeed, no $b_{y}$ may coincide with any $c_{z}$ since their distances from $x$ are different. On the other hand, if one had $b_{y}=b_{z}$ for $y \neq z$, then there would exist a path of length 4 from $x$ to $d_{z}$ via $y$, namely $x-y-b_{z}-c_{z}-d_{z}$; this is impossible by the choice of $d_{z}$. Similarly, $c_{y} \neq c_{z}$ for $y \neq z$.  So, it suffices to prove that for every $y \in A_{a}$, one of the cities $b_{y}$ and $c_{y}$ has distance 3 from $a$ (and thus belongs to $T$ ). For that, notice that $d(a, y) \leqslant 2$ due to the path $a-x-y$, while $d\left(a, d_{y}\right) \geqslant d\left(x, d_{y}\right)-d(x, a)=3$. Moreover, $d\left(a, d_{y}\right) \neq 3$ by the choice of $d_{y}$; thus $d\left(a, d_{y}\right)>3$. Finally, in the sequence $d(a, y), d\left(a, b_{y}\right), d\left(a, c_{y}\right), d\left(a, d_{y}\right)$ the neighboring terms differ by at most 1 , the first term is less than 3 , and the last one is greater than 3 ; thus there exists one which is equal to 3 , as required.  Comment 1. The upper bound 2550 is sharp. This can be seen by means of various examples; one of them is the "Roman Empire": it has one capital, called "Rome", that is connected to 51 semicapitals by internally disjoint paths of length 3. Moreover, each of these semicapitals is connected to 50 rural cities by direct flights.  Comment 2. Observe that, under the conditions of the problem, there exists no bound for the size of $S_{1}(x)$ or $S_{2}(x)$.  Comment 3. The numbers 100 and 2550 appearing in the statement of the problem may be replaced by $n$ and $\left\lfloor\frac{(n+1)^{2}}{4}\right\rfloor$ for any positive integer $n$. Still more generally, one can also replace the pair $(3,4)$ of distances under consideration by any pair $(r, s)$ of positive integers satisfying $r<s \leqslant \frac{3}{2} r$.  To adapt the above proof to this situation, one takes $A=S_{s-r}(x)$ and defines the concept of substantiality as before. Then one takes $A^{*}$ to be a minimal substantial subset of $A$, and for each $y \in A^{*}$ one fixes an element $d_{y} \in S_{s}(x)$ which is only reachable from $x$ by a path of length $s$ by passing through $y$. As before, it suffices to show that for distinct $a, y \in A^{*}$ and a path $y=y_{0}-y_{1}-\ldots-y_{r}=d_{y}$, at least one of the cities $y_{0}, \ldots, y_{r-1}$ has distance $r$ from $a$. This can be done as above; the relation $s \leqslant \frac{3}{2} r$ is used here to show that $d\left(a, y_{0}\right) \leqslant r$.  Moreover, the estimate $\left[\frac{(n+1)^{2}}{4}\right\rfloor$ is also sharp for every positive integer $n$ and every positive integers $r, s$ with $r<s \leqslant \frac{3}{2} r$. This may be shown by an example similar to that in the previous comment.


Let $n \geqslant 2$ be an integer. Consider all circular arrangements of the numbers $0,1, \ldots, n$; the $n+1$ rotations of an arrangement are considered to be equal. A circular arrangement is called beautiful if, for any four distinct numbers $0 \leqslant a, b, c, d \leqslant n$ with $a+c=b+d$, the chord joining numbers $a$ and $c$ does not intersect the chord joining numbers $b$ and $d$.  Let $M$ be the number of beautiful arrangements of $0,1, \ldots, n$. Let $N$ be the number of pairs $(x, y)$ of positive integers such that $x+y \leqslant n$ and $\operatorname{gcd}(x, y)=1$. Prove that  $$ M=N+1 $$  (Russia)

Solution: Given a circular arrangement of $[0, n]=\{0,1, \ldots, n\}$, we define a $k$-chord to be a (possibly degenerate) chord whose (possibly equal) endpoints add up to $k$. We say that three chords of a circle are aligned if one of them separates the other two. Say that $m \geqslant 3$ chords are aligned if any three of them are aligned. For instance, in Figure 1, $A, B$, and $C$ are aligned, while $B, C$, and $D$ are not.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-33.jpg?height=423&width=420&top_left_y=1035&top_left_x=560)  Figure 1  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-33.jpg?height=436&width=439&top_left_y=1018&top_left_x=1125)  Figure 2  Claim. In a beautiful arrangement, the $k$-chords are aligned for any integer $k$.  Proof. We proceed by induction. For $n \leqslant 3$ the statement is trivial. Now let $n \geqslant 4$, and proceed by contradiction. Consider a beautiful arrangement $S$ where the three $k$-chords $A, B, C$ are not aligned. If $n$ is not among the endpoints of $A, B$, and $C$, then by deleting $n$ from $S$ we obtain a beautiful arrangement $S \backslash\{n\}$ of $[0, n-1]$, where $A, B$, and $C$ are aligned by the induction hypothesis. Similarly, if 0 is not among these endpoints, then deleting 0 and decreasing all the numbers by 1 gives a beautiful arrangement $S \backslash\{0\}$ where $A, B$, and $C$ are aligned. Therefore both 0 and $n$ are among the endpoints of these segments. If $x$ and $y$ are their respective partners, we have $n \geqslant 0+x=k=n+y \geqslant n$. Thus 0 and $n$ are the endpoints of one of the chords; say it is $C$.  Let $D$ be the chord formed by the numbers $u$ and $v$ which are adjacent to 0 and $n$ and on the same side of $C$ as $A$ and $B$, as shown in Figure 2. Set $t=u+v$. If we had $t=n$, the $n-$ chords $A$, $B$, and $D$ would not be aligned in the beautiful arrangement $S \backslash\{0, n\}$, contradicting the induction hypothesis. If $t<n$, then the $t$-chord from 0 to $t$ cannot intersect $D$, so the chord $C$ separates $t$ and $D$. The chord $E$ from $t$ to $n-t$ does not intersect $C$, so $t$ and $n-t$ are on the same side of $C$. But then the chords $A, B$, and $E$ are not aligned in $S \backslash\{0, n\}$, a contradiction. Finally, the case $t>n$ is equivalent to the case $t<n$ via the beauty-preserving relabelling $x \mapsto n-x$ for $0 \leqslant x \leqslant n$, which sends $t$-chords to $(2 n-t)$-chords. This proves the Claim.  Having established the Claim, we prove the desired result by induction. The case $n=2$ is trivial. Now assume that $n \geqslant 3$. Let $S$ be a beautiful arrangement of $[0, n]$ and delete $n$ to obtain the beautiful arrangement $T$ of $[0, n-1]$. The $n$-chords of $T$ are aligned, and they contain every point except 0 . Say $T$ is of Type 1 if 0 lies between two of these $n$-chords, and it is of Type 2 otherwise; i.e., if 0 is aligned with these $n$-chords. We will show that each Type 1 arrangement of $[0, n-1]$ arises from a unique arrangement of $[0, n]$, and each Type 2 arrangement of $[0, n-1]$ arises from exactly two beautiful arrangements of $[0, n]$.  If $T$ is of Type 1, let 0 lie between chords $A$ and $B$. Since the chord from 0 to $n$ must be aligned with $A$ and $B$ in $S, n$ must be on the other arc between $A$ and $B$. Therefore $S$ can be recovered uniquely from $T$. In the other direction, if $T$ is of Type 1 and we insert $n$ as above, then we claim the resulting arrangement $S$ is beautiful. For $0<k<n$, the $k$-chords of $S$ are also $k$-chords of $T$, so they are aligned. Finally, for $n<k<2 n$, notice that the $n$-chords of $S$ are parallel by construction, so there is an antisymmetry axis $\ell$ such that $x$ is symmetric to $n-x$ with respect to $\ell$ for all $x$. If we had two $k$-chords which intersect, then their reflections across $\ell$ would be two $(2 n-k)$-chords which intersect, where $0<2 n-k<n$, a contradiction.  If $T$ is of Type 2, there are two possible positions for $n$ in $S$, on either side of 0 . As above, we check that both positions lead to beautiful arrangements of $[0, n]$.  Hence if we let $M_{n}$ be the number of beautiful arrangements of $[0, n]$, and let $L_{n}$ be the number of beautiful arrangements of $[0, n-1]$ of Type 2 , we have  $$ M_{n}=\left(M_{n-1}-L_{n-1}\right)+2 L_{n-1}=M_{n-1}+L_{n-1} \text {. } $$  It then remains to show that $L_{n-1}$ is the number of pairs $(x, y)$ of positive integers with $x+y=n$ and $\operatorname{gcd}(x, y)=1$. Since $n \geqslant 3$, this number equals $\varphi(n)=\#\{x: 1 \leqslant x \leqslant n, \operatorname{gcd}(x, n)=1\}$.  To prove this, consider a Type 2 beautiful arrangement of $[0, n-1]$. Label the positions $0, \ldots, n-1(\bmod n)$ clockwise around the circle, so that number 0 is in position 0 . Let $f(i)$ be the number in position $i$; note that $f$ is a permutation of $[0, n-1]$. Let $a$ be the position such that $f(a)=n-1$.  Since the $n$-chords are aligned with 0 , and every point is in an $n$-chord, these chords are all parallel and  $$ f(i)+f(-i)=n \quad \text { for all } i $$  Similarly, since the $(n-1)$-chords are aligned and every point is in an $(n-1)$-chord, these chords are also parallel and  $$ f(i)+f(a-i)=n-1 \quad \text { for all } i \text {. } $$  Therefore $f(a-i)=f(-i)-1$ for all $i$; and since $f(0)=0$, we get  $$ f(-a k)=k \quad \text { for all } k . $$  Recall that this is an equality modulo $n$. Since $f$ is a permutation, we must have $(a, n)=1$. Hence $L_{n-1} \leqslant \varphi(n)$.  To prove equality, it remains to observe that the labeling (1) is beautiful. To see this, consider four numbers $w, x, y, z$ on the circle with $w+y=x+z$. Their positions around the circle satisfy $(-a w)+(-a y)=(-a x)+(-a z)$, which means that the chord from $w$ to $y$ and the chord from $x$ to $z$ are parallel. Thus (1) is beautiful, and by construction it has Type 2. The desired result follows.


Solution: Notice that there are exactly $N$ irreducible fractions $f_{1}<\cdots<f_{N}$ in $(0,1)$ whose denominator is at most $n$, since the pair $(x, y)$ with $x+y \leqslant n$ and $(x, y)=1$ corresponds to the fraction $x /(x+y)$. Write $f_{i}=\frac{a_{i}}{b_{i}}$ for $1 \leqslant i \leqslant N$.  We begin by constructing $N+1$ beautiful arrangements. Take any $\alpha \in(0,1)$ which is not one of the above $N$ fractions. Consider a circle of perimeter 1 . Successively mark points $0,1,2, \ldots, n$ where 0 is arbitrary, and the clockwise distance from $i$ to $i+1$ is $\alpha$. The point $k$ will be at clockwise distance $\{k \alpha\}$ from 0 , where $\{r\}$ denotes the fractional part of $r$. Call such a circular arrangement cyclic and denote it by $A(\alpha)$. If the clockwise order of the points is the same in $A\left(\alpha_{1}\right)$ and $A\left(\alpha_{2}\right)$, we regard them as the same circular arrangement. Figure 3 shows the cyclic arrangement $A(3 / 5+\epsilon)$ of $[0,13]$ where $\epsilon>0$ is very small.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-35.jpg?height=585&width=607&top_left_y=797&top_left_x=756)  Figure 3  If $0 \leqslant a, b, c, d \leqslant n$ satisfy $a+c=b+d$, then $a \alpha+c \alpha=b \alpha+d \alpha$, so the chord from $a$ to $c$ is parallel to the chord from $b$ to $d$ in $A(\alpha)$. Hence in a cyclic arrangement all $k$-chords are parallel. In particular every cyclic arrangement is beautiful.  Next we show that there are exactly $N+1$ distinct cyclic arrangements. To see this, let us see how $A(\alpha)$ changes as we increase $\alpha$ from 0 to 1 . The order of points $p$ and $q$ changes precisely when we cross a value $\alpha=f$ such that $\{p f\}=\{q f\}$; this can only happen if $f$ is one of the $N$ fractions $f_{1}, \ldots, f_{N}$. Therefore there are at most $N+1$ different cyclic arrangements.  To show they are all distinct, recall that $f_{i}=a_{i} / b_{i}$ and let $\epsilon>0$ be a very small number. In the arrangement $A\left(f_{i}+\epsilon\right)$, point $k$ lands at $\frac{k a_{i}\left(\bmod b_{i}\right)}{b_{i}}+k \epsilon$. Therefore the points are grouped into $b_{i}$ clusters next to the points $0, \frac{1}{b_{i}}, \ldots, \frac{b_{i}-1}{b_{i}}$ of the circle. The cluster following $\frac{k}{b_{i}}$ contains the numbers congruent to $k a_{i}^{-1}$ modulo $b_{i}$, listed clockwise in increasing order. It follows that the first number after 0 in $A\left(f_{i}+\epsilon\right)$ is $b_{i}$, and the first number after 0 which is less than $b_{i}$ is $a_{i}^{-1}\left(\bmod b_{i}\right)$, which uniquely determines $a_{i}$. In this way we can recover $f_{i}$ from the cyclic arrangement. Note also that $A\left(f_{i}+\epsilon\right)$ is not the trivial arrangement where we list $0,1, \ldots, n$ in order clockwise. It follows that the $N+1$ cyclic arrangements $A(\epsilon), A\left(f_{1}+\epsilon\right), \ldots, A\left(f_{N}+\epsilon\right)$ are distinct.  Let us record an observation which will be useful later:  $$ \text { if } f_{i}<\alpha<f_{i+1} \text { then } 0 \text { is immediately after } b_{i+1} \text { and before } b_{i} \text { in } A(\alpha) \text {. } $$  Indeed, we already observed that $b_{i}$ is the first number after 0 in $A\left(f_{i}+\epsilon\right)=A(\alpha)$. Similarly we see that $b_{i+1}$ is the last number before 0 in $A\left(f_{i+1}-\epsilon\right)=A(\alpha)$.  Finally, we show that any beautiful arrangement of $[0, n]$ is cyclic by induction on $n$. For $n \leqslant 2$ the result is clear. Now assume that all beautiful arrangements of $[0, n-1]$ are cyclic, and consider a beautiful arrangement $A$ of $[0, n]$. The subarrangement $A_{n-1}=A \backslash\{n\}$ of $[0, n-1]$ obtained by deleting $n$ is cyclic; say $A_{n-1}=A_{n-1}(\alpha)$.  Let $\alpha$ be between the consecutive fractions $\frac{p_{1}}{q_{1}}<\frac{p_{2}}{q_{2}}$ among the irreducible fractions of denominator at most $n-1$. There is at most one fraction $\frac{i}{n}$ in $\left(\frac{p_{1}}{q_{1}}, \frac{p_{2}}{q_{2}}\right)$, since $\frac{i}{n}<\frac{i}{n-1} \leqslant \frac{i+1}{n}$ for $0<i \leqslant n-1$.  Case 1. There is no fraction with denominator $n$ between $\frac{p_{1}}{q_{1}}$ and $\frac{p_{2}}{q_{2}}$.  In this case the only cyclic arrangement extending $A_{n-1}(\alpha)$ is $A_{n}(\alpha)$. We know that $A$ and $A_{n}(\alpha)$ can only differ in the position of $n$. Assume $n$ is immediately after $x$ and before $y$ in $A_{n}(\alpha)$. Since the neighbors of 0 are $q_{1}$ and $q_{2}$ by (2), we have $x, y \geqslant 1$.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-36.jpg?height=239&width=721&top_left_y=908&top_left_x=694)  Figure 4  In $A_{n}(\alpha)$ the chord from $n-1$ to $x$ is parallel and adjacent to the chord from $n$ to $x-1$, so $n-1$ is between $x-1$ and $x$ in clockwise order, as shown in Figure 4. Similarly, $n-1$ is between $y$ and $y-1$. Therefore $x, y, x-1, n-1$, and $y-1$ occur in this order in $A_{n}(\alpha)$ and hence in $A$ (possibly with $y=x-1$ or $x=y-1$ ).  Now, $A$ may only differ from $A_{n}(\alpha)$ in the location of $n$. In $A$, since the chord from $n-1$ to $x$ and the chord from $n$ to $x-1$ do not intersect, $n$ is between $x$ and $n-1$. Similarly, $n$ is between $n-1$ and $y$. Then $n$ must be between $x$ and $y$ and $A=A_{n}(\alpha)$. Therefore $A$ is cyclic as desired.  Case 2. There is exactly one $i$ with $\frac{p_{1}}{q_{1}}<\frac{i}{n}<\frac{p_{2}}{q_{2}}$.  In this case there exist two cyclic arrangements $A_{n}\left(\alpha_{1}\right)$ and $A_{n}\left(\alpha_{2}\right)$ of the numbers $0, \ldots, n$ extending $A_{n-1}(\alpha)$, where $\frac{p_{1}}{q_{1}}<\alpha_{1}<\frac{i}{n}$ and $\frac{i}{n}<\alpha_{2}<\frac{p_{2}}{q_{2}}$. In $A_{n-1}(\alpha), 0$ is the only number between $q_{2}$ and $q_{1}$ by (2). For the same reason, $n$ is between $q_{2}$ and 0 in $A_{n}\left(\alpha_{1}\right)$, and between 0 and $q_{1}$ in $A_{n}\left(\alpha_{2}\right)$.  Letting $x=q_{2}$ and $y=q_{1}$, the argument of Case 1 tells us that $n$ must be between $x$ and $y$ in $A$. Therefore $A$ must equal $A_{n}\left(\alpha_{1}\right)$ or $A_{n}\left(\alpha_{2}\right)$, and therefore it is cyclic.  This concludes the proof that every beautiful arrangement is cyclic. It follows that there are exactly $N+1$ beautiful arrangements of $[0, n]$ as we wished to show.


Players $A$ and $B$ play a paintful game on the real line. Player $A$ has a pot of paint with four units of black ink. A quantity $p$ of this ink suffices to blacken a (closed) real interval of length $p$. In every round, player $A$ picks some positive integer $m$ and provides $1 / 2^{m}$ units of ink from the pot. Player $B$ then picks an integer $k$ and blackens the interval from $k / 2^{m}$ to $(k+1) / 2^{m}$ (some parts of this interval may have been blackened before). The goal of player $A$ is to reach a situation where the pot is empty and the interval $[0,1]$ is not completely blackened.  Decide whether there exists a strategy for player $A$ to win in a finite number of moves.  (Austria)

Solution: We will present a strategy for player $B$ that guarantees that the interval $[0,1]$ is completely blackened, once the paint pot has become empty.  At the beginning of round $r$, let $x_{r}$ denote the largest real number for which the interval between 0 and $x_{r}$ has already been blackened; for completeness we define $x_{1}=0$. Let $m$ be the integer picked by player $A$ in this round; we define an integer $y_{r}$ by  $$ \frac{y_{r}}{2^{m}} \leqslant x_{r}<\frac{y_{r}+1}{2^{m}} $$  Note that $I_{0}^{r}=\left[y_{r} / 2^{m},\left(y_{r}+1\right) / 2^{m}\right]$ is the leftmost interval that may be painted in round $r$ and that still contains some uncolored point.  Player $B$ now looks at the next interval $I_{1}^{r}=\left[\left(y_{r}+1\right) / 2^{m},\left(y_{r}+2\right) / 2^{m}\right]$. If $I_{1}^{r}$ still contains an uncolored point, then player $B$ blackens the interval $I_{1}^{r}$; otherwise he blackens the interval $I_{0}^{r}$. We make the convention that, at the beginning of the game, the interval $[1,2]$ is already blackened; thus, if $y_{r}+1=2^{m}$, then $B$ blackens $I_{0}^{r}$.  Our aim is to estimate the amount of ink used after each round. Firstly, we will prove by induction that, if before $r$ th round the segment $[0,1]$ is not completely colored, then, before this move,  (i) the amount of ink used for the segment $\left[0, x_{r}\right]$ is at most $3 x_{r}$; and  (ii) for every $m, B$ has blackened at most one interval of length $1 / 2^{m}$ to the right of $x_{r}$.  Obviously, these conditions are satisfied for $r=0$. Now assume that they were satisfied before the $r$ th move, and consider the situation after this move; let $m$ be the number $A$ has picked at this move.  If $B$ has blackened the interval $I_{1}^{r}$ at this move, then $x_{r+1}=x_{r}$, and $(i)$ holds by the induction hypothesis. Next, had $B$ blackened before the $r$ th move any interval of length $1 / 2^{m}$ to the right of $x_{r}$, this interval would necessarily coincide with $I_{1}^{r}$. By our strategy, this cannot happen. So, condition (ii) also remains valid.  Assume now that $B$ has blackened the interval $I_{0}^{r}$ at the $r$ th move, but the interval $[0,1]$ still contains uncolored parts (which means that $I_{1}^{r}$ is contained in $[0,1]$ ). Then condition (ii) clearly remains true, and we need to check ( $i$ ) only. In our case, the intervals $I_{0}^{r}$ and $I_{1}^{r}$ are completely colored after the $r$ th move, so $x_{r+1}$ either reaches the right endpoint of $I_{1}$ or moves even further to the right. So, $x_{r+1}=x_{r}+\alpha$ for some $\alpha>1 / 2^{m}$.  Next, any interval blackened by $B$ before the $r$ th move which intersects $\left(x_{r}, x_{r+1}\right)$ should be contained in $\left[x_{r}, x_{r+1}\right]$; by (ii), all such intervals have different lengths not exceeding $1 / 2^{m}$, so the total amount of ink used for them is less than $2 / 2^{m}$. Thus, the amount of ink used for the segment $\left[0, x_{r+1}\right]$ does not exceed the sum of $2 / 2^{m}, 3 x_{r}$ (used for $\left[0, x_{r}\right]$ ), and $1 / 2^{m}$ used for the segment $I_{0}^{r}$. In total it gives at most $3\left(x_{r}+1 / 2^{m}\right)<3\left(x_{r}+\alpha\right)=3 x_{r+1}$. Thus condition $(i)$ is also verified in this case. The claim is proved.  Finally, we can perform the desired estimation. Consider any situation in the game, say after the $(r-1)$ st move; assume that the segment $[0,1]$ is not completely black. By $(i i)$, in the segment $\left[x_{r}, 1\right]$ player $B$ has colored several segments of different lengths; all these lengths are negative powers of 2 not exceeding $1-x_{r}$; thus the total amount of ink used for this interval is at most $2\left(1-x_{r}\right)$. Using $(i)$, we obtain that the total amount of ink used is at most $3 x_{r}+2\left(1-x_{r}\right)<3$. Thus the pot is not empty, and therefore $A$ never wins.  Comment 1. Notice that this strategy works even if the pot contains initially only 3 units of ink.  Comment 2. There exist other strategies for $B$ allowing him to prevent emptying the pot before the whole interval is colored. On the other hand, let us mention some idea which does not work.  Player $B$ could try a strategy in which the set of blackened points in each round is an interval of the type $[0, x]$. Such a strategy cannot work (even if there is more ink available). Indeed, under the assumption that $B$ uses such a strategy, let us prove by induction on $s$ the following statement:  For any positive integer $s$, player $A$ has a strategy picking only positive integers $m \leqslant s$ in which, if player $B$ ever paints a point $x \geqslant 1-1 / 2^{s}$ then after some move, exactly the interval $\left[0,1-1 / 2^{s}\right]$ is blackened, and the amount of ink used up to this moment is at least s/2.  For the base case $s=1$, player $A$ just picks $m=1$ in the first round. If for some positive integer $k$ player $A$ has such a strategy, for $s+1$ he can first rescale his strategy to the interval $[0,1 / 2]$ (sending in each round half of the amount of ink he would give by the original strategy). Thus, after some round, the interval $\left[0,1 / 2-1 / 2^{s+1}\right]$ becomes blackened, and the amount of ink used is at least $s / 4$. Now player $A$ picks $m=1 / 2$, and player $B$ spends $1 / 2$ unit of ink to blacken the interval [0,1/2]. After that, player $A$ again rescales his strategy to the interval $[1 / 2,1]$, and player $B$ spends at least $s / 4$ units of ink to blacken the interval $\left[1 / 2,1-1 / 2^{s+1}\right]$, so he spends in total at least $s / 4+1 / 2+s / 4=(s+1) / 2$ units of ink.  Comment 3. In order to avoid finiteness issues, the statement could be replaced by the following one:  Players $A$ and $B$ play a paintful game on the real numbers. Player $A$ has a paint pot with four units of black ink. A quantity $p$ of this ink suffices to blacken a (closed) real interval of length $p$. In the beginning of the game, player $A$ chooses (and announces) a positive integer $N$. In every round, player $A$ picks some positive integer $m \leqslant N$ and provides $1 / 2^{m}$ units of ink from the pot. The player $B$ picks an integer $k$ and blackens the interval from $k / 2^{m}$ to $(k+1) / 2^{m}$ (some parts of this interval may happen to be blackened before). The goal of player $A$ is to reach a situation where the pot is empty and the interval $[0,1]$ is not completely blackened.  Decide whether there exists a strategy for player A to win.  However, the Problem Selection Committee believes that this version may turn out to be harder than the original one.


Let $A B C$ be an acute-angled triangle with orthocenter $H$, and let $W$ be a point on side $B C$. Denote by $M$ and $N$ the feet of the altitudes from $B$ and $C$, respectively. Denote by $\omega_{1}$ the circumcircle of $B W N$, and let $X$ be the point on $\omega_{1}$ which is diametrically opposite to $W$. Analogously, denote by $\omega_{2}$ the circumcircle of $C W M$, and let $Y$ be the point on $\omega_{2}$ which is diametrically opposite to $W$. Prove that $X, Y$ and $H$ are collinear.  (Thaliand)

Solution: Let $L$ be the foot of the altitude from $A$, and let $Z$ be the second intersection point of circles $\omega_{1}$ and $\omega_{2}$, other than $W$. We show that $X, Y, Z$ and $H$ lie on the same line.  Due to $\angle B N C=\angle B M C=90^{\circ}$, the points $B, C, N$ and $M$ are concyclic; denote their circle by $\omega_{3}$. Observe that the line $W Z$ is the radical axis of $\omega_{1}$ and $\omega_{2}$; similarly, $B N$ is the radical axis of $\omega_{1}$ and $\omega_{3}$, and $C M$ is the radical axis of $\omega_{2}$ and $\omega_{3}$. Hence $A=B N \cap C M$ is the radical center of the three circles, and therefore $W Z$ passes through $A$.  Since $W X$ and $W Y$ are diameters in $\omega_{1}$ and $\omega_{2}$, respectively, we have $\angle W Z X=\angle W Z Y=90^{\circ}$, so the points $X$ and $Y$ lie on the line through $Z$, perpendicular to $W Z$.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-39.jpg?height=770&width=1114&top_left_y=1103&top_left_x=511)  The quadrilateral $B L H N$ is cyclic, because it has two opposite right angles. From the power of $A$ with respect to the circles $\omega_{1}$ and $B L H N$ we find $A L \cdot A H=A B \cdot A N=A W \cdot A Z$. If $H$ lies on the line $A W$ then this implies $H=Z$ immediately. Otherwise, by $\frac{A Z}{A H}=\frac{A L}{A W}$ the triangles $A H Z$ and $A W L$ are similar. Then $\angle H Z A=\angle W L A=90^{\circ}$, so the point $H$ also lies on the line $X Y Z$.  Comment. The original proposal also included a second statement:  Let $P$ be the point on $\omega_{1}$ such that $W P$ is parallel to $C N$, and let $Q$ be the point on $\omega_{2}$ such that $W Q$ is parallel to $B M$. Prove that $P, Q$ and $H$ are collinear if and only if $B W=C W$ or $A W \perp B C$.  The Problem Selection Committee considered the first part more suitable for the competition.


Let $\omega$ be the circumcircle of a triangle $A B C$. Denote by $M$ and $N$ the midpoints of the sides $A B$ and $A C$, respectively, and denote by $T$ the midpoint of the $\operatorname{arc} B C$ of $\omega$ not containing $A$. The circumcircles of the triangles $A M T$ and $A N T$ intersect the perpendicular bisectors of $A C$ and $A B$ at points $X$ and $Y$, respectively; assume that $X$ and $Y$ lie inside the triangle $A B C$. The lines $M N$ and $X Y$ intersect at $K$. Prove that $K A=K T$.  (Iran)

Solution: Let $O$ be the center of $\omega$, thus $O=M Y \cap N X$. Let $\ell$ be the perpendicular bisector of $A T$ (it also passes through $O$ ). Denote by $r$ the operation of reflection about $\ell$. Since $A T$ is the angle bisector of $\angle B A C$, the line $r(A B)$ is parallel to $A C$. Since $O M \perp A B$ and $O N \perp A C$, this means that the line $r(O M)$ is parallel to the line $O N$ and passes through $O$, so $r(O M)=O N$. Finally, the circumcircle $\gamma$ of the triangle $A M T$ is symmetric about $\ell$, so $r(\gamma)=\gamma$. Thus the point $M$ maps to the common point of $O N$ with the arc $A M T$ of $\gamma$ - that is, $r(M)=X$.  Similarly, $r(N)=Y$. Thus, we get $r(M N)=X Y$, and the common point $K$ of $M N$ nd $X Y$ lies on $\ell$. This means exactly that $K A=K T$.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-40.jpg?height=748&width=707&top_left_y=981&top_left_x=709)


Solution: Let $L$ be the second common point of the line $A C$ with the circumcircle $\gamma$ of the triangle $A M T$. From the cyclic quadrilaterals $A B T C$ and $A M T L$ we get $\angle B T C=180^{\circ}-$ $\angle B A C=\angle M T L$, which implies $\angle B T M=\angle C T L$. Since $A T$ is an angle bisector in these quadrilaterals, we have $B T=T C$ and $M T=T L$. Thus the triangles $B T M$ and $C T L$ are congruent, so $C L=B M=A M$.  Let $X^{\prime}$ be the common point of the line $N X$ with the external bisector of $\angle B A C$; notice that it lies outside the triangle $A B C$. Then we have $\angle T A X^{\prime}=90^{\circ}$ and $X^{\prime} A=X^{\prime} C$, so we get $\angle X^{\prime} A M=90^{\circ}+\angle B A C / 2=180^{\circ}-\angle X^{\prime} A C=180^{\circ}-\angle X^{\prime} C A=\angle X^{\prime} C L$. Thus the triangles $X^{\prime} A M$ and $X^{\prime} C L$ are congruent, and therefore  $$ \angle M X^{\prime} L=\angle A X^{\prime} C+\left(\angle C X^{\prime} L-\angle A X^{\prime} M\right)=\angle A X^{\prime} C=180^{\circ}-2 \angle X^{\prime} A C=\angle B A C=\angle M A L . $$  This means that $X^{\prime}$ lies on $\gamma$.  Thus we have $\angle T X N=\angle T X X^{\prime}=\angle T A X^{\prime}=90^{\circ}$, so $T X \| A C$. Then $\angle X T A=\angle T A C=$ $\angle T A M$, so the cyclic quadrilateral MATX is an isosceles trapezoid. Similarly, $N A T Y$ is an isosceles trapezoid, so again the lines $M N$ and $X Y$ are the reflections of each other about the perpendicular bisector of $A T$. Thus $K$ belongs to this perpendicular bisector.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-41.jpg?height=797&width=1001&top_left_y=214&top_left_x=562)  Comment. There are several different ways of showing that the points $X$ and $M$ are symmetrical with respect to $\ell$. For instance, one can show that the quadrilaterals $A M O N$ and $T X O Y$ are congruent. We chose Solution 1 as a simple way of doing it. On the other hand, Solution 2 shows some other interesting properties of the configuration.  Let us define $Y^{\prime}$, analogously to $X^{\prime}$, as the common point of $M Y$ and the external bisector of $\angle B A C$. One may easily see that in general the lines $M N$ and $X^{\prime} Y^{\prime}$ (which is the external bisector of $\angle B A C$ ) do not intersect on the perpendicular bisector of $A T$. Thus, any solution should involve some argument using the choice of the intersection points $X$ and $Y$.


In a triangle $A B C$, let $D$ and $E$ be the feet of the angle bisectors of angles $A$ and $B$, respectively. A rhombus is inscribed into the quadrilateral $A E D B$ (all vertices of the rhombus lie on different sides of $A E D B$ ). Let $\varphi$ be the non-obtuse angle of the rhombus. Prove that $\varphi \leqslant \max \{\angle B A C, \angle A B C\}$.  (Serbia)

Solution: Let $K, L, M$, and $N$ be the vertices of the rhombus lying on the sides $A E, E D, D B$, and $B A$, respectively. Denote by $d(X, Y Z)$ the distance from a point $X$ to a line $Y Z$. Since $D$ and $E$ are the feet of the bisectors, we have $d(D, A B)=d(D, A C), d(E, A B)=d(E, B C)$, and $d(D, B C)=d(E, A C)=0$, which implies  $$ d(D, A C)+d(D, B C)=d(D, A B) \quad \text { and } \quad d(E, A C)+d(E, B C)=d(E, A B) $$  Since $L$ lies on the segment $D E$ and the relation $d(X, A C)+d(X, B C)=d(X, A B)$ is linear in $X$ inside the triangle, these two relations imply  $$ d(L, A C)+d(L, B C)=d(L, A B) . $$  Denote the angles as in the figure below, and denote $a=K L$. Then we have $d(L, A C)=a \sin \mu$ and $d(L, B C)=a \sin \nu$. Since $K L M N$ is a parallelogram lying on one side of $A B$, we get  $$ d(L, A B)=d(L, A B)+d(N, A B)=d(K, A B)+d(M, A B)=a(\sin \delta+\sin \varepsilon) $$  Thus the condition (1) reads  $$ \sin \mu+\sin \nu=\sin \delta+\sin \varepsilon $$  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-42.jpg?height=593&width=653&top_left_y=1384&top_left_x=736)  If one of the angles $\alpha$ and $\beta$ is non-acute, then the desired inequality is trivial. So we assume that $\alpha, \beta<\pi / 2$. It suffices to show then that $\psi=\angle N K L \leqslant \max \{\alpha, \beta\}$.  Assume, to the contrary, that $\psi>\max \{\alpha, \beta\}$. Since $\mu+\psi=\angle C K N=\alpha+\delta$, by our assumption we obtain $\mu=(\alpha-\psi)+\delta<\delta$. Similarly, $\nu<\varepsilon$. Next, since $K N \| M L$, we have $\beta=\delta+\nu$, so $\delta<\beta<\pi / 2$. Similarly, $\varepsilon<\pi / 2$. Finally, by $\mu<\delta<\pi / 2$ and $\nu<\varepsilon<\pi / 2$, we obtain  $$ \sin \mu<\sin \delta \quad \text { and } \quad \sin \nu<\sin \varepsilon $$  This contradicts (2).  Comment. One can see that the equality is achieved if $\alpha=\beta$ for every rhombus inscribed into the quadrilateral $A E D B$.


Let $A B C$ be a triangle with $\angle B>\angle C$. Let $P$ and $Q$ be two different points on line $A C$ such that $\angle P B A=\angle Q B A=\angle A C B$ and $A$ is located between $P$ and $C$. Suppose that there exists an interior point $D$ of segment $B Q$ for which $P D=P B$. Let the ray $A D$ intersect the circle $A B C$ at $R \neq A$. Prove that $Q B=Q R$.  (Georgia)

Solution: Denote by $\omega$ the circumcircle of the triangle $A B C$, and let $\angle A C B=\gamma$. Note that the condition $\gamma<\angle C B A$ implies $\gamma<90^{\circ}$. Since $\angle P B A=\gamma$, the line $P B$ is tangent to $\omega$, so $P A \cdot P C=P B^{2}=P D^{2}$. By $\frac{P A}{P D}=\frac{P D}{P C}$ the triangles $P A D$ and $P D C$ are similar, and $\angle A D P=\angle D C P$.  Next, since $\angle A B Q=\angle A C B$, the triangles $A B C$ and $A Q B$ are also similar. Then $\angle A Q B=$ $\angle A B C=\angle A R C$, which means that the points $D, R, C$, and $Q$ are concyclic. Therefore $\angle D R Q=$ $\angle D C Q=\angle A D P$.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-43.jpg?height=594&width=959&top_left_y=923&top_left_x=583)  Figure 1  Now from $\angle A R B=\angle A C B=\gamma$ and $\angle P D B=\angle P B D=2 \gamma$ we get  $$ \angle Q B R=\angle A D B-\angle A R B=\angle A D P+\angle P D B-\angle A R B=\angle D R Q+\gamma=\angle Q R B $$  so the triangle $Q R B$ is isosceles, which yields $Q B=Q R$.


Solution: Again, denote by $\omega$ the circumcircle of the triangle $A B C$. Denote $\angle A C B=\gamma$. Since $\angle P B A=\gamma$, the line $P B$ is tangent to $\omega$.  Let $E$ be the second intersection point of $B Q$ with $\omega$. If $V^{\prime}$ is any point on the ray $C E$ beyond $E$, then $\angle B E V^{\prime}=180^{\circ}-\angle B E C=180^{\circ}-\angle B A C=\angle P A B$; together with $\angle A B Q=$ $\angle P B A$ this shows firstly, that the rays $B A$ and $C E$ intersect at some point $V$, and secondly that the triangle $V E B$ is similar to the triangle $P A B$. Thus we have $\angle B V E=\angle B P A$. Next, $\angle A E V=\angle B E V-\gamma=\angle P A B-\angle A B Q=\angle A Q B$; so the triangles $P B Q$ and $V A E$ are also similar.  Let $P H$ be an altitude in the isosceles triangle $P B D$; then $B H=H D$. Let $G$ be the intersection point of $P H$ and $A B$. By the symmetry with respect to $P H$, we have $\angle B D G=\angle D B G=\gamma=$ $\angle B E A$; thus $D G \| A E$ and hence $\frac{B G}{G A}=\frac{B D}{D E}$. Thus the points $G$ and $D$ correspond to each other in the similar triangles $P A B$ and $V E B$, so $\angle D V B=\angle G P B=90^{\circ}-\angle P B Q=90^{\circ}-\angle V A E$. Thus $V D \perp A E$.  Let $T$ be the common point of $V D$ and $A E$, and let $D S$ be an altitude in the triangle $B D R$. The points $S$ and $T$ are the feet of corresponding altitudes in the similar triangles $A D E$ and $B D R$, so $\frac{B S}{S R}=\frac{A T}{T E}$. On the other hand, the points $T$ and $H$ are feet of corresponding altitudes in the similar triangles $V A E$ and $P B Q$, so $\frac{A T}{T E}=\frac{B H}{H Q}$. Thus $\frac{B S}{S R}=\frac{A T}{T E}=\frac{B H}{H Q}$, and the triangles $B H S$ and $B Q R$ are similar.  Finally, $S H$ is a median in the right-angled triangle $S B D$; so $B H=H S$, and hence $B Q=Q R$.  ![](https://cdn.mathpix.com/cropped/2024_04_17_e0914cb4f8055c731538g-44.jpg?height=848&width=875&top_left_y=584&top_left_x=625)  Figure 2