Professor Oak is feeding his 100 Pokémon. Each Pokémon has a bowl whose capacity is a positive real number of kilograms. These capacities are known to Professor Oak. The total capacity of all the bowls is 100 kilograms. Professor Oak distributes 100 kilograms of food in such a way that each Pokémon receives a non-negative integer number of kilograms of food (which may be larger than the capacity of their bowl). The dissatisfaction level of a Pokémon who received $N$ kilograms of food and whose bowl has a capacity of $C$ kilograms is equal to $|N-C|$.  Find the smallest real number $D$ such that, regardless of the capacities of the bowls, Professor Oak can distribute the food in a way that the sum of the dissatisfaction levels over all the 100 Pokémon is at most $D$. (Ukraine)

Solution: First, consider the situation where 99 bowls have a capacity of 0.5 kilograms and the last bowl has a capacity of 50.5 kilograms. No matter how Professor Oak distributes the food, the dissatisfaction level of every Pokémon will be at least 0.5 . This amounts to a total dissatisfaction level of at least 50 , proving that $D \geqslant 50$.  Now we prove that no matter what the capacities of the bowls are, Professor Oak can always distribute food in a way that the total dissatisfaction level is at most 50 . We start by fixing some notation. We number the Pokémon from 1 to 100 . Let $C_{i}>0$ be the capacity of the bowl of the $i^{\text {th }}$ Pokémon. By assumption, we have $C_{1}+C_{2}+\cdots+C_{100}=100$. We write $F_{i}:=C_{i}-\left\lfloor C_{i}\right\rfloor$ for the fractional part of $C_{i}$. Without loss of generality, we may assume that $F_{1} \leqslant F_{2} \leqslant \cdots \leqslant F_{100}$.  Here is a strategy: Professor Oak starts by giving $\left\lfloor C_{i}\right\rfloor$ kilograms of food to the $i^{\text {th }}$ Pokémon. Let  $$ R:=100-\left\lfloor C_{1}\right\rfloor-\left\lfloor C_{2}\right\rfloor-\cdots-\left\lfloor C_{100}\right\rfloor=F_{1}+F_{2}+\cdots+F_{100} \geqslant 0 $$  be the amount of food left. He continues by giving an extra kilogram of food to the $R$ Pokémon numbered $100-R+1,100-R+2, \ldots, 100$, i.e. the Pokémon with the $R$ largest values of $F_{i}$. By doing so, Professor Oak distributed 100 kilograms of food. The total dissatisfaction level with this strategy is  $$ d:=F_{1}+\cdots+F_{100-R}+\left(1-F_{100-R+1}\right)+\cdots+\left(1-F_{100}\right) . $$  We can rewrite  $$ \begin{aligned} d & =2\left(F_{1}+\cdots+F_{100-R}\right)+R-\left(F_{1}+\cdots+F_{100}\right) \\ & =2\left(F_{1}+\cdots+F_{100-R}\right) . \end{aligned} $$  Now, observe that the arithmetic mean of $F_{1}, F_{2}, \ldots, F_{100-R}$ is not greater than the arithmetic mean of $F_{1}, F_{2}, \ldots, F_{100}$, because we assumed $F_{1} \leqslant F_{2} \leqslant \cdots \leqslant F_{100}$. Therefore  $$ d \leqslant 2(100-R) \cdot \frac{F_{1}+\cdots+F_{100}}{100}=2 \cdot \frac{R(100-R)}{100} $$  Finally, we use the AM-GM inequality to see that $R(100-R) \leqslant \frac{100^{2}}{2^{2}}$ which implies $d \leqslant 50$. We conclude that there is always a distribution for which the total dissatisfaction level is at most 50 , proving that $D \leqslant 50$.


Solution: We adopt the same notation as in   This solution uses the probabilistic method. We consider all distributions in which each Pokémon receives $\left\lfloor C_{i}\right\rfloor+\varepsilon_{i}$ kilograms of food, where $\varepsilon_{i} \in\{0,1\}$ and $\varepsilon_{1}+\varepsilon_{2}+\cdots+\varepsilon_{100}=R$. There are $\binom{100}{R}$ such distributions. Suppose each of them occurs in an equal probability. In other words,  $$ \varepsilon_{i}= \begin{cases}0 & \text { with probability } \frac{100-R}{100} \\ 1 & \text { with probability } \frac{R}{100}\end{cases} $$  The expected value of the dissatisfaction level of the $i^{\text {th }}$ Pokémon is  $$ \frac{100-R}{100}\left(C_{i}-\left\lfloor C_{i}\right\rfloor\right)+\frac{R}{100}\left(\left\lfloor C_{i}\right\rfloor+1-C_{i}\right)=\frac{100-R}{100} F_{i}+\frac{R}{100}\left(1-F_{i}\right) $$  Hence, the expected value of the total dissatisfaction level is  $$ \begin{aligned} \sum_{i=1}^{100}\left(\frac{100-R}{100} F_{i}+\frac{R}{100}\left(1-F_{i}\right)\right) & =\frac{100-R}{100} \sum_{i=1}^{100} F_{i}+\frac{R}{100} \sum_{i=1}^{100}\left(1-F_{i}\right) \\ & =\frac{100-R}{100} \cdot R+\frac{R}{100} \cdot(100-R) \\ & =2 \cdot \frac{R(100-R)}{100} . \end{aligned} $$  As in Solution 1, this is at most 50. We conclude that there is at least one distribution for which the total dissatisfaction level is at most 50 .


Let $\mathbb{R}$ be the set of real numbers. Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be a function such that  $$ f(x+y) f(x-y) \geqslant f(x)^{2}-f(y)^{2} $$  for every $x, y \in \mathbb{R}$. Assume that the inequality is strict for some $x_{0}, y_{0} \in \mathbb{R}$. Prove that $f(x) \geqslant 0$ for every $x \in \mathbb{R}$ or $f(x) \leqslant 0$ for every $x \in \mathbb{R}$. (Malaysia)

Solution: We introduce the new variables $s:=x+y$ and $t:=x-y$. Equivalently, $x=\frac{s+t}{2}$ and $y=\frac{s-t}{2}$. The inequality becomes  $$ f(s) f(t) \geqslant f\left(\frac{s+t}{2}\right)^{2}-f\left(\frac{s-t}{2}\right)^{2} $$  for every $s, t \in \mathbb{R}$. We replace $t$ by $-t$ to obtain  $$ f(s) f(-t) \geqslant f\left(\frac{s-t}{2}\right)^{2}-f\left(\frac{s+t}{2}\right)^{2} $$  Summing the previous two inequalities gives  $$ f(s)(f(t)+f(-t)) \geqslant 0 $$  for every $s, t \in \mathbb{R}$. This inequality is strict for $s=x_{0}+y_{0}$ and $t=x_{0}-y_{0}$ by assumption. In particular, there exists some $t_{0}=x_{0}-y_{0}$ for which $f\left(t_{0}\right)+f\left(-t_{0}\right) \neq 0$. Since $f(s)\left(f\left(t_{0}\right)+\right.$ $\left.f\left(-t_{0}\right)\right) \geqslant 0$ for every $s \in \mathbb{R}$, we conclude that $f(s)$ must have constant sign.


Solution: We do the same change of variables as in   $$ f(s) f(t) \geqslant f\left(\frac{s+t}{2}\right)^{2}-f\left(\frac{s-t}{2}\right)^{2} $$  In this solution, we replace $s$ by $-s($ instead of $t$ by $-t)$. This gives  $$ f(-s) f(t) \geqslant f\left(\frac{-s+t}{2}\right)^{2}-f\left(\frac{-s-t}{2}\right)^{2} $$  We now go back to the original inequality. Substituting $x=y$ gives $f(2 x) f(0) \geqslant 0$ for every $x \in \mathbb{R}$. If $f(0) \neq 0$, then we conclude that $f$ indeed has constant sign. From now on, we will assume that  $$ f(0)=0 . $$  Substituting $x=-y$ gives $f(-x)^{2} \geqslant f(x)^{2}$. By permuting $x$ and $-x$, we conclude that  $$ f(-x)^{2}=f(x)^{2} $$  for every $x \in \mathbb{R}$. Using the relation $f(x)^{2}=f(-x)^{2}$, we can rewrite (2) as  $$ f(-s) f(t) \geqslant f\left(\frac{s-t}{2}\right)^{2}-f\left(\frac{s+t}{2}\right)^{2} $$  Summing this inequality with (1), we obtain  $$ (f(s)+f(-s)) f(t) \geqslant 0 $$  for every $s, t \in \mathbb{R}$ and we can conclude as in Solution 1 .


Solution: We prove the contrapositive of the problem statement. Assume that there exist $a, b \in \mathbb{R}$ such that $f(a)<0$ and $f(b)>0$. We want to prove that the inequality is actually an equality, i.e. it is never strict. Lemma 1. The function $f$ is odd, i.e. $f(x)+f(-x)=0$ for every $x \in \mathbb{R}$. Proof. We plug in $x=\frac{a+u}{2}$ and $y=\frac{a-u}{2}$ in the original inequality, where $u$ is a free variable. We obtain  $$ f(a) f(u) \geqslant f\left(\frac{a+u}{2}\right)^{2}-f\left(\frac{a-u}{2}\right)^{2} . $$  Replacing $u$ with $-u$ and summing the two inequalities as in the previous solutions, we get  $$ f(a)(f(u)+f(-u)) \geqslant 0 $$  for every $u \in \mathbb{R}$. Since $f(a)<0$ by assumption, we conclude that $f(u)+f(-u) \leqslant 0$ for every $u \in \mathbb{R}$.  We can repeat the above argument with $b$ instead of $a$. Since $f(b)>0$ by assumption, we conclude that $f(u)+f(-u) \geqslant 0$ for every $u \in \mathbb{R}$. This implies that $f(u)+f(-u)=0$ for every $u \in \mathbb{R}$.  Now, using that $f$ is odd, we can write the following chain of inequalities  $$ \begin{aligned} f(x)^{2}-f(y)^{2} & \leqslant f(x+y) f(x-y) \\ & =-f(y+x) f(y-x) \\ & \leqslant-\left(f(y)^{2}-f(x)^{2}\right) \\ & =f(x)^{2}-f(y)^{2} . \end{aligned} $$  We conclude that every inequality above is actually an inequality, so  $$ f(x+y) f(x-y)=f(x)^{2}-f(y)^{2} $$  for every $x, y \in \mathbb{R}$.


Solution: As in   In this solution, we construct an argument by multiplying inequalities, rather than adding them as in Solutions 1-3. Lemma 2. $f(b) f(-b)<0$. Proof. Let $x_{1}:=\frac{a+b}{2}$ and $y_{1}:=\frac{a-b}{2}$ so that $a=x_{1}+y_{1}$ and $b=x_{1}-y_{1}$. Plugging in $x=x_{1}$ and $y=y_{1}$, we obtain  $$ 0>f(a) f(b)=f\left(x_{1}+y_{1}\right) f\left(x_{1}-y_{1}\right) \geqslant f\left(x_{1}\right)^{2}-f\left(y_{1}\right)^{2} $$  which implies $f\left(x_{1}\right)^{2}-f\left(y_{1}\right)^{2}<0$. Similarly, by plugging in $x=y_{1}$ and $y=x_{1}$, we get  $$ f(a) f(-b)=f\left(y_{1}+x_{1}\right) f\left(y_{1}-x_{1}\right) \geqslant f\left(y_{1}\right)^{2}-f\left(x_{1}\right)^{2} . $$  Using $f\left(x_{1}\right)^{2}-f\left(y_{1}\right)^{2}<0$, we conclude $f(a) f(-b)>0$. If we multiply the two inequalities $f(a) f(b)<0$ and $f(a) f(-b)>0$, we get $f(a)^{2} f(b) f(-b)<0$ and hence  $$ f(b) f(-b)<0 $$  Lemma 3. $f(x) f(-x) \leqslant 0$ for every $x \in \mathbb{R}$.  Proof. As in Solution 2, we prove that $f(x)^{2}=f(-x)^{2}$ for every $x \in \mathbb{R}$ and we rewrite the original inequality as  $$ f(s) f(t) \geqslant f\left(\frac{s+t}{2}\right)^{2}-f\left(\frac{s-t}{2}\right)^{2} $$  We replace $s$ by $-s$ and $t$ by $-t$, and use the relation $f(x)^{2}=f(-x)^{2}$, to get  $$ \begin{aligned} f(-s) f(-t) & \geqslant f\left(\frac{-s-t}{2}\right)^{2}-f\left(\frac{-s+t}{2}\right)^{2} \\ & =f\left(\frac{s+t}{2}\right)^{2}-f\left(\frac{s-t}{2}\right)^{2} \end{aligned} $$  Up to replacing $t$ by $-t$, we can assume that $f\left(\frac{s+t}{2}\right)^{2}-f\left(\frac{s-t}{2}\right)^{2} \geqslant 0$. Multiplying the two previous inequalities leads to  $$ f(s) f(-s) f(t) f(-t) \geqslant 0 $$  for every $s, t \in \mathbb{R}$. This shows that $f(s) f(-s)$ (as a function of $s$ ) has constant sign. Since $f(b) f(-b)<0$, we conclude that  $$ f(x) f(-x) \leqslant 0 $$  for every $x \in \mathbb{R}$. Lemma 3, combined with the relation $f(x)^{2}=f(-x)^{2}$, implies $f(x)+f(-x)=0$ for every $x \in \mathbb{R}$, i.e. $f$ is odd. We conclude with the same argument as in Solution 3.  Comment. The presence of squares on the right-hand side of the inequality is not crucial as Solution 1 illustrates very well. However, it allows non-constant functions such as $f(x)=|x|$ to satisfy the conditions of the problem statement.


Let $x_{1}, x_{2}, \ldots, x_{2023}$ be distinct real positive numbers such that  $$ a_{n}=\sqrt{\left(x_{1}+x_{2}+\cdots+x_{n}\right)\left(\frac{1}{x_{1}}+\frac{1}{x_{2}}+\cdots+\frac{1}{x_{n}}\right)} $$  is an integer for every $n=1,2, \ldots, 2023$. Prove that $a_{2023} \geqslant 3034$. (Netherlands)

Solution: We start with some basic observations. First note that the sequence $a_{1}, a_{2}, \ldots, a_{2023}$ is increasing and thus, since all elements are integers, $a_{n+1}-a_{n} \geqslant 1$. We also observe that $a_{1}=1$ and  $$ a_{2}=\sqrt{\left(x_{1}+x_{2}\right)\left(\frac{1}{x_{1}}+\frac{1}{x_{2}}\right)}>2 $$  by Cauchy-Schwarz inequality and using $x_{1} \neq x_{2}$. So, $a_{2} \geqslant 3$. Now, we proceed to the main part of the argument. We observe that 3034 is about three halves of 2023. Motivated by this observation, we will prove the following. Claim. If $a_{n+1}-a_{n}=1$, then $a_{n+2}-a_{n+1} \geqslant 2$. In other words, the sequence has to increase by at least 2 at least half of the times. Assuming the claim is true, since $a_{1}=1$, we would be done since  $$ \begin{aligned} a_{2023} & =\left(a_{2023}-a_{2022}\right)+\left(a_{2022}-a_{2021}\right)+\cdots+\left(a_{2}-a_{1}\right)+a_{1} \\ & \geqslant(2+1) \cdot 1011+1 \\ & =3034 . \end{aligned} $$  We now prove the claim. We start by observing that  $$ \begin{aligned} a_{n+1}^{2}= & \left(x_{1}+\cdots+x_{n+1}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n+1}}\right) \\ = & \left(x_{1}+\cdots+x_{n}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)+1 \\ & +\frac{1}{x_{n+1}}\left(x_{1}+\cdots+x_{n}\right)+x_{n+1}\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right) \\ \geqslant & a_{n}^{2}+1+2 \sqrt{\frac{1}{x_{n+1}}\left(x_{1}+\cdots+x_{n}\right) \cdot x_{n+1}\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)} \\ = & a_{n}^{2}+1+2 a_{n} \\ = & \left(a_{n}+1\right)^{2}, \end{aligned} $$  where we used AM-GM to obtain the inequality. In particular, if $a_{n+1}=a_{n}+1$, then  $$ \frac{1}{x_{n+1}}\left(x_{1}+\cdots+x_{n}\right)=x_{n+1}\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right) . $$  Now, assume for the sake of contradiction that both $a_{n+1}=a_{n}+1$ and $a_{n+2}=a_{n+1}+1$ hold. In this case, (1) gives  $$ \frac{1}{x_{n+2}}\left(x_{1}+\cdots+x_{n+1}\right)=x_{n+2}\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n+1}}\right) . $$  We can rewrite this relation as  $$ \frac{x_{n+1}}{x_{n+2}}\left(\frac{1}{x_{n+1}}\left(x_{1}+\cdots+x_{n}\right)+1\right)=\frac{x_{n+2}}{x_{n+1}}\left(x_{n+1}\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)+1\right) . $$  From (1) again, we conclude that $x_{n+1}=x_{n+2}$ which is a contradiction.


Solution: The trick is to compare $a_{n+2}$ and $a_{n}$. Observe that  $$ \begin{aligned} a_{n+2}^{2}= & \left(x_{1}+\cdots+x_{n+2}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n+2}}\right) \\ = & \left(x_{1}+\cdots+x_{n}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)+\left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right) \\ & +\left(x_{1}+\cdots+x_{n}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)+\left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right) \\ \geqslant & a_{n}^{2}+\left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right) \\ & +2 \sqrt{\left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)\left(x_{1}+\cdots+x_{n}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)} \\ = & a_{n}^{2}+\left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)+2 a_{n} \sqrt{\left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)}, \end{aligned} $$  where we used AM-GM to obtain the inequality. Furthermore, we have  $$ \left(x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)>4 $$  because $x_{n+1} \neq x_{n+2}$ by assumption. Therefore, it follows that  $$ a_{n+2}^{2}>a_{n}^{2}+4+4 a_{n}=\left(a_{n}+2\right)^{2} . $$  Because $a_{n+2}$ and $a_{n}$ are both positive integers, we conclude that  $$ a_{n+2} \geqslant a_{n}+3 . $$  A simple induction gives $a_{2 k+1} \geqslant 3 k+a_{1}$ for every $k \geqslant 0$. Since $a_{1}=1$, it follows that $a_{2 k+1} \geqslant 3 k+1$. We get the desired conclusion for $k=1011$.  Comment 1. A similar argument as in Solution 2 shows that $a_{2} \geqslant 3$ and $a_{2 k} \geqslant 3 k$ for every $k \geqslant 1$. Actually, these lower bounds on $a_{n}$ are sharp (at least for $n \leqslant 2023$ ). In other words, there exists a sequence of distinct values $x_{1}, \ldots, x_{2023}>0$ for which  $$ a_{n}= \begin{cases}\frac{3 n-1}{2} & \text { if } n \text { is odd, } \\ \frac{3 n}{2} & \text { if } n \text { is even, }\end{cases} $$  for $n=1, \ldots, 2023$. The value of $x_{1}$ can be chosen arbitrarily. The next values can be obtained inductively by solving the quadratic equation  $$ a_{n+1}^{2}=a_{n}^{2}+1+\left(\sum_{i=1}^{n} x_{i}\right) \frac{1}{x_{n+1}}+\left(\sum_{i=1}^{n} \frac{1}{x_{i}}\right) x_{n+1} $$  for $x_{n+1}$. Computation gives, for $n \geqslant 1$,  $$ x_{n+1}= \begin{cases}\frac{3 n}{2\left(\sum_{i=1}^{n} \frac{1}{x_{i}}\right)} & \text { if } n \text { is even } \\ \frac{6 n+1 \pm \sqrt{n(3 n+2)}}{2\left(\sum_{i=1}^{n} \frac{1}{x_{i}}\right)} & \text { if } n \text { is odd. }\end{cases} $$  One can check (with the help of a computer), that the values $x_{1}, \ldots, x_{2023}$ obtained by choosing $x_{1}=1$ and " + " every time in the odd case are indeed distinct.  It is interesting to note that the discriminant always vanishes in the even case. This is a consequence of $a_{n+1}=a_{n}+1$ being achieved as an equality case of AM-GM. Another cute observation is that the ratio $x_{2} / x_{1}$ is equal to the fourth power of the golden ratio.  Comment 2. The estimations in Solutions 1 and 2 can be made more efficiently if one applies the following form of the Cauchy-Schwarz inequality instead:  $$ \sqrt{(a+b)(c+d)} \geqslant \sqrt{a c}+\sqrt{b d} $$  for arbitrary nonnegative numbers $a, b, c, d$. Equality occurs if and only if $a: c=b: d=(a+b):(c+d)$. For instance, by applying (2) to $a=x_{1}+\cdots+x_{n}, b=x_{n+1}, c=\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}$ and $d=\frac{1}{x_{n+1}}$ we get  $$ \begin{aligned} a_{n+1} & =\sqrt{\left(x_{1}+\cdots+x_{n}+x_{n+1}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}+\frac{1}{x_{n+1}}\right)} \\ & \geqslant \sqrt{\left(x_{1}+\cdots+x_{n}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)}+\sqrt{x_{n+1} \cdot \frac{1}{x_{n+1}}}=a_{n}+1 . \end{aligned} $$  A study of equality cases show that equality cannot occur twice in a row, as in Solution 1. Suppose that $a_{n+1}=a_{n}+1$ and $a_{n+2}=a_{n+1}+1$ for some index $n$. By the equality case in (2) we have  $$ \frac{\left(x_{1}+\cdots+x_{n}\right)+x_{n+1}}{\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)+\frac{1}{x_{n+1}}}=\frac{x_{n+1}}{1 / x_{n+1}}=x_{n+1}^{2} \quad \text { because } a_{n+1}=a_{n}+1, $$  and  $$ \frac{x_{1}+\cdots+x_{n}+x_{n+1}}{\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}+\frac{1}{x_{n+1}}}=\frac{x_{n+2}}{1 / x_{n+2}}=x_{n+2}^{2} \quad \text { because } a_{n+2}=a_{n+1}+1 $$  The left-hand sides are the same, so $x_{n+1}=x_{n+2}$, but this violates the condition that $x_{n+1}$ and $x_{n+2}$ are distinct.  The same trick applies to Solution 2. We can compare $a_{n}$ and $a_{n+2}$ directly as  $$ \begin{aligned} a_{n+2} & =\sqrt{\left(x_{1}+\cdots+x_{n}+x_{n+1}+x_{n+2}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}+\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)} \\ & \geqslant \sqrt{\left(x_{1}+\cdots+x_{n}\right)\left(\frac{1}{x_{1}}+\cdots+\frac{1}{x_{n}}\right)}+\sqrt{\left(x_{n+1}+x_{n+2}\right) \cdot\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)} \\ & =a_{n}+\sqrt{\left(x_{n+1}+x_{n+2}\right) \cdot\left(\frac{1}{x_{n+1}}+\frac{1}{x_{n+2}}\right)} \\ & \geqslant a_{n}+2 . \end{aligned} $$  In the last estimate, equality is not possible because $x_{n+1}$ and $x_{n+2}$ are distinct, so $a_{n+2}>a_{n}+2$ and therefore $a_{n+2} \geqslant a_{n}+3$.


Let $\mathbb{R}_{>0}$ be the set of positive real numbers. Determine all functions $f: \mathbb{R}_{>0} \rightarrow \mathbb{R}_{>0}$ such that  $$ x(f(x)+f(y)) \geqslant(f(f(x))+y) f(y) $$  for every $x, y \in \mathbb{R}_{>0}$. (Belgium)

Solution: Let $f: \mathbb{R}_{>0} \rightarrow \mathbb{R}_{>0}$ be a function that satisfies the inequality of the problem statement. We will write $f^{k}(x)=f(f(\cdots f(x) \cdots))$ for the composition of $f$ with itself $k$ times, with the convention that $f^{0}(x)=x$. Substituting $y=x$ gives  $$ x \geqslant f^{2}(x) . $$  Substituting $x=f(y)$ instead leads to $f(y)+f^{2}(y) \geqslant y+f^{3}(y)$, or equivalently  $$ f(y)-f^{3}(y) \geqslant y-f^{2}(y) $$  We can generalise this inequality. If we replace $y$ by $f^{n-1}(y)$ in the above inequality, we get  $$ f^{n}(y)-f^{n+2}(y) \geqslant f^{n-1}(y)-f^{n+1}(y) $$  for every $y \in \mathbb{R}_{>0}$ and for every integer $n \geqslant 1$. In particular, $f^{n}(y)-f^{n+2}(y) \geqslant y-f^{2}(y) \geqslant 0$ for every $n \geqslant 1$. Hereafter consider even integers $n=2 m$. Observe that  $$ y-f^{2 m}(y)=\sum_{i=0}^{m-1}\left(f^{2 i}(y)-f^{2 i+2}(y)\right) \geqslant m\left(y-f^{2}(y)\right) $$  Since $f$ takes positive values, it holds that $y-f^{2 m}(y)<y$ for every $m \geqslant 1$. So, we have proved that $y>m\left(y-f^{2}(y)\right)$ for every $y \in \mathbb{R}_{>0}$ and every $m \geqslant 1$. Since $y-f^{2}(y) \geqslant 0$, this holds if only if  $$ f^{2}(y)=y $$  for every $y \in \mathbb{R}_{>0}$. The original inequality becomes  $$ x f(x) \geqslant y f(y) $$  for every $x, y \in \mathbb{R}_{>0}$. Hence, $x f(x)$ is constant. We conclude that $f(x)=c / x$ for some $c>0$. We now check that all the functions of the form $f(x)=c / x$ are indeed solutions of the original problem. First, note that all these functions satisfy $f(f(x))=c /(c / x)=x$. So it's sufficient to check that $x f(x) \geqslant y f(y)$, which is true since $c \geqslant c$.


Solution: Let $f: \mathbb{R}_{>0} \rightarrow \mathbb{R}_{>0}$ be a function that satisfies the inequality of the problem statement. As in   $$ f^{n}(y) \geqslant f^{n+2}(y) $$  for every $y \in \mathbb{R}_{>0}$ and every $n \geqslant 0$. Since $f$ takes positive values, this implies that  $$ y f(y) \geqslant f(y) f^{2}(y) \geqslant f^{2}(y) f^{3}(y) \geqslant \cdots $$  In other words, $y f(y) \geqslant f^{n}(y) f^{n+1}(y)$ for every $y \in \mathbb{R}_{>0}$ and every $n \geqslant 1$.  We replace $x$ by $f^{n}(x)$ in the original inequality and get  $$ f^{n}(x)-f^{n+2}(x) \geqslant \frac{y f(y)-f^{n}(x) f^{n+1}(x)}{f(y)} . $$  Using that $x f(x) \geqslant f^{n}(x) f^{n+1}(x)$, we obtain  $$ f^{n}(x)-f^{n+2}(x) \geqslant \frac{y f(y)-x f(x)}{f(y)} $$  for every $n \geqslant 0$. The same trick as in Solution 1 gives  $$ x>x-f^{2 m}(x)=\sum_{i=0}^{m-1}\left(f^{2 i}(x)-f^{2 i+2}(x)\right) \geqslant m \cdot \frac{y f(y)-x f(x)}{f(y)} $$  for every $x, y \in \mathbb{R}_{>0}$ and every $m \geqslant 1$. Possibly permuting $x$ and $y$, we may assume that $y f(y)-x f(x) \geqslant 0$ then the above inequality implies $x f(x)=y f(y)$. We conclude as in Solution 1.


Let $a_{1}, a_{2}, \ldots, a_{2023}$ be positive integers such that  - $a_{1}, a_{2}, \ldots, a_{2023}$ is a permutation of $1,2, \ldots, 2023$, and - $\left|a_{1}-a_{2}\right|,\left|a_{2}-a_{3}\right|, \ldots,\left|a_{2022}-a_{2023}\right|$ is a permutation of $1,2, \ldots, 2022$.  Prove that $\max \left(a_{1}, a_{2023}\right) \geqslant 507$.

Solution: For the sake of clarity, we consider and prove the following generalisation of the original problem (which is the case $N=1012$ ):  Let $N$ be a positive integer and $a_{1}, a_{2}, \ldots, a_{2 N-1}$ be positive integers such that  - $a_{1}, a_{2}, \ldots, a_{2 N-1}$ is a permutation of $1,2, \ldots, 2 N-1$, and - $\left|a_{1}-a_{2}\right|,\left|a_{2}-a_{3}\right|, \ldots,\left|a_{2 N-2}-a_{2 N-1}\right|$ is a permutation of $1,2, \ldots, 2 N-2$.  Then $a_{1}+a_{2 N-1} \geqslant N+1$ and hence $\max \left(a_{1}, a_{2 N-1}\right) \geqslant\left\lceil\frac{N+1}{2}\right\rceil$. Now we proceed to the proof of the generalised statement. We introduce the notion of score of a number $a \in\{1,2, \ldots, 2 N-1\}$. The score of $a$ is defined to be  $$ s(a):=|a-N| . $$  Note that, by the triangle inequality,  $$ |a-b| \leqslant|a-N|+|N-b|=s(a)+s(b) . $$  Considering the sum $\left|a_{1}-a_{2}\right|+\left|a_{2}-a_{3}\right|+\cdots+\left|a_{2 N-2}-a_{2 N-1}\right|$, we find that  $$ \begin{aligned} (N-1)(2 N-1) & =\left|a_{1}-a_{2}\right|+\left|a_{2}-a_{3}\right|+\cdots+\left|a_{2 N-2}-a_{2 N-1}\right| \\ & \leqslant 2\left(s\left(a_{1}\right)+s\left(a_{2}\right)+\cdots+s\left(a_{2 N-1}\right)\right)-\left(s\left(a_{1}\right)+s\left(a_{2 N-1}\right)\right) \\ & =2 N(N-1)-\left(s\left(a_{1}\right)+s\left(a_{2 N-1}\right)\right) . \end{aligned} $$  For the last equality we used that the numbers $s\left(a_{1}\right), s\left(a_{2}\right), \ldots, s\left(a_{2 N-1}\right)$ are a permutation of $0,1,1,2,2, \ldots, N-1, N-1$.  Hence, $s\left(a_{1}\right)+s\left(a_{2 N-1}\right) \leqslant 2 N(N-1)-(N-1)(2 N-1)=N-1$. We conclude that  $$ \left(N-a_{1}\right)+\left(N-a_{2 N-1}\right) \leqslant s\left(a_{1}\right)+s\left(a_{2 N-1}\right) \leqslant N-1, $$  which implies $a_{1}+a_{2 N-1} \geqslant N+1$. Comment 1. In the case $N=1012$, such a sequence with $\max \left(a_{1}, a_{2023}\right)=507$ indeed exists: $507,1517,508,1516, \ldots, 1011,1013,1012,2023,1,2022,2, \ldots, 1518,506$.  For a general even number $N$, a sequence with $\max \left(a_{1}, a_{2 N-1}\right)=\left\lceil\frac{N+1}{2}\right\rceil$ can be obtained similarly. If $N \geqslant 3$ is odd, the inequality is not sharp, because $\max \left(a_{1}, a_{2 N-1}\right)=\frac{N+1}{2}$ and $a_{1}+a_{2 N-1} \geqslant N+1$ together imply $a_{1}=a_{2 N-1}=\frac{N+1}{2}$, a contradiction.  Comment 2. The formulation of the author's submission was slightly different: Author's formulation. Consider a sequence of positive integers $a_{1}, a_{2}, a_{3}, \ldots$ such that the following conditions hold for all positive integers $m$ and $n$ :  - $a_{n+2023}=a_{n}+2023$, - If $\left|a_{n+1}-a_{n}\right|=\left|a_{m+1}-a_{m}\right|$, then $2023 \mid(n-m)$, and - The sequence contains every positive integer.  Prove that $a_{1} \geqslant 507$. The two formulations are equivalent up to relatively trivial arguments. Suppose $\left(a_{n}\right)$ is a sequence satisfying the author's formulation. From the first and third conditions, we see that $a_{1}, \ldots, a_{2023}$ is a permutation of $1, \ldots, 2023$. Moreover, the sequence $\left|a_{i}-a_{i+1}\right|$ for $i=1,2, \ldots, 2022$ consists of positive integers $\leqslant 2022$ and has pairwise distinct elements by the second condition. Hence, it is a permutation of $1, \ldots, 2022$. It also holds that $a_{1}>a_{2023}$, since if $a_{1}<a_{2023}$ then $\left|a_{2024}-a_{2023}\right|=$ $\left|2023+a_{1}-a_{2023}\right| \leqslant 2022$, which should be equal to $\left|a_{i}-a_{i+1}\right|$ for some $1 \leqslant i \leqslant 2022$, contradicting the second condition. This reduces the problem to the Shortlist formulation.  Conversely, if the numbers $a_{1}, \ldots, a_{2023}$ satisfy the conditions of the Shortlist formulation, then, after possibly reversing the sequence to ensure $a_{1}>a_{2023}$, the sequence can be extended to an infinite sequence satisfying the conditions of the author's formulation.


Let $k \geqslant 2$ be an integer. Determine all sequences of positive integers $a_{1}, a_{2}, \ldots$ for which there exists a monic polynomial $P$ of degree $k$ with non-negative integer coefficients such that  $$ P\left(a_{n}\right)=a_{n+1} a_{n+2} \cdots a_{n+k} $$  for every integer $n \geqslant 1$. (Malaysia)

Solution: We assume that $\left(a_{n}\right)$ is not eventually constant. Step 1. The first goal is to show that the sequence must be increasing, i.e. $a_{n}<a_{n+1}$ for all $n \geqslant 1$.  First, by comparing the two equalities  $$ \begin{aligned} P\left(a_{n}\right) & =a_{n+1} a_{n+2} \cdots a_{n+k}, \\ P\left(a_{n+1}\right) & =a_{n+2} \cdots a_{n+k} a_{n+k+1}, \end{aligned} $$  we observe that  $$ \begin{aligned} & a_{n}<a_{n+1} \Longleftrightarrow P\left(a_{n}\right)<P\left(a_{n+1}\right) \\ & a_{n}>a_{n+1} \Longleftrightarrow \\ & a_{n}=a_{n+1} \Longleftrightarrow a_{n+1}<a_{n+k+1}, \\ & P\left(a_{n}\right)>P\left(a_{n+1}\right) \Longleftrightarrow a_{n+1}>a_{n+k+1}, \\ & \end{aligned}, P\left(a_{n+1}\right) \quad \Longleftrightarrow a_{n+1}=a_{n+k+1} . $$  Claim 1. $\quad a_{n} \leqslant a_{n+1}$ for all $n \geqslant 1$. Proof. Suppose, to the contrary, that $a_{n(0)-1}>a_{n(0)}$ for some $n(0) \geqslant 2$. We will give an infinite sequence of positive integers $n(0)<n(1)<\cdots$ satisfying  $$ a_{n(i)-1}>a_{n(i)} \text { and } a_{n(i)}>a_{n(i+1)} . $$  Then $a_{n(0)}, a_{n(1)}, a_{n(2)}, \ldots$ is an infinite decreasing sequence of positive integers, which is absurd. We construct such a sequence inductively. If we have chosen $n(i)$, then we let $n(i+1)$ be the smallest index larger than $n(i)$ such that $a_{n(i)}>a_{n(i+1)}$. Note that such an index always exists and satisfies $n(i)+1 \leqslant n(i+1) \leqslant n(i)+k$ because $a_{n(i)}>a_{n(i)+k}$ by (2). We need to check that $a_{n(i+1)-1}>a_{n(i+1)}$. This is immediate if $n(i+1)=n(i)+1$ by construction. If $n(i+1) \geqslant n(i)+2$, then $a_{n(i+1)-1} \geqslant a_{n(i)}$ by minimality of $n(i+1)$, and so $a_{n(i+1)-1} \geqslant a_{n(i)}>a_{n(i+1)}$.  We are now ready to prove that the sequence $a_{n}$ is increasing. Suppose $a_{n}=a_{n+1}$ for some $n \geqslant 1$. Then we also have $a_{n+1}=a_{n+k+1}$ by (3), and since the sequence is non-decreasing we have $a_{n}=a_{n+1}=a_{n+2}=\cdots=a_{n+k+1}$. We repeat the argument for $a_{n+k}=a_{n+k+1}$ and get that the sequence is eventually constant, which contradicts our assumption. Hence  $$ a_{n}<a_{n+1} \text { for all } n \geqslant 1 $$  Step 2. The next and final goal is to prove that the sequence $a_{n}$ is an arithmetic progression. Observe that we can make differences of terms appear as follows  $$ \begin{aligned} P\left(a_{n}\right) & =a_{n+1} a_{n+2} \cdots a_{n+k} \\ & =\left(a_{n}+\left(a_{n+1}-a_{n}\right)\right)\left(a_{n}+\left(a_{n+2}-a_{n}\right)\right) \cdots\left(a_{n}+\left(a_{n+k}-a_{n}\right)\right) . \end{aligned} $$  We will prove that, for $n$ large enough, the sum  $$ \left(a_{n+1}-a_{n}\right)+\left(a_{n+2}-a_{n}\right)+\cdots+\left(a_{n+k}-a_{n}\right) $$  is equal to the coefficient $b$ of the term $x^{k-1}$ in $P$. The argument is based on the following claim. Claim 2. There exists a bound $A$ with the following properties:  1. If $\left(c_{1}, \ldots, c_{k}\right)$ is a $k$-tuple of positive integers with $c_{1}+\cdots+c_{k}>b$, then for every $x \geqslant A$ we have $P(x)<\left(x+c_{1}\right)\left(x+c_{2}\right) \cdots\left(x+c_{k}\right)$. 2. If $\left(c_{1}, \ldots, c_{k}\right)$ is a $k$-tuple of positive integers with $c_{1}+\cdots+c_{k}<b$, then for every $x \geqslant A$ we have $P(x)>\left(x+c_{1}\right)\left(x+c_{2}\right) \cdots\left(x+c_{k}\right)$.  Proof. It suffices to show parts 1 and 2 separately, because then we can take the maximum of two bounds.  We first show part 1 . For each single $\left(c_{1}, \ldots, c_{k}\right)$ such a bound $A$ exists since  $$ P(x)-\left(x+c_{1}\right)\left(x+c_{2}\right) \cdots\left(x+c_{k}\right)=\left(b-\left(c_{1}+\cdots+c_{k}\right)\right) x^{k-1}+(\text { terms of degree } \leqslant k-2) $$  has negative leading coefficient and hence takes negative values for $x$ large enough. Suppose $A$ is a common bound for all tuples $c=\left(c_{1}, \ldots, c_{k}\right)$ satisfying $c_{1}+\cdots+c_{k}=b+1$ (note that there are only finitely many such tuples). Then, for any tuple $c^{\prime}=\left(c_{1}^{\prime}, \ldots, c_{k}^{\prime}\right)$ with $c_{1}^{\prime}+\cdots+c_{k}^{\prime}>b$, there exists a tuple $c=\left(c_{1}, \ldots, c_{k}\right)$ with $c_{1}+\cdots+c_{k}=b+1$ and $c_{i}^{\prime} \geqslant c_{i}$, and then the inequality for $c^{\prime}$ follows from the inequality for $c$.  We can show part 2 either in a similar way, or by using that there are only finitely many such tuples.  Take $A$ satisfying the assertion of Claim 2, and take $N$ such that $n \geqslant N$ implies $a_{n} \geqslant A$. Then for each $n \geqslant N$, we have  $$ \left(a_{n+1}-a_{n}\right)+\cdots+\left(a_{n+k}-a_{n}\right)=b . $$  By taking the difference of this equality and the equality for $n+1$, we obtain  $$ a_{n+k+1}-a_{n+1}=k\left(a_{n+1}-a_{n}\right) $$  for every $n \geqslant N$. We conclude using an extremal principle. Let $d=\min \left\{a_{n+1}-a_{n} \mid n \geqslant N\right\}$, and suppose it is attained at some index $n \geqslant N$. Since  $$ k d=k\left(a_{n+1}-a_{n}\right)=a_{n+k+1}-a_{n+1}=\sum_{i=1}^{k}\left(a_{n+i+1}-a_{n+i}\right) $$  and each summand is at least $d$, we conclude that $d$ is also attained at $n+1, \ldots, n+k$, and inductively at all $n^{\prime} \geqslant n$. We see that the equation $P(x)=(x+d)(x+2 d) \cdots(x+k d)$ is true for infinitely many values of $x$ (all $a_{n^{\prime}}$ for $n^{\prime} \geqslant n$ ), hence this is an equality of polynomials. Finally we use (backward) induction to show that $a_{n+1}-a_{n}=d$ for every $n \geqslant 1$.


Solution: We assume that $\left(a_{n}\right)$ is not eventually constant. In this solution, we first prove an alternative version of Claim 1. Claim 3. There exist infinitely many $n \geqslant 1$ with  $$ a_{n} \leqslant \min \left\{a_{n+1}, \ldots, a_{n+k}\right\} $$  Proof. Suppose not, then for all but finitely many $n \geqslant 1$, it holds that $a_{n}>\min \left\{a_{n+1}, \ldots, a_{n+k}\right\}$. Hence for all large enough $n$, there always exist some $1 \leqslant l \leqslant k$ such that $a_{n}>a_{n+l}$. This induces an infinite decreasing sequence $a_{n}>a_{n+l_{1}}>a_{n+l_{2}}>\cdots$ of positive integers, which is absurd.  We use Claim 3 to quickly settle the case $P(x)=x^{k}$. In that case, for every $n$ with $a_{n} \leqslant \min \left\{a_{n+1}, \ldots, a_{n+k}\right\}$, since $a_{n+1} \cdots a_{n+k}=a_{n}^{k}$, it implies $a_{n}=a_{n+1}=\cdots=a_{n+k}$. This shows that the sequence is eventually constant, which contradicts our assumption.  From now on, assume  $$ P(x)>x^{k} \text { for all } x>0 $$  Claim 4. For every $M>0$, there exists some $N>0$ such that $a_{n}>M$ for all $n>N$. Proof. Suppose there exists some $M>0$, such that $a_{n} \leqslant M$ for infinitely many $n$. For each $i$ with $a_{i} \leqslant M$, we consider the $k$-tuple $\left(a_{i+1}, \ldots, a_{i+k}\right)$. Then each of the terms in the $k$-tuple is bounded from above by $P\left(a_{i}\right)$, and hence by $P(M)$ too. Since the number of such $k$-tuples is bounded by $P(M)^{k}$, we deduce by the Pigeonhole Principle that there exist some indices $i<j$ such that $\left(a_{i+1}, \ldots, a_{i+k}\right)=\left(a_{j+1}, \ldots, a_{j+k}\right)$. Since $a_{n}$ is uniquely determined by the $k$ terms before it, we conclude that $a_{i+k+1}=a_{j+k+1}$ must hold, and similarly $a_{i+l}=a_{j+l}$ for all $l \geqslant 0$, so the sequence is eventually periodic, for some period $p=j-i$.  Take $K$ such that $a_{n}=a_{n+p}$ for every $n \geqslant K$. Then, by taking the products of the inequalities  $$ a_{n}^{k}<P\left(a_{n}\right)=a_{n+1} \cdots a_{n+k} $$  for $K \leqslant n \leqslant K+p-1$, we obtain  $$ \begin{aligned} \prod_{n=K}^{K+p-1} a_{n}^{k} & <\prod_{n=K}^{K+p-1} a_{n+1} \cdots a_{n+k} \\ & =a_{K+1} a_{K+2}^{2} \cdots a_{K+k-1}^{k-1}\left(\prod_{n=K+k}^{K+p} a_{n}\right)^{k} a_{K+p+1}^{k-1} \cdots a_{K+p+k-2}^{2} a_{K+p+k-1} \\ & =\left(\prod_{n=K}^{K+p-1} a_{n}\right)^{k} \quad(\text { by periodicity }), \end{aligned} $$  which is a contradiction. Write $P(x)=x^{k}+b x^{k-1}+Q(x)$, where $Q(x)$ is of degree at most $k-2$. Take $M$ such that $x>M$ implies $x^{k-1}>Q(x)$. Claim 5. There exist non-negative integers $b_{1}, \cdots, b_{k}$ such that $P(x)=\left(x+b_{1}\right) \cdots\left(x+b_{k}\right)$, and such that, for infinitely many $n \geqslant 1$, we have $a_{n+i}=a_{n}+b_{i}$ for every $1 \leqslant i \leqslant k$. Proof. By Claims 3 and 4, there are infinitely many $n$ such that  $$ a_{n}>M \text { and } a_{n} \leqslant \min \left\{a_{n+1}, \ldots, a_{n+k}\right\} . $$  Call such indices $n$ to be good. We claim that if $n$ is a good index then  $$ \max \left\{a_{n+1}, \ldots, a_{n+k}\right\} \leqslant a_{n}+b $$  Indeed, if $a_{n+i} \geqslant a_{n}+b+1$, then together with $a_{n} \leqslant \min \left\{a_{n+1}, \ldots, a_{n+k}\right\}$ and $a_{n}^{k-1}>Q\left(a_{n}\right)$, we have  $$ a_{n}^{k}+(b+1) a_{n}^{k-1}>a_{n}^{k}+b a_{n}^{k-1}+Q\left(a_{n}\right)=P\left(a_{n}\right) \geqslant\left(a_{n}+b+1\right) a_{n}^{k-1}, $$  a contradiction. Hence for each good index $n$, we may write $a_{n+i}=a_{n}+b_{i}$ for all $1 \leqslant i \leqslant k$ for some choices of $\left(b_{1}, \ldots, b_{k}\right)$ (which may depend on $n$ ) and $0 \leqslant b_{i} \leqslant b$. Again by Pigeonhole Principle, some $k$-tuple $\left(b_{1}, \ldots, b_{k}\right)$ must be chosen for infinitely such good indices $n$. This means that the equation $P\left(a_{n}\right)=\left(a_{n}+b_{1}\right) \cdots\left(a_{n}+b_{k}\right)$ is satisfied by infinitely many good indices $n$. By Claim 4, $a_{n}$ is unbounded among these $a_{n}$ 's, hence $P(x)=\left(x+b_{1}\right) \cdots\left(x+b_{k}\right)$ must hold identically. Claim 6. We have $b_{i}=i b_{1}$ for all $1 \leqslant i \leqslant k$. Proof. Call an index $n$ excellent if $a_{n+i}=a_{n}+b_{i}$ for every $1 \leqslant i \leqslant k$. From Claim 5 we know there are infinitely many excellent $n$.  We first show that for any pair $1 \leqslant i<j \leqslant k$ there is $1 \leqslant l \leqslant k$ such that $b_{j}=b_{i}+b_{l}$. Indeed, for such $i$ and $j$ and for excellent $n, a_{n}+b_{j}$ (which is equal to $a_{n+j}$ ) divides $P\left(a_{n+i}\right)=$ $\prod_{l=1}^{k}\left(a_{n}+b_{i}+b_{l}\right)$, and hence divides $\prod_{l=1}^{k}\left(b_{i}+b_{l}-b_{j}\right)$. Since $a_{n}+b_{j}$ is unbounded among excellent $n$, we have $\prod_{l=1}^{k}\left(b_{i}+b_{l}-b_{j}\right)=0$, hence there is $l$ such that $b_{j}=b_{i}+b_{l}$.  In particular, $b_{j}=b_{i}+b_{l} \geqslant b_{i}$, i.e. $\left(b_{1}, \ldots, b_{k}\right)$ is non-decreasing. Suppose $b_{1}=0$ and $n$ is an excellent number. In particular, it holds that $a_{n}=a_{n+1}$. Moreover, since  $$ a_{n+k+1} P\left(a_{n}\right)=a_{n+1} \cdots a_{n+k+1}=a_{n+1} P\left(a_{n+1}\right), $$  we have $a_{n}=a_{n+1}=a_{n+k+1}$, which divides $P\left(a_{n+i}\right)=\prod_{l=1}^{k}\left(a_{n}+b_{i}+b_{l}\right)$ for each $1 \leqslant i \leqslant k$. Hence $a_{n}$ divides $\prod_{l=1}^{k}\left(b_{i}+b_{l}\right)$. By the same reasoning, we have $b_{i}+b_{l}=0$ for some $l$, but since $b_{i}, b_{l} \geqslant 0$ we obtain $b_{i}=0$ for each $1 \leqslant i \leqslant k$.  Now suppose $b_{1} \geqslant 1$. Then, for each $1 \leqslant i<j \leqslant k$, we have $b_{j}-b_{i}=b_{l} \geqslant b_{1} \geqslant 1$, hence $\left(b_{1}, \ldots, b_{k}\right)$ is strictly increasing. Therefore, the $k-1$ elements $b_{2}<b_{3}<\cdots<b_{k}$ are exactly equal to $b_{1}+b_{1}<\cdots<b_{1}+b_{k-1}$, since they cannot be equal to $b_{1}+b_{k}$. This gives $b_{i}=i b_{1}$ for all $1 \leqslant i \leqslant k$ as desired.  Claim 6 implies $P(x)=(x+d)(x+2 d) \cdots(x+k d)$ for some $d \geqslant 1$, and there are infinitely many indices $n$ with $a_{n+i}=a_{n}+i d$ for $1 \leqslant i \leqslant k$. By backwards induction, $P\left(a_{n-1}\right)=$ $a_{n} \cdots a_{n+k-1}$ implies $a_{n-1}=a_{n}-d$, and so on. Thus $a_{1}, \ldots, a_{n}$ forms an arithmetic progression with common difference $d$. Since $n$ can be arbitrarily large, the whole sequence is an arithmetic progression too, as desired.  Comment 1. A typical solution would first show some kind of increasing property (assuming $a_{n}$ is not constant), and then use that property to deduce informations on the numbers $a_{n+i}-a_{n}(1 \leqslant i \leqslant k)$ and/or on the polynomial $P$.  Solution 1 shows a strict one: $a_{n}<a_{n+1}$ (arguments after Claim 1), which makes the latter part easier. Solution 2 (Claims 3 and 4) shows only weaker increasing properties, which require more complicated/tricky arguments in the latter part but still can solve the problem.  Comment 2. It would be interesting to sort out the case when $P$ can take negative integer coefficients, or $\left(a_{n}\right)$ is just an integer sequence. Then a decreasing arithmetic progression is possible too, yet that is not the only possibility. There exist bounded examples such as $1,-1,1,-1, \ldots$ with $P(x)=-x^{2}$, or $0,1,-1,0,1,-1, \ldots$ with $P(x)=x^{2}-1$. If furthermore $P$ is allowed to be non-monic, then the situation is even more unclear. For instance, the sequence $1,2,4,8, \ldots$ works for the polynomial $P(x)=8 x^{2}$.


Let $N$ be a positive integer. Prove that there exist three permutations $a_{1}, a_{2}, \ldots, a_{N}$; $b_{1}, b_{2}, \ldots, b_{N}$; and $c_{1}, c_{2}, \ldots, c_{N}$ of $1,2, \ldots, N$ such that  $$ \left|\sqrt{a_{k}}+\sqrt{b_{k}}+\sqrt{c_{k}}-2 \sqrt{N}\right|<2023 $$  for every $k=1,2, \ldots, N$.

Solution: The idea is to approximate the numbers $\sqrt{1}, \sqrt{2}, \ldots, \sqrt{N}$ by the nearest integer with errors $<0.5$. This gives the following sequence  $$ 1,1,2,2,2,2,3,3,3,3,3,3,4, \ldots $$  More precisely, for each $k \geqslant 1$, we round $\sqrt{k^{2}-k+1}, \ldots, \sqrt{k^{2}+k}$ to $k$, so that there are $2 k$ copies of $k$.  Step 1. We first consider the easier case when $N$ has the form  $$ N=m(m+1) . $$  In this case, the numbers $\sqrt{1}, \sqrt{2}, \ldots, \sqrt{N}$ are approximated by the elements of the multiset $\left\{1_{\times 2}, 2_{\times 4}, 3_{\times 6}, \ldots, m_{\times 2 m}\right\}$. Let $T_{m}$ denote "half of" the multiset, i.e.  $$ T_{m}:=\left\{1_{\times 1}, 2_{\times 2}, 3_{\times 3}, \ldots, m_{\times m}\right\} . $$  We will prove by induction that there exists three permutations $\left(u_{k}\right),\left(v_{k}\right)$, and $\left(w_{k}\right)$ of the elements in the multiset $T_{m}$ such that $u_{k}+v_{k}+w_{k}=2 m+1$ is constant for $k=1,2, \ldots, \frac{m(m+1)}{2}$.  When $m=1$, take $1+1+1=3$. When $m=2$, take $(1,2,2)+(2,1,2)+(2,2,1)=(5,5,5)$. Suppose that we have constructed three permutations $\left(u_{k}\right),\left(v_{k}\right)$, and $\left(w_{k}\right)$ of $T_{m-1}$ satisfying $u_{k}+v_{k}+w_{k}=2 m-1$ for every $k=1,2, \ldots, \frac{m(m-1)}{2}$. For $T_{m}$, we note that  $$ T_{m}=T_{m-1} \sqcup\left\{m_{\times m}\right\}, $$  and also  $$ T_{m}=\left(T_{m-1}+1\right) \sqcup\{1,2, \ldots, m\} . $$  Here $T_{m-1}+1$ means to add 1 to all elements in $T_{m-1}$. We construct the permutations $\left(u_{k}^{\prime}\right)$, $\left(v_{k}^{\prime}\right)$, and $\left(w_{k}^{\prime}\right)$ of $T_{m}$ as follows:  - For $k=1,2, \ldots, \frac{m(m-1)}{2}$, we set $u_{k}^{\prime}=u_{k}, v_{k}^{\prime}=v_{k}+1, w_{k}^{\prime}=w_{k}+1$. - For $k=\frac{m(m-1)}{2}+r$ with $r=1,2, \ldots, m$, we set $u_{k}^{\prime}=m, v_{k}^{\prime}=r, w_{k}^{\prime}=m+1-r$.  It is clear from (1) that $\left(u_{k}^{\prime}\right),\left(v_{k}^{\prime}\right)$, and $\left(w_{k}^{\prime}\right)$ give three permutations of $T_{m}$, and that they satisfy $u_{k}^{\prime}+v_{k}^{\prime}+w_{k}^{\prime}=2 m+1$ for every $k=1,2, \ldots, \frac{m(m+1)}{2}$.  The inductive construction can be visualised by the $3 \times \frac{m(m+1)}{2}$ matrix  $$ \left[\begin{array}{cccccc} u_{1} & \ldots & u_{m(m-1) / 2} & m & \ldots & m \\ v_{1}+1 & \ldots & v_{m(m-1) / 2}+1 & 1 & \ldots & m \\ w_{1}+1 & \ldots & w_{m(m-1) / 2}+1 & m & \ldots & 1 \end{array}\right] $$  in which the three rows represent the permutations $\left(u_{k}^{\prime}\right),\left(v_{k}^{\prime}\right),\left(w_{k}^{\prime}\right)$, and the sum of the three entries of each column is $2 m+1$.  Thus, when $N=m^{2}+m$, we can construct permutations $\left(a_{k}\right),\left(b_{k}\right)$, and $\left(c_{k}\right)$ of $1,2, \ldots, N$ such that  $$ 2 m+1-1.5<\sqrt{a_{k}}+\sqrt{b_{k}}+\sqrt{c_{k}}<2 m+1+1.5 $$  This gives  $$ \left|\sqrt{a_{k}}+\sqrt{b_{k}}+\sqrt{c_{k}}-2 \sqrt{N}\right|<2.5<2023 $$  where we used that $-1<2 m-2 \sqrt{m^{2}+m}<0$ for positive $m$. Step 2. We now proceed to the general case. Let $m$ be such that  $$ m(m+1) \leqslant N<(m+1)(m+2) $$  Write $N=m(m+1)+t$ for some $t \in\{0,1, \ldots, 2 m+1\}$ and let  $$ L:=\left\lfloor\frac{4}{9} N\right\rfloor . $$  We will make use of the following inequalities below:  $$ N>m^{2}, \quad N<(m+2)^{2}, \quad t \leqslant 2 m+1, \quad L+1>4 N / 9, \quad L \leqslant 4 N / 9 . $$  As above, we construct three permutations $\left(a_{k}\right),\left(b_{k}\right)$, and $\left(c_{k}\right)$ of $1,2, \ldots, m(m+1)$ satisfying (2). Now we construct the three required permutations $\left(A_{k}\right),\left(B_{k}\right)$, and $\left(C_{k}\right)$ of $1,2, \ldots, N$ as follows:  For $k=1,2, \ldots, m(m+1)$, if $a_{k} \leqslant L$, take $A_{k}=a_{k}$, and if $a_{k}>L$, take $A_{k}=a_{k}+t$. For $k=m(m+1)+r$ with $r=1,2, \ldots, t$, set $A_{k}=L+r$. Define the permutations $\left(B_{k}\right)$ and $\left(C_{k}\right)$ similarly. Now for $k=1,2, \ldots, m(m+1)$, we show $0 \leqslant \sqrt{A_{k}}-\sqrt{a_{k}} \leqslant 2$. The lower bound is obvious. If $m \leqslant 1$, then $N \leqslant 5$ and hence $\sqrt{A_{k}}-\sqrt{a_{k}} \leqslant \sqrt{5}-\sqrt{1} \leqslant 2$. If $m \geqslant 2$, then  $$ \sqrt{A_{k}}-\sqrt{a_{k}}=\frac{A_{k}-a_{k}}{\sqrt{A_{k}}+\sqrt{a_{k}}} \leqslant \frac{t}{2 \sqrt{L+1}} \leqslant \frac{2 m+1}{\frac{4}{3} m} \leqslant 2 . $$  We have similar inequalities for $\left(B_{k}\right)$ and $\left(C_{k}\right)$. Thus  $$ 2 \sqrt{N}-4.5<2 m+1-1.5 \leqslant \sqrt{A_{k}}+\sqrt{B_{k}}+\sqrt{C_{k}} \leqslant 2 m+1+1.5+6<2 \sqrt{N}+8.5 . $$  For $k=m^{2}+m+1, \ldots, m^{2}+m+t$, we have  $$ 2 \sqrt{N}<3 \sqrt{L+1} \leqslant \sqrt{A_{k}}+\sqrt{B_{k}}+\sqrt{C_{k}} \leqslant 3 \sqrt{L+t} \leqslant \sqrt{4 N+9 t}<2 \sqrt{N}+8.5 $$  To sum up, we have defined three permutations $\left(A_{k}\right),\left(B_{k}\right)$, and $\left(C_{k}\right)$ of $1,2, \ldots, N$, such that  $$ \left|\sqrt{A_{k}}+\sqrt{B_{k}}+\sqrt{C_{k}}-2 \sqrt{N}\right|<8.5<2023 $$  holds for every $k=1,2, \ldots, N$.


Solution: This is a variation of  Let $n$ be an integer satisfying $0 \leqslant n \leqslant m+1$ and define the multiset $T_{m, n}$ by  $$ T_{m, n}:=\left\{1_{\times 1}, 2_{\times 2}, 3_{\times 3}, \ldots, m_{\times m},(m+1)_{\times n}\right\} . $$  In other words, $T_{m, 0}=T_{m}, T_{m, n}=T_{m} \sqcup\left\{(m+1)_{\times n}\right\}$ and $T_{m, m+1}=T_{m+1}$, where $T_{m}$ is the set defined in Solution 1.  Claim. There exist three permutations $\left(u_{k}\right),\left(v_{k}\right),\left(w_{k}\right)$ of $T_{m, n}$ such that  $$ \begin{cases}u_{k}+v_{k}+w_{k}=2 m+1 & (n=0) \\ u_{k}+v_{k}+w_{k} \in\{2 m+1,2 m+2,2 m+3\} & (1 \leqslant n \leqslant m) \\ u_{k}+v_{k}+w_{k}=2 m+3 & (n=m+1)\end{cases} $$  Proof. We proceed by induction on $m$. If $n=0$ or $n=m+1$, the assertion can be proved as in Solution 1. If $1 \leqslant n \leqslant m$, we note that  $$ T_{m, n}=T_{m-1, n} \sqcup\left\{m_{\times(m-n)},(m+1)_{\times n}\right\}=\left(T_{m-1, n}+1\right) \sqcup\{1,2, \ldots, m\} . $$  From the hypothesis of induction, it follows that we have three permutations $\left(u_{k}\right),\left(v_{k}\right),\left(w_{k}\right)$ of $T_{m-1, n}$ satisfying $u_{k}+v_{k}+w_{k} \in\{2 m-1,2 m, 2 m+1\}$ for every $k$. We construct the permutations $\left(u_{k}^{\prime}\right),\left(v_{k}^{\prime}\right)$, and $\left(w_{k}^{\prime}\right)$ of $T_{m, n}$ as follows:  - For $k=1,2, \ldots, \frac{m(m-1)}{2}+n$, we set $u_{k}^{\prime}=u_{k}, v_{k}^{\prime}=v_{k}+1$, and $w_{k}^{\prime}=w_{k}+1$. - For $k=\frac{m(m-1)}{2}+n+r$ with $r=1,2, \ldots, m$, we set $u_{k}^{\prime}=m$ if $1 \leqslant r \leqslant m-n$ while $u_{k}^{\prime}=m+1$ if $m-n+1 \leqslant r \leqslant m, v_{k}^{\prime}=r$, and $w_{k}^{\prime}=m+1-r$.  It is clear from the construction that $\left(u_{k}^{\prime}\right),\left(v_{k}^{\prime}\right)$, and $\left(w_{k}^{\prime}\right)$ give three permutations of $T_{m, n}$, and they satisfy $u_{k}^{\prime}+v_{k}^{\prime}+w_{k}^{\prime} \in\{2 m+1,2 m+2,2 m+3\}$ for every $k=1,2, \ldots, \frac{m(m+1)}{2}+n$.  Again, we can visualise the construction using the matrix  $$ \left[\begin{array}{ccccccccc} u_{1} & \ldots & u_{m(m-1) / 2+n} & m & \ldots & m & m+1 & \ldots & m+1 \\ v_{1}+1 & \ldots & v_{m(m-1) / 2+n}+1 & 1 & \ldots & \ldots & \ldots & \ldots & m \\ w_{1}+1 & \ldots & w_{m(m-1) / 2+n}+1 & m & \ldots & \ldots & \ldots & \ldots & 1 \end{array}\right] $$  In general, we have $m(m+1) \leqslant N<(m+1)(m+2)$ for some $m \geqslant 0$. Set $N=m(m+1)+t$ for some $t \in\{0,1, \ldots, 2 m+1\}$. Then the approximation of $\{\sqrt{1}, \sqrt{2}, \ldots, \sqrt{N}\}$ by the nearest integer with errors $<0.5$ is a multiset  $$ \left\{1_{\times 2}, 2_{\times 4}, \ldots, m_{\times 2 m},(m+1)_{\times t}\right\}=T_{m, n_{1}} \sqcup T_{m, n_{2}} $$  with $n_{1}=\lfloor t / 2\rfloor$ and $n_{2}=\lceil t / 2\rceil$. Since $0 \leqslant n_{1} \leqslant n_{2} \leqslant m+1$, by using the Claim we can construct permutations $\left(a_{k}\right)$, $\left(b_{k}\right)$, and $\left(c_{k}\right)$ to satisfy the following inequality:  $$ 2 m+1-1.5<\sqrt{a_{k}}+\sqrt{b_{k}}+\sqrt{c_{k}}<2 m+3+1.5 $$  Since $m<\sqrt{N}<m+2$, it follows that  $$ 2 \sqrt{N}-4.5<2 m+1-1.5<\sqrt{a_{k}}+\sqrt{b_{k}}+\sqrt{c_{k}}<2 m+3+1.5<2 \sqrt{N}+4.5 $$  and so  $$ \left|\sqrt{A_{k}}+\sqrt{B_{k}}+\sqrt{C_{k}}-2 \sqrt{N}\right|<4.5<2023 $$  ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-32.jpg?height=470&width=595&top_left_y=242&top_left_x=733)


Solution: This solution is based on the geometrical insight of equilateral triangles. Step 1. We first consider the easier case of triangle numbers  $$ N=\frac{m(m+1)}{2} $$  As shown in the following picture, consider the triangular shaped lattice points inside an equilateral triangle $A B C$ with a total of $N$ points. The lattice is built in a way that the $\ell^{\text {th }}$ row has exactly $\ell$ points for each $\ell=1,2, \ldots, m$. Rows are numbered in three different ways, one for each vertex.  Each point $P_{k}$ in the triangular lattice is labelled with a triple of integers $\left(a_{k}, b_{k}, c_{k}\right)$ as follows. The first coordinate is called the $A$-coordinate, and so on for $B, C$. To define the $A$-coordinate, denoted $W_{a}(\bullet)$, first label the lattice points by $1,2,3, \ldots$ starting with the point closest to $A$ and then going down the rows with the rule that within a row, the labelling is from left to right (see right picture). The $B$-coordinate, denoted $W_{b}(\bullet)$, is defined by rotating the $A$-coordinate counterclockwise by $120^{\circ}$. The $C$-coordinate, denoted $W_{c}(\bullet)$, similarly, by rotating the $A$-coordinate counterclockwise by $240^{\circ}$.  Assume that a point $P$ lies in the $\ell_{a}{ }^{\text {th }}$ row from the vertex $A$, in the $\ell_{b}{ }^{\text {th }}$ row from the vertex $B$, and in the $\ell_{c}^{\text {th }}$ row from the vertex $C$. Note that $\ell_{a}$ is proportional to the height of $A$ in the triangle, minus the height of $P$. Since inside an equilateral triangle, the sum of the lengths of the heights from a point to the three sides is independent of the point, we must have  $$ \ell_{a}+\ell_{b}+\ell_{c}=2 m+1=\sqrt{8 N+1} $$  Since there are exactly $1+2+\cdots+\ell=\frac{\ell(\ell+1)}{2}$ points in the first $\ell$ rows, the $A$-labeling $W_{a}(P)$ of the point $P$ satisfies  $$ \frac{\ell_{a}\left(\ell_{a}-1\right)}{2}+1 \leqslant W_{a}(P) \leqslant \frac{\ell_{a}\left(\ell_{a}+1\right)}{2} . $$  In paticular,  $$ \left(\ell_{a}-\frac{1}{2}\right)^{2}<2 W_{a}(P)<\left(\ell_{a}+\frac{1}{2}\right)^{2} $$  Taking the cyclic sum gives  $$ \left|\sqrt{2 W_{a}(P)}+\sqrt{2 W_{b}(P)}+\sqrt{2 W_{c}(P)}-\left(\ell_{a}+\ell_{b}+\ell_{c}\right)\right|<\frac{3}{2} $$  and thus  $$ \left|\sqrt{W_{a}(P)}+\sqrt{W_{b}(P)}+\sqrt{W_{c}(P)}-2 \sqrt{N+\frac{1}{8}}\right|<\frac{3}{2} \cdot \frac{1}{\sqrt{2}}=\frac{3 \sqrt{2}}{4} . $$  Step 2. Now, for a general positive integer $N$, there exists a positive integer $m$ such that  $$ \frac{m(m-1)}{2}+1 \leqslant N \leqslant \frac{m(m+1)}{2} $$  Write $N=\frac{m(m+1)}{2}-t$ with $t \in\{0,1, \ldots, m-1\}$. We modify the above construction for $\frac{m(m+1)}{2}$ points into a construction for $N$ points as follows. We remove $t$ arbitrary points from the $m^{\text {th }}$ row (namely the bottom row) of the triangular lattice. The remaining triangular lattice has $\frac{m(m+1)}{2}-t=N$ points, and we assign their $A$-, $B$-, and $C$-coordinates as before (in the same order, yet skipping over the points that are removed so that the coordinates exactly form permutations of $1,2, \ldots, N)$.  For each point $P$ in the triangular lattice (that was not removed earlier), suppose that it is in the $\ell_{a}^{\text {th }}, \ell_{b}^{\text {th }}$, and $\ell_{c}^{\text {th }}$ row when viewed from $A, B$, and $C$, respectively. Now the $A$-coordinates $W_{a}(P)$ still satisfies  $$ \frac{\ell_{a}\left(\ell_{a}-1\right)}{2}+1 \leqslant W_{a}(P) \leqslant \frac{\ell_{a}\left(\ell_{a}+1\right)}{2} . $$  The $B$-coordinate $W_{b}(P)$ satisfies  $$ \frac{\left(\ell_{b}-1\right)\left(\ell_{b}-2\right)}{2}+1 \leqslant W_{b}(P) \leqslant \frac{\ell_{b}\left(\ell_{b}+1\right)}{2} $$  because, viewing from point $B$, we have removed either 0 or 1 point from each row, and the first $\ell_{b}-1$ rows have at least $0+1+\cdots+\left(\ell_{b}-2\right)=\frac{\left(\ell_{b}-1\right)\left(\ell_{b}-2\right)}{2}$ points left. For the same reason, the $C$-labeling $W_{c}(P)$ satisfies  $$ \frac{\left(\ell_{c}-1\right)\left(\ell_{c}-2\right)}{2}+1 \leqslant W_{c}(P) \leqslant \frac{\ell_{c}\left(\ell_{c}+1\right)}{2} . $$  From this, we deduce that  $$ \begin{aligned} & \ell_{a}-\frac{1}{2}<\sqrt{2 W_{a}(P)}<\ell_{a}+\frac{1}{2} \\ & \ell_{b}-\frac{3}{2}<\sqrt{2 W_{b}(P)}<\ell_{b}+\frac{1}{2} \\ & \ell_{c}-\frac{3}{2}<\sqrt{2 W_{c}(P)}<\ell_{c}+\frac{1}{2} . \end{aligned} $$  Combining all above with the inequalities $2 m-1<2 \sqrt{2 N}<2 m+1$ and $\ell_{a}+\ell_{b}+\ell_{c}=2 m+1$, we deduce that  $$ \begin{aligned} 2 \sqrt{2 N}-\frac{7}{2}<(2 m+1)-\frac{7}{2}<\sqrt{2 W_{a}(P)} & +\sqrt{2 W_{b}(P)}+\sqrt{2 W_{c}(P)} \\ & <(2 m+1)+\frac{3}{2}<2 \sqrt{2 N}+\frac{7}{2} \end{aligned} $$  Therefore, for each point $P$, we have  $$ \left|\sqrt{W_{a}(P)}+\sqrt{W_{b}(P)}+\sqrt{W_{c}(P)}-2 \sqrt{N}\right|<\frac{7}{2} \cdot \frac{1}{\sqrt{2}}<2.5<2013 $$  We may finally order of the $N$ points in an arbitrary way. Then the $A$-labelings $W_{a}(\bullet)$ give the permutation $a_{1}, \ldots, a_{N}$, the $B$-labelings $W_{b}(\bullet)$ give $b_{1}, \ldots, b_{N}$, and the $C$-labelings $W_{c}(\bullet)$ give $c_{1}, \ldots, c_{N}$.  For each $k=1,2, \ldots, N$, we have  $$ \left|\sqrt{a_{k}}+\sqrt{b_{k}}+\sqrt{c_{k}}-2 \sqrt{N}\right|<2.5<2023 $$  Comment. We can make the same argument as in Solution 3 without using geometry or diagram instead using barycentric coordinates in integers and lexicographic order.  For $N=\frac{m(m+1)}{2}$, consider a set  $$ X=\left\{(x, y, z) \in \mathbb{Z}^{3} \mid 0 \leqslant x, y, z \leqslant m-1, x+y+z=m-1\right\} . $$  and the lexicographic order of $X$, i.e.  $$ (x, y, z)>\left(x^{\prime}, y^{\prime}, z^{\prime}\right) \Longleftrightarrow\left\{\begin{array}{l} x>x^{\prime} \text { or } \\ x=x^{\prime} \text { and } y>y^{\prime} \text { or } \\ x=x^{\prime} \text { and } y=y^{\prime} \text { and } z>z^{\prime} . \end{array}\right. $$  Then for an element $Q_{k}=\left(x_{k}, y_{k}, z_{k}\right)$  - Define $W_{a}\left(Q_{k}\right)$ so that $\left(x_{k}, y_{k}, z_{k}\right)$ is the $W_{a}\left(Q_{k}\right)^{\text {th }}$ biggest element in $X$. - Define $W_{b}\left(Q_{k}\right)$ so that $\left(y_{k}, z_{k}, x_{k}\right)$ is the $W_{b}\left(Q_{k}\right)^{\text {th }}$ biggest element in $X^{\prime}=\{(y, z, x) \mid(x, y, z) \in X\}$. - Define $W_{c}\left(Q_{k}\right)$ so that $\left(z_{k}, x_{k}, y_{k}\right)$ is the $W_{c}\left(Q_{k}\right)^{\text {th }}$ biggest element in $X^{\prime \prime}=\{(z, x, y) \mid(x, y, z) \in X\}$.  The same argument as in Solution 2 then holds. Observe that for an element $Q_{k}=\left(x_{k}, y_{k}, z_{k}\right)$, it holds that $\ell_{a}=m-x_{k}, \ell_{b}=m-y_{k}$, and $\ell_{c}=m-z_{k}$.


Let $m$ and $n$ be positive integers greater than 1 . In each unit square of an $m \times n$ grid lies a coin with its tail-side up. A move consists of the following steps:  1. select a $2 \times 2$ square in the grid; 2. flip the coins in the top-left and bottom-right unit squares; 3. flip the coin in either the top-right or bottom-left unit square.  Determine all pairs $(m, n)$ for which it is possible that every coin shows head-side up after a finite number of moves. (Thailand)

Solution: Let us denote by $(i, j)$-square the unit square in the $i^{\text {th }}$ row and the $j^{\text {th }}$ column. We first prove that when $3 \mid m n$, it is possible to make all the coins show head-side up. For integers $1 \leqslant i \leqslant m-1$ and $1 \leqslant j \leqslant n-1$, denote by $A(i, j)$ the move that flips the coin in the ( $i, j$ )-square, the $(i+1, j+1)$-square and the $(i, j+1)$-square. Similarly, denote by $B(i, j)$ the move that flips the coin in the $(i, j)$-square, $(i+1, j+1)$-square, and the $(i+1, j)$-square. Without loss of generality, we may assume that $3 \mid m$.  Case 1: $n$ is even. We apply the moves  - $A(3 k-2,2 l-1)$ for all $1 \leqslant k \leqslant \frac{m}{3}$ and $1 \leqslant l \leqslant \frac{n}{2}$, - $B(3 k-1,2 l-1)$ for all $1 \leqslant k \leqslant \frac{m}{3}$ and $1 \leqslant l \leqslant \frac{n}{2}$.  This process will flip each coin exactly once, hence all the coins will face head-side up afterwards. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-35.jpg?height=332&width=438&top_left_y=1881&top_left_x=809)


Determine the maximal length $L$ of a sequence $a_{1}, \ldots, a_{L}$ of positive integers satisfying both the following properties:  - every term in the sequence is less than or equal to $2^{2023}$, and - there does not exist a consecutive subsequence $a_{i}, a_{i+1}, \ldots, a_{j}$ (where $1 \leqslant i \leqslant j \leqslant L$ ) with a choice of signs $s_{i}, s_{i+1}, \ldots, s_{j} \in\{1,-1\}$ for which  $$ s_{i} a_{i}+s_{i+1} a_{i+1}+\cdots+s_{j} a_{j}=0 $$  (Czech Republic)

Solution: We prove more generally that the answer is $2^{k+1}-1$ when $2^{2023}$ is replaced by $2^{k}$ for an arbitrary positive integer $k$. Write $n=2^{k}$.  We first show that there exists a sequence of length $L=2 n-1$ satisfying the properties. For a positive integer $x$, denote by $v_{2}(x)$ the maximal nonnegative integer $v$ such that $2^{v}$ divides $x$. Consider the sequence $a_{1}, \ldots, a_{2 n-1}$ defined as  $$ a_{i}=2^{k-v_{2}(i)} . $$  For example, when $k=2$ and $n=4$, the sequence is  $$ 4,2,4,1,4,2,4 $$  This indeed consists of positive integers less than or equal to $n=2^{k}$, because $0 \leqslant v_{2}(i) \leqslant k$ for $1 \leqslant i \leqslant 2^{k+1}-1$. Claim 1. This sequence $a_{1}, \ldots, a_{2 n-1}$ does not have a consecutive subsequence with a choice of signs such that the signed sum equals zero. Proof. Let $1 \leqslant i \leqslant j \leqslant 2 n-1$ be integers. The main observation is that amongst the integers  $$ i, i+1, \ldots, j-1, j $$  there exists a unique integer $x$ with the maximal value of $v_{2}(x)$. To see this, write $v=$ $\max \left(v_{2}(i), \ldots, v_{2}(j)\right)$. If there exist at least two multiples of $2^{v}$ amongst $i, i+1, \ldots, j$, then one of them must be a multiple of $2^{v+1}$, which is a contradiction.  Therefore there is exactly one $i \leqslant x \leqslant j$ with $v_{2}(x)=v$, which implies that all terms except for $a_{x}=2^{k-v}$ in the sequence  $$ a_{i}, a_{i+1}, \ldots, a_{j} $$  are a multiple of $2^{k-v+1}$. The same holds for the terms $s_{i} a_{i}, s_{i+1} a_{i+1}, \ldots, s_{j} a_{j}$, hence the sum cannot be equal to zero.  We now prove that there does not exist a sequence of length $L \geqslant 2 n$ satisfying the conditions of the problem. Let $a_{1}, \ldots, a_{L}$ be an arbitrary sequence consisting of positive integers less than or equal to $n$. Define a sequence $s_{1}, \ldots, s_{L}$ of signs recursively as follows:  - when $s_{1} a_{1}+\cdots+s_{i-1} a_{i-1} \leqslant 0$, set $s_{i}=+1$, - when $s_{1} a_{1}+\cdots+s_{i-1} a_{i-1} \geqslant 1$, set $s_{i}=-1$.  Write  $$ b_{i}=\sum_{j=1}^{i} s_{i} a_{i}=s_{1} a_{1}+\cdots+s_{i} a_{i} $$  and consider the sequence  $$ 0=b_{0}, b_{1}, b_{2}, \ldots, b_{L} $$  Claim 2. All terms $b_{i}$ of the sequence satisfy $-n+1 \leqslant b_{i} \leqslant n$. Proof. We prove this by induction on $i$. It is clear that $b_{0}=0$ satisfies $-n+1 \leqslant 0 \leqslant n$. We now assume $-n+1 \leqslant b_{i-1} \leqslant n$ and show that $-n+1 \leqslant b_{i} \leqslant n$. Case 1: $-n+1 \leqslant b_{i-1} \leqslant 0$. Then $b_{i}=b_{i-1}+a_{i}$ from the definition of $s_{i}$, and hence  $$ -n+1 \leqslant b_{i-1}<b_{i-1}+a_{i} \leqslant b_{i-1}+n \leqslant n . $$  Case 2: $1 \leqslant b_{i-1} \leqslant n$. Then $b_{i}=b_{i-1}-a_{i}$ from the definition of $s_{i}$, and hence  $$ -n+1 \leqslant b_{i-1}-n \leqslant b_{i-1}-a_{i}<b_{i-1} \leqslant n . $$  This finishes the proof. Because there are $2 n$ integers in the closed interval $[-n+1, n]$ and at least $2 n+1$ terms in the sequence $b_{0}, b_{1}, \ldots, b_{L}$ (as $L+1 \geqslant 2 n+1$ by assumption), the pigeonhole principle implies that two distinct terms $b_{i-1}, b_{j}$ (where $1 \leqslant i \leqslant j \leqslant L$ ) must be equal. Subtracting one from another, we obtain  $$ s_{i} a_{i}+\cdots+s_{j} a_{j}=b_{j}-b_{i-1}=0 $$  as desired. Comment. The same argument gives a bound $L \leqslant 2 n-1$ that works for all $n$, but this bound is not necessarily sharp when $n$ is not a power of 2 . For instance, when $n=3$, the longest sequence has length $L=3$.


Let $n$ be a positive integer. We arrange $1+2+\cdots+n$ circles in a triangle with $n$ rows, such that the $i^{\text {th }}$ row contains exactly $i$ circles. The following figure shows the case $n=6$. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-07.jpg?height=407&width=392&top_left_y=1604&top_left_x=838)  In this triangle, a ninja-path is a sequence of circles obtained by repeatedly going from a circle to one of the two circles directly below it. In terms of $n$, find the largest value of $k$ such that if one circle from every row is coloured red, we can always find a ninja-path in which at least $k$ of the circles are red. (Netherlands)

Solution: Write $N=\left\lfloor\log _{2} n\right\rfloor$ so that we have $2^{N} \leqslant n \leqslant 2^{N+1}-1$. We first provide a construction where every ninja-path passes through at most $N+1$ red circles. For the row $i=2^{a}+b$ for $0 \leqslant a \leqslant N$ and $0 \leqslant b<2^{a}$, we colour the $(2 b+1)^{\text {th }}$ circle. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-40.jpg?height=383&width=431&top_left_y=1413&top_left_x=818)  Then every ninja-path passes through at most one red circle in each of the rows $2^{a}, 2^{a}+$ $1, \ldots, 2^{a+1}-1$ for each $0 \leqslant a \leqslant N$. It follows that every ninja-path passes through at most $N+1$ red circles.  We now prove that for every colouring, there exists a ninja-path going through at least $N+1$ red circles. For each circle $C$, we assign the maximum number of red circles in a ninja-path that starts at the top of the triangle and ends at $C$. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-40.jpg?height=329&width=358&top_left_y=2160&top_left_x=849)


Solution: We give an alternative proof that there exists a ninja-path passing through at least $N+1$ red circles. Assign numbers to circles as in the previous solution, but we only focus on the numbers assigned to red circles.  For each positive integer $i$, denote by $e_{i}$ the number of red circles with number $i$. Claim 2. If the red circle on row $l$ has number $i$, then $e_{i} \leqslant l$. Proof. Note that if two circles $C$ and $C^{\prime}$ are both assigned the same number $i$, then there cannot be a ninja-path joining the two circles. We partition the triangle into a smaller triangle with the red circle in row $l$ at its top along with $l-1$ lines that together cover all other circles. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-41.jpg?height=415&width=472&top_left_y=2071&top_left_x=798)  In each set, there can be at most one red circle with number $i$, and therefore $e_{i} \leqslant l$. We observe that if there exists a red circle $C$ with number $i \geqslant 2$, then there also exists a red circle with number $i-1$ in some row that is above the row containing $C$. This is because the second last red circle in the ninja-path ending at $C$ has number $i-1$. Claim 3. We have $e_{i} \leqslant 2^{i-1}$ for every positive integer $i$.  Proof. We prove by induction on $i$. The base case $i=1$ is clear, since the only red circle with number 1 is the one at the top of the triangle. We now assume that the statement is true for $1 \leqslant i \leqslant j-1$ and prove the statement for $i=j$. If $e_{j}=0$, there is nothing to prove. Otherwise, let $l$ be minimal such that the red circle on row $l$ has number $j$. Then all the red circles on row $1, \ldots, l-1$ must have number less than $j$. This shows that  $$ l-1 \leqslant e_{1}+e_{2}+\cdots+e_{j-1} \leqslant 1+2+\cdots+2^{j-2}=2^{j-1}-1 . $$  This proves that $l \leqslant 2^{j-1}$, and by Claim 2, we also have $e_{j} \leqslant l$. Therefore $e_{j} \leqslant 2^{j-1}$. We now see that  $$ e_{1}+e_{2}+\cdots+e_{N} \leqslant 1+\cdots+2^{N-1}=2^{N}-1<n $$  Therefore there exists a red circle with number at least $N+1$, which means that there exists a ninja-path passing through at least $N+1$ red circles.


Solution: We provide yet another proof that there exists a ninja-path passing through at least $N+1$ red circles. In this solution, we assign to a circle $C$ the maximum number of red circles on a ninja-path starting at $C$ (including $C$ itself). ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-42.jpg?height=326&width=364&top_left_y=1145&top_left_x=846)  Denote by $f_{i}$ the number of red circles with number $i$. Note that if a red circle $C$ has number $i$, and there is a ninja-path from $C$ to another red circle $C^{\prime}$, then the number assigned to $C^{\prime}$ must be less than $i$. Claim 4. If the red circle on row $l$ has number less than or equal to $i$, then $f_{i} \leqslant l$. Proof. This proof is same as the proof of Claim 2. The additional input is that if the red circle on row $l$ has number strictly less than $i$, then the smaller triangle cannot have a red circle with number $i$.  Claim 5. We have  $$ f_{1}+f_{2}+\cdots+f_{i} \leqslant n-\left\lfloor\frac{n}{2^{i}}\right\rfloor $$  for all $0 \leqslant i \leqslant N$. Proof. We use induction on $i$. The base case $i=0$ is clear as the left hand side is the empty sum and the right hand side is zero. For the induction step, we assume that $i \geqslant 1$ and that the statement is true for $i-1$. Let $l$ be minimal such that the red circle on row $l$ has number less than or equal to $i$. Then all the red circles with number less than or equal to $i$ lie on rows $l, l+1, \ldots, n$, and therefore  $$ f_{1}+f_{2}+\cdots+f_{i} \leqslant n-l+1 $$  On the other hand, the induction hypothesis together with the fact that $f_{i} \leqslant l$ shows that  $$ f_{1}+\cdots+f_{i-1}+f_{i} \leqslant n-\left\lfloor\frac{n}{2^{i-1}}\right\rfloor+l . $$  Averaging the two inequalities gives  $$ f_{1}+\cdots+f_{i} \leqslant n-\frac{1}{2}\left\lfloor\frac{n}{2^{i-1}}\right\rfloor+\frac{1}{2} . $$  Since the left hand side is an integer, we conclude that  $$ f_{1}+\cdots+f_{i} \leqslant n-\left\lfloor\frac{1}{2}\left\lfloor\frac{n}{2^{i-1}}\right\rfloor\right\rfloor=n-\left\lfloor\frac{n}{2^{i}}\right\rfloor . $$  This completes the induction step. Taking $i=N$, we obtain  $$ f_{1}+f_{2}+\cdots+f_{N} \leqslant n-\left\lfloor\frac{n}{2^{N}}\right\rfloor<n $$  This implies that there exists a ninja-path passing through at least $N+1$ red circles. Comment. Using essentially the same argument, one may inductively prove  $$ e_{a}+e_{a+1}+\cdots+e_{a+i-1} \leqslant n-\left\lfloor\frac{n}{2^{i}}\right\rfloor . $$  instead. Taking $a=1$ and $i=N$ gives the desired statement.


Let $n \geqslant 2$ be a positive integer. Paul has a $1 \times n^{2}$ rectangular strip consisting of $n^{2}$ unit squares, where the $i^{\text {th }}$ square is labelled with $i$ for all $1 \leqslant i \leqslant n^{2}$. He wishes to cut the strip into several pieces, where each piece consists of a number of consecutive unit squares, and then translate (without rotating or flipping) the pieces to obtain an $n \times n$ square satisfying the following property: if the unit square in the $i^{\text {th }}$ row and $j^{\text {th }}$ column is labelled with $a_{i j}$, then $a_{i j}-(i+j-1)$ is divisible by $n$.  Determine the smallest number of pieces Paul needs to make in order to accomplish this.

Solution: For the entirety of the solution, we shall view the labels as taking values in $\mathbb{Z} / n \mathbb{Z}$, as only their values modulo $n$ play a role.  Here are two possible constructions consisting of $2 n-1$ pieces.  1. Cut into pieces of sizes $n, 1, n, 1, \ldots, n, 1,1$, and glue the pieces of size 1 to obtain the last row. 2. Cut into pieces of sizes $n, 1, n-1,2, n-2, \ldots, n-1,1$, and switch the pairs of consecutive strips that add up to size $n$.  We now prove that using $2 n-1$ pieces is optimal. It will be more helpful to think of the reverse process: start with $n$ pieces of size $1 \times n$, where the $k^{\text {th }}$ piece has squares labelled $k, k+1, \ldots, k+n-1$. The goal is to restore the original $1 \times n^{2}$ strip.  Note that each piece, after cutting at appropriate places, is of the form $a, a+1, \ldots, b-1$. Construct an (undirected but not necessarily simple) graph $\Gamma$ with vertices labelled by $1, \ldots, n$, where a piece of the form $a, a+1, \ldots, b-1$ corresponds to an edge from $a$ to $b$. We make the following observations.  - The cut pieces came from the $k^{\text {th }}$ initial piece $k, k+1, \ldots, k+n-1$ corresponds to a cycle $\gamma_{k}$ (possibly of length 1 ) containing the vertex $k$. - Since it is possible to rearrange the pieces into one single $1 \times n^{2}$ strip, the graph $\Gamma$ has an Eulerian cycle. - The number of edges of $\Gamma$ is equal to the total number of cut pieces.  The goal is to prove that $\Gamma$ has at least $2 n-1$ edges. Since $\Gamma$ has an Eulerian cycle, it is connected. For every $1 \leqslant k \leqslant n$, pick one edge from $\gamma_{k}$, delete it from $\Gamma$ to obtain a new graph $\Gamma^{\prime}$. Since no two cycles $\gamma_{i}$ and $\gamma_{j}$ share a common edge, removing one edge from each cycle does not affect the connectivity of the graph. This shows that the new graph $\Gamma^{\prime}$ must also be connected. Therefore $\Gamma^{\prime}$ has at least $n-1$ edges, which means that $\Gamma$ has at least $2 n-1$ edges.


Solution: We provide an alternative proof that at least $2 n-1$ pieces are needed. Instead of having a linear strip, we work with a number of circular strips, each having length a multiple of $n$ and labelled as  $$ 1,2, \ldots, n, 1,2, \ldots, n, \ldots, 1,2, \ldots, n $$  where there are $n^{2}$ cells in total across all circular strips. The goal is still to create the $n \times n$ square by cutting and translating. Here, when we say "translating" the strips, we imagine that each cell has a number written on it and the final $n \times n$ square is required to have every number written in the same upright, non-mirrored orientation.  Note that the number of cuts will be equal to the number of pieces, because performing $l \geqslant 1$ cuts on a single circular strip results in $l$ pieces.  Consider any "seam" in the interior of the final square, between two squares $S$ and $T$, so that $S$ and $T$ belongs to two separate pieces. We are interested in the positions of these two squares in the original circular strips, with the aim of removing the seam.  - If the two squares $S$ and $T$ come from the same circular strip and are adjacent, then the cut was unnecessary and we can simply remove the seam and reduce the number of required cuts by 1 . The circular strips are not affected. - If these two squares $S$ and $T$ were not adjacent, then they are next to two different cuts (either from the same circular strip or two different circular strips). Denote the two cuts by $(S \mid Y)$ and $(X \mid T)$. We perform these two cuts and then glue the pieces back according to $(S \mid T)$ and $(X \mid Y)$. Performing this move would either split one circular strip into two or merge two circular strips into one, changing the number of circular strips by at most one. Afterwards, we may eliminate cut $(S \mid T)$ since it is no longer needed, which also removes the corresponding seam from the final square.  By iterating this process, eventually we reach a state where there are some number of circular strips, but the final $n \times n$ square no longer has any interior seams.  Since no two rows of the square can be glued together while maintaining the consecutive numbering, the only possibility is to have exactly $n$ circular strips, each with length $n$. In this state at least $n$ cuts are required to reassemble the square. Recall that each seam removal operation changed the number of circular strips by at most one. So if we started with only one initial circular strip, then at least $n-1$ seams were removed. Hence in total, at least $n+(n-1)=2 n-1$ cuts are required to transform one initial circular strip into the final square. Hence at least $2 n-1$ pieces are required to achieve the desired outcome.


Solution: As with the previous solution, we again work with circular strips. In particular, we start out with $k$ circular strips, each having length a multiple of $n$ and labelled as  $$ 1,2, \ldots, n, 1,2, \ldots, n, \ldots, 1,2, \ldots, n $$  where there are $n^{2}$ cells in total across all $k$ circular strips. The goal is still to create the $n \times n$ square by cutting and translating the circular strips. Claim. Constructing the $n \times n$ square requires at least $2 n-k$ cuts (or alternatively, $2 n-k$ pieces). Proof. We prove by induction on $n$. The base case $n=1$ is clear, because we can only have $k=1$ and the only way of producing a $1 \times 1$ square from a $1 \times 1$ circular strip is by making a single cut. We now assume that $n \geqslant 2$ and the statement is true for $n-1$.  Each cut is a cut between a cell of label $i$ on the left and a cell of label $i+1$ on the right side, for a unique $1 \leqslant i \leqslant n$. Let $a_{i}$ be the number of such cuts, so that $a_{1}+a_{2}+\cdots+a_{n}$ is the total number of cuts. Since all the left and right edges of the $n \times n$ square at the end must be cut, we have $a_{i} \geqslant 1$ for all $1 \leqslant i \leqslant n$.  If $a_{i} \geqslant 2$ for all $i$, then  $$ a_{1}+a_{2}+\cdots+a_{n} \geqslant 2 n>2 n-k $$  and hence there is nothing to prove. We therefore assume that there exist some $1 \leqslant m \leqslant n$ for which $a_{m}=1$. This unique cut must form the two ends of the linear strip  $$ m+1, m+2, \ldots, m-1+n, m+n $$  from the final product. There are two cases. Case 1: The strip is a single connected piece.  In this case, the strip must have come from a single circular strip of length exactly $n$. We now remove this circular strip from of the cutting and pasting process. By definition of $m$, none of the edges between $m$ and $m+1$ are cut. Therefore we may pretend that all the adjacent pairs of cells labelled $m$ and $m+1$ are single cells. The induction hypothesis then implies that  $$ a_{1}+\cdots+a_{m-1}+a_{m+1}+\cdots+a_{n} \geqslant 2(n-1)-(k-1) . $$  Adding back in $a_{m}$, we obtain  $$ a_{1}+\cdots+a_{n} \geqslant 2(n-1)-(k-1)+1=2 n-k . $$  Case 2: The strip is not a single connected piece. Say the linear strip $m+1, \ldots, m+n$ is composed of $l \geqslant 2$ pieces $C_{1}, \ldots, C_{l}$. We claim that if we cut the initial circular strips along both the left and right end points of the pieces $C_{1}, \ldots, C_{l}$, and then remove them, the remaining part consists of at most $k+l-2$ connected pieces (where some of them may be circular and some of them may be linear). This is because $C_{l}, C_{1}$ form a consecutive block of cells on the circular strip, and removing $l-1$ consecutive blocks from $k$ circular strips results in at most $k+(l-1)-1$ connected pieces.  Once we have the connected pieces that form the complement of $C_{1}, \ldots, C_{l}$, we may glue them back at appropriate endpoints to form circular strips. Say we get $k^{\prime}$ circular strips after this procedure. As we are gluing back from at most $k+l-2$ connected pieces, we see that  $$ k^{\prime} \leqslant k+l-2 . $$  We again observe that to get from the new circular strips to the $n-1$ strips of size $1 \times n$, we never have to cut along the cell boundary between labels $m$ and $m+1$. Therefore the induction hypothesis applies, and we conclude that the total number of pieces is bounded below by  $$ l+\left(2(n-1)-k^{\prime}\right) \geqslant l+2(n-1)-(k+l-2)=2 n-k . $$  This finishes the induction step, and therefore the statement holds for all $n$. Taking $k=1$ in the claim, we see that to obtain a $n \times n$ square from a circular $1 \times n^{2}$ strip, we need at least $2 n-1$ connected pieces. This shows that constructing the $n \times n$ square out of a linear $1 \times n^{2}$ strip also requires at least $2 n-1$ pieces.


Elisa has 2023 treasure chests, all of which are unlocked and empty at first. Each day, Elisa adds a new gem to one of the unlocked chests of her choice, and afterwards, a fairy acts according to the following rules:  - if more than one chests are unlocked, it locks one of them, or - if there is only one unlocked chest, it unlocks all the chests.  Given that this process goes on forever, prove that there is a constant $C$ with the following property: Elisa can ensure that the difference between the numbers of gems in any two chests never exceeds $C$, regardless of how the fairy chooses the chests to lock. (Israel)

Solution: We will prove that such a constant $C$ exists when there are $n$ chests for $n$ an odd positive integer. In fact we can take $C=n-1$. Elisa's strategy is simple: place a gem in the chest with the fewest gems (in case there are more than one such chests, pick one arbitrarily).  For each integer $t \geqslant 0$, let $a_{1}^{t} \leqslant a_{2}^{t} \leqslant \cdots \leqslant a_{n}^{t}$ be the numbers of gems in the $n$ chests at the end of the $t^{\text {th }}$ day. In particular, $a_{1}^{0}=\cdots=a_{n}^{0}=0$ and  $$ a_{1}^{t}+a_{2}^{t}+\cdots+a_{n}^{t}=t $$  For each $t \geqslant 0$, there is a unique index $m=m(t)$ for which $a_{m}^{t+1}=a_{m}^{t}+1$. We know that $a_{j}^{t}>a_{m(t)}^{t}$ for all $j>m(t)$, since $a_{m(t)}^{t}<a_{m(t)}^{t+1} \leqslant a_{j}^{t+1}=a_{j}^{t}$. Elisa's strategy also guarantees that if an index $j$ is greater than the remainder of $t$ when divided by $n$ (i.e. the number of locked chests at the end of the $t^{\text {th }}$ day), then $a_{j}^{t} \geqslant a_{m(t)}^{t}$, because some chest with at most $a_{j}^{t}$ gems must still be unlocked at the end of the $t^{\text {th }}$ day.  Recall that a sequence $x_{1} \leqslant x_{2} \leqslant \cdots \leqslant x_{n}$ of real numbers is said to majorise another sequence $y_{1} \leqslant y_{2} \leqslant \cdots \leqslant y_{n}$ of real numbers when for all $1 \leqslant k \leqslant n$ we have  $$ x_{1}+x_{2}+\cdots+x_{k} \leqslant y_{1}+y_{2}+\cdots+y_{k} $$  and  $$ x_{1}+x_{2}+\cdots+x_{n}=y_{1}+y_{2}+\cdots+y_{n} . $$  Our strategy for proving $a_{n}^{t}-a_{1}^{t} \leqslant n-1$ is to inductively show that the sequence $\left(a_{i}^{t}\right)$ is majorised by some other sequence ( $b_{i}^{t}$ ).  We define this other sequence $\left(b_{i}^{t}\right)$ as follows. Let $b_{k}^{0}=k-\frac{n+1}{2}$ for $1 \leqslant k \leqslant n$. As $n$ is odd, this is a strictly increasing sequence of integers, and the sum of its terms is 0 . Now define $b_{i}^{t}=b_{i}^{0}+\left\lfloor\frac{t-i}{n}\right\rfloor+1$ for $t \geqslant 1$ and $1 \leqslant i \leqslant n$. Thus for $t \geqslant 0$,  $$ b_{i}^{t+1}=\left\{\begin{array}{lll} b_{i}^{t} & \text { if } t+1 \not \equiv i & (\bmod n), \\ b_{i}^{t}+1 & \text { if } t+1 \equiv i & (\bmod n) . \end{array}\right. $$  From these properties it is easy to see that  - $b_{1}^{t}+b_{2}^{t}+\cdots+b_{n}^{t}=t$ for all $t \geqslant 0$, and - $b_{i}^{t} \leqslant b_{i+1}^{t}$ for all $t \geqslant 0$ and $1 \leqslant i \leqslant n-1$, with the inequality being strict if $t \not \equiv i(\bmod n)$.  Claim 1. For each $t \geqslant 0$, the sequence of integers $b_{1}^{t}, b_{2}^{t}, \ldots, b_{n}^{t}$ majorises the sequence of integers $a_{1}^{t}, a_{2}^{t}, \ldots, a_{n}^{t}$.  Proof. We use induction on $t$. The base case $t=0$ is trivial. Assume $t \geqslant 0$ and that $\left(b_{i}^{t}\right)$ majorises $\left(a_{i}^{t}\right)$. We want to prove the same holds for $t+1$.  First note that the two sequences $\left(b_{i}^{t+1}\right)$ and $\left(a_{i}^{t+1}\right)$ both sum up to $t+1$. Next, we wish to show that for $1 \leqslant k<n$, we have  $$ b_{1}^{t+1}+b_{2}^{t+1}+\cdots+b_{k}^{t+1} \leqslant a_{1}^{t+1}+a_{2}^{t+1}+\cdots+a_{k}^{t+1} $$  When $t+1$ is replaced by $t$, the above inequality holds by the induction hypothesis. For the sake of contradiction, suppose $k$ is the smallest index such that the inequality for $t+1$ fails. Since the left hand side increases by at most 1 during the transition from $t$ to $t+1$, the inequality for $t+1$ can fail only if all of the following occur:  - $b_{1}^{t}+b_{2}^{t}+\cdots+b_{k}^{t}=a_{1}^{t}+a_{2}^{t}+\cdots+a_{k}^{t}$, - $t+1 \equiv j(\bmod n)$ for some $1 \leqslant j \leqslant k\left(\right.$ so that $\left.b_{j}^{t+1}=b_{j}^{t}+1\right)$, - $m(t)>k$ (so that $a_{i}^{t+1}=a_{i}^{t}$ for $1 \leqslant i \leqslant k$ ).  The first point and the minimality of $k$ tell us that $b_{1}^{t}, \ldots, b_{k}^{t}$ majorises $a_{1}^{t}, \ldots, a_{k}^{t}$ as well (again using the induction hypothesis), and in particular $b_{k}^{t} \geqslant a_{k}^{t}$.  The second point tells us that the remainder of $t$ when divided by $n$ is at most $k-1$, so $a_{k}^{t} \geqslant a_{m(t)}^{t}$ (by Elisa's strategy). But by the third point $(m(t) \geqslant k+1)$ and the nondecreasing property of $a_{i}^{t}$, we must have the equalities $a_{k}^{t}=a_{k+1}^{t}=a_{m(t)}^{t}$. On the other hand, $a_{k}^{t} \leqslant b_{k}^{t}<b_{k+1}^{t}$, with the second inequality being strict because $t \not \equiv k(\bmod n)$. We conclude that  $$ b_{1}^{t}+b_{2}^{t}+\cdots+b_{k+1}^{t}>a_{1}^{t}+a_{2}^{t}+\cdots+a_{k+1}^{t} $$  a contradiction to the induction hypothesis. This completes the proof as it implies  $$ a_{n}^{t}-a_{1}^{t} \leqslant b_{n}^{t}-b_{1}^{t} \leqslant b_{n}^{0}-b_{1}^{0}=n-1 . $$  Comment 1. The statement is true even when $n$ is even. In this case, we instead use the initial state  $$ b_{k}^{0}= \begin{cases}k-\frac{n}{2}-1 & k \leqslant \frac{n}{2} \\ k-\frac{n}{2} & k>\frac{n}{2}\end{cases} $$  The same argument shows that $C=n$ works. Comment 2. The constants $C=n-1$ for odd $n$ and $C=n$ for even $n$ are in fact optimal. To see this, we will assume that the fairy always locks a chest with the minimal number of gems. Then at every point, if a chest is locked, any other chest with fewer gems will also be locked. Thus $m(t)$ is always greater than the remainder of $t$ when divided by $n$. This implies that the quantities  $$ I_{k}=a_{1}^{t}+\cdots+a_{k}^{t}-b_{1}^{t}-\cdots-b_{k}^{t} $$  for each $0 \leqslant k \leqslant n$, do not increase regardless of how Elisa acts. If Elisa succeeds in keeping $a_{n}^{t}-a_{1}^{t}$ bounded, then these quantities must also be bounded; thus they are eventually constant, say for $t \geqslant t_{0}$. This implies that for all $t \geqslant t_{0}$, the number $m(t)$ is equal to 1 plus the remainder of $t$ when divided by $n$. Claim 2. For $T \geqslant t_{0}$ divisible by $n$, we have  $$ a_{1}^{T}<a_{2}^{T}<\cdots<a_{n}^{T} . $$  Proof. Suppose otherwise, and let $j$ be an index for which $a_{j}^{T}=a_{j+1}^{T}$. We have $m(T+k-1)=k$ for all $1 \leqslant k \leqslant n$. Then $a_{j}^{T+j}>a_{j+1}^{T+j}$, which gives a contradiction.  This implies $a_{n}^{T}-a_{1}^{T} \geqslant n-1$, which already proves optimality of $C=n-1$ for odd $n$. For even $n$, note that the sequence ( $a_{i}^{T}$ ) has sum divisible by $n$, so it cannot consist of $n$ consecutive integers. Thus $a_{n}^{T}-a_{1}^{T} \geqslant n$ for $n$ even.


Solution: We solve the problem when 2023 is replaced with an arbitrary integer $n$. We assume that Elisa uses the following strategy:  At the beginning of the $(n t+1)^{\text {th }}$ day, Elisa first labels her chests as $C_{1}^{t}, \ldots, C_{n}^{t}$ so that before she adds in the gem, the number of gems in $C_{i}^{t}$ is less than or equal $C_{j}^{t}$ for all $1 \leqslant i<j \leqslant n$. Then for days $n t+1, n t+2, \ldots, n t+n$, she adds a gem to chest $C_{i}^{t}$, where $i$ is chosen to be minimal such that $C_{i}^{t}$ is unlocked.  Denote by $c_{i}^{t}$ the number of gems in chest $C_{i}^{t}$ at the beginning of the $(n t+1)^{\text {th }}$ day, so that  $$ c_{1}^{t} \leqslant c_{2}^{t} \leqslant \cdots \leqslant c_{n}^{t} $$  by construction. Also, denote by $\delta_{i}^{t}$ the total number of gems added to chest $C_{i}^{t}$ during days $n t+1, \ldots, n t+n$. We make the following observations.  - We have $c_{1}^{0}=c_{2}^{0}=\cdots=c_{n}^{0}=0$. - We have $c_{1}^{t}+\cdots+c_{n}^{t}=n t$, since $n$ gems are added every $n$ days. - The sequence $\left(c_{i}^{t+1}\right)$ is a permutation of the sequence $\left(c_{i}^{t}+\delta_{i}^{t}\right)$ for all $t \geqslant 0$. - We have $\delta_{1}^{t}+\cdots+\delta_{n}^{t}=n$ for all $t \geqslant 0$. - Since Elisa adds a gem to an unlocked chest $C_{i}^{t}$ with $i$ minimal, we have  $$ \delta_{1}^{t}+\delta_{2}^{t}+\cdots+\delta_{k}^{t} \geqslant k $$  for every $1 \leqslant k \leqslant n$ and $t \geqslant 0$. We now define another sequence of sequences of integers as follows.  $$ d_{i}^{0}=3 n\left(i-\frac{n+1}{2}\right), \quad d_{i}^{t}=d_{i}^{0}+t . $$  We observe that  $$ d_{1}^{t}+\cdots+d_{n}^{t}=c_{1}^{t}+\cdots+c_{n}^{t}=n t $$  Claim 3. For each $t \geqslant 0$, the sequence $\left(d_{i}^{t}\right)$ majorises the sequence $\left(c_{i}^{t}\right)$. Proof. We induct on $t$. For $t=0$, this is clear as all the terms in the sequence $\left(c_{i}^{t}\right)$ are equal. For the induction step, we assume that $\left(d_{i}^{t}\right)$ majorises $\left(c_{i}^{t}\right)$. Given $1 \leqslant k \leqslant n-1$, we wish to show that  $$ d_{1}^{t+1}+\cdots+d_{k}^{t+1} \leqslant c_{1}^{t+1}+\cdots+c_{k}^{t+1} $$  Case 1: $c_{1}^{t+1}, \ldots, c_{k}^{t+1}$ is a permutation of $c_{1}^{t}+\delta_{1}^{t}, \ldots, c_{k}^{t}+\delta_{k}^{t}$. Since $d_{1}^{t}+\cdots+d_{k}^{t} \leqslant c_{1}^{t}+\cdots+c_{k}^{t}$ by the induction hypothesis, we have  $$ \sum_{i=1}^{k} d_{i}^{t+1}=k+\sum_{i=1}^{k} d_{i}^{t} \leqslant k+\sum_{i=1}^{k} c_{i}^{t} \leqslant \sum_{i=1}^{k}\left(c_{i}^{t}+\delta_{i}^{t}\right)=\sum_{i=1}^{k} c_{i}^{t+1} $$  Case 2: $c_{1}^{t+1}, \ldots, c_{k}^{t+1}$ is not a permutation of $c_{1}^{t}+\delta_{1}^{t}, \ldots, c_{k}^{t}+\delta_{k}^{t}$. In this case, we have $c_{i}^{t}+\delta_{i}^{t}>c_{j}^{t}+\delta_{j}^{t}$ for some $i \leqslant k<j$. It follows that  $$ c_{k}^{t}+n \geqslant c_{i}^{t}+n \geqslant c_{i}^{t}+\delta_{i}^{t}>c_{j}^{t}+\delta_{j}^{t} \geqslant c_{j}^{t} \geqslant c_{k+1}^{t} . $$  Using $d_{k}^{t}+3 n=d_{k+1}^{t}$ and the induction hypothesis, we obtain  $$ \begin{aligned} \sum_{i=1}^{k} c_{i}^{t+1} & \geqslant \sum_{i=1}^{k} c_{i}^{t}>c_{1}^{t}+\cdots+c_{k-1}^{t}+\frac{1}{2} c_{k}^{t}+\frac{1}{2} c_{k+1}^{t}-\frac{n}{2}=\frac{1}{2} \sum_{i=1}^{k-1} c_{i}^{t}+\frac{1}{2} \sum_{i=1}^{k+1} c_{i}^{t}-\frac{n}{2} \\ & \geqslant \frac{1}{2} \sum_{i=1}^{k-1} d_{i}^{t}+\frac{1}{2} \sum_{i=1}^{k+1} d_{i}^{t}-\frac{n}{2}=n+\sum_{i=1}^{k} d_{i}^{t} \geqslant k+\sum_{i=1}^{k} d_{i}^{t}=\sum_{i=1}^{k} d_{i}^{t+1} \end{aligned} $$  This finishes the induction step. It follows that  $$ c_{n}^{t}-c_{1}^{t} \leqslant d_{n}^{t}-d_{1}^{t}=3 n(n-1) $$  From day $n t+1$ to day $n(t+1)+1$, Elisa adds $n$ gems, and therefore the difference may increase by at most $n$. This shows that the difference of the number of gems in two chests never exceeds $C=3 n(n-1)+n$.


Let $N$ be a positive integer, and consider an $N \times N$ grid. A right-down path is a sequence of grid cells such that each cell is either one cell to the right of or one cell below the previous cell in the sequence. A right-up path is a sequence of grid cells such that each cell is either one cell to the right of or one cell above the previous cell in the sequence.  Prove that the cells of the $N \times N$ grid cannot be partitioned into less than $N$ right-down or right-up paths. For example, the following partition of the $5 \times 5$ grid uses 5 paths. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-08.jpg?height=423&width=424&top_left_y=1179&top_left_x=819) (Canada)

Solution: We define a good parallelogram to be a parallelogram composed of two isosceles right-angled triangles glued together as shown below. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-51.jpg?height=238&width=929&top_left_y=1280&top_left_x=563)  Given any partition into $k$ right-down or right-up paths, we can find a corresponding packing of good parallelograms that leaves an area of $k$ empty. Thus, it suffices to prove that we must leave an area of at least $N$ empty when we pack good parallelograms into an $N \times N$ grid. This is actually equivalent to the original problem since we can uniquely recover the partition into right-down or right-up paths from the corresponding packing of good parallelograms. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-51.jpg?height=609&width=1112&top_left_y=1834&top_left_x=475)  We draw one of the diagonals in each cell so that it does not intersect any of the good parallelograms. Now, view these segments as mirrors, and consider a laser entering each of the $4 N$ boundary edges (with starting direction being perpendicular to the edge), bouncing along these mirrors until it exits at some other edge. When a laser passes through a good parallelogram, its direction goes back to the original one after bouncing two times. Thus, if the final direction of a laser is perpendicular to its initial direction, it must pass through at least one empty triangle. Similarly, if the final direction of a laser is opposite to its initial direction, it must pass though at least two empty triangles. Using this, we will estimate the number of empty triangles in the $N \times N$ grid.  We associate the starting edge of a laser with the edge it exits at. Then, the boundary edges are divided into $2 N$ pairs. These pairs can be classified into three types: (1) a pair of a vertical and a horizontal boundary edge, (2) a pair of boundary edges from the same side, and (3) a pair of boundary edges from opposite sides.  Since the beams do not intersect, we cannot have one type (3) pair from vertical boundary edges and another type (3) pair from horizontal boundary edges. Without loss of generality, we may assume that we have $t$ pairs of type (3) and they are all from vertical boundary edges. Then, out of the remaining boundary edges, there are $2 N$ horizontal boundary edges and $2 N-2 t$ vertical boundary edges. It follows that there must be at least $t$ pairs of type (2) from horizontal boundary edges. We know that a laser corresponding to a pair of type (1) passes through at least one empty triangle, and a laser corresponding to a pair of type (2) passes through at least two empty triangles. Thus, as the beams do not intersect, we have at least $(2 N-2 t)+2 \cdot t=2 N$ empty triangles in the grid, leaving an area of at least $N$ empty as required.


Solution: We apply an induction on $N$. The base case $N=1$ is trivial. Suppose that the claim holds for $N-1$ and prove it for $N \geqslant 2$.  Let us denote the path containing the upper left corner by $P$. If $P$ is right-up, then every cell in $P$ is in the top row or in the leftmost column. By the induction hypothesis, there are at least $N-1$ paths passing through the lower right $(N-1) \times(N-1)$ subgrid. Since $P$ is not amongst them, we have at least $N$ paths.  Next, assume that $P$ is right-down. If $P$ contains the lower right corner, then we get an $(N-1) \times(N-1)$ grid by removing $P$ and glueing the remaining two parts together. The main idea is to extend $P$ so that it contains the lower right corner and the above procedure gives a valid partition of an $(N-1) \times(N-1)$ grid. ![](https://cdn.mathpix.com/cropped/2025_01_09_9538693ed865d47d2de5g-52.jpg?height=412&width=981&top_left_y=1801&top_left_x=543)  We inductively construct $Q$, which denotes an extension of $P$ as a right-down path. Initially, $Q=P$. Let $A$ be the last cell of $Q, B$ be the cell below $A$, and $C$ be the cell to the right of $A$ (if they exist). Suppose that $A$ is not the lower right corner, and that (*) both $B$ and $C$ do not belong to the same path as $A$. Then, we can extend $Q$ as follows (in case we have two or more options, we can choose any one of them to extend $Q$ ).  1. If $B$ belongs to a right-down path $R$, then we add the part of $R$, from $B$ to its end, to $Q$. 2. If $C$ belongs to a right-down path $R$, then we add the part of $R$, from $C$ to its end, to $Q$. 3. If $B$ belongs to a right-up path $R$ which ends at $B$, then we add the part of $R$ in the same column as $B$ to $Q$. 4. If $C$ belongs to a right-up path $R$ which starts at $C$, then we add the part of $R$ in the same row as $C$ to $Q$. 5. Otherwise, $B$ and $C$ must belong to the same right-up path $R$. In this case, we add $B$ and the cell to the right of $B$ to $Q$.  Note that if $B$ does not exist, then case (4) must hold. If $C$ does not exist, then case (3) must hold.  It is easily seen that such an extension also satisfies the hypothesis (*), so we can repeat this construction to get an extension of $P$ containing the lower right corner, denoted by $Q$. We show that this is a desired extension, i.e. the partition of an $(N-1) \times(N-1)$ grid obtained by removing $Q$ and glueing the remaining two parts together consists of right-down or right-up paths.  Take a path $R$ in the partition of the $N \times N$ grid intersecting $Q$. If the intersection of $Q$ and $R$ occurs in case (1) or case (2), then there exists a cell $D$ in $R$ such that the intersection of $Q$ and $R$ is the part of $R$ from $D$ to its end, so $R$ remains a right-down path after removal of $Q$. Similarly, if the intersection of $Q$ and $R$ occurs in case (3) or case (4), then $R$ remains a right-up path after removal of $Q$. If the intersection of $Q$ and $R$ occurs in case (5), then this intersection has exactly two adjacent cells. After the removal of these two cells (as we remove $Q), R$ is divided into two parts that are glued into a right-up path.  Thus, we may apply the induction hypothesis to the resulting partition of an $(N-1) \times(N-1)$ grid, to find that it must contain at least $N-1$ paths. Since $P$ is contained in $Q$ and is not amongst these paths, the original partition must contain at least $N$ paths.