The $13^{\text {th }}$ Romanian Master of Mathematics Competition
Day 2 - Solutions
Problem 4. Consider an integer $n \geq 2$ and write the numbers $1,2, \ldots, n$ down on a board. A move consists in erasing any two numbers $a$ and $b$, and, for each $c$ in ${a+b,|a-b|}$, writing $c$ down on the board, unless $c$ is already there; if $c$ is already on the board, do nothing. For all integers $n \geq 2$, determine whether it is possible to be left with exactly two numbers on the board after a finite number of moves.
China
Solution. The answer is in the affirmative for all $n \geq 2$. Induct on $n$. Leaving aside the trivial case $n=2$, deal first with particular cases $n=5$ and $n=6$.
If $n=5$, remove first the pair $(2,5)$, notice that $3=|2-5|$ is already on the board, so $7=2+5$ alone is written down. Removal of the pair $(3,4)$ then leaves exactly two numbers on the board, 1 and 7 , since $|3 \pm 4|$ are both already there.
If $n=6$, remove first the pair $(1,6)$, notice that $5=|1-6|$ is already on the board, so $7=1+6$ alone is written down. Next, remove the pair $(2,5)$ and notice that $|2 \pm 5|$ are both already on the board, so no new number is written down. Finally, removal of the pair $(3,4)$ provides a single number to be written down, $1=|3-4|$, since $7=3+4$ is already on the board. At this stage, the process comes to an end: 1 and 7 are the two numbers left.
In the remaining cases, the problem for $n$ is brought down to the corresponding problem for $\lceil n / 2\rceil<n$ by a finite number of moves. The conclusion then follows by induction.
Let $n=4 k$ or $4 k-1$, where $k$ is a positive integer. Remove the pairs $(1,4 k-1),(3,4 k-3), \ldots$, $(2 k-1,2 k+1)$ in turn. Each time, two odd numbers are removed, and the corresponding $c=|a \pm b|$ are even numbers in the range 2 through $4 k$, of which one is always $4 k$. These even numbers are already on the board at each stage, so no $c$ is to be written down, unless $n=4 k-1$ in which case $4 k$ is written down during the first move. The outcome of this $k$-move round is the string of even numbers 2 through $4 k$ written down on the board. At this stage, the problem is clearly brought down to the case where the numbers on the board are $1,2, \ldots, 2 k=\lceil n / 2\rceil$, as desired.
Finally, let $n=4 k+1$ or $4 k+2$, where $k \geq 2$. Remove first the pair $(4,2 k+1)$ and notice that no new number is to be written down on the board, since $4+(2 k+1)=2 k+5 \leq 4 k+1 \leq n$. Next, remove the pairs $(1,4 k+1),(3,4 k-1), \ldots,(2 k-1,2 k+3)$ in turn. As before, at each of these stages, two odd numbers are removed; the corresponding $c=|a \pm b|$ are even numbers, this time in the range 4 through $4 k+2$, of which one is always $4 k+2$; and no new numbers are to be written down on the board, except $4=|(2 k-1)-(2 k+3)|$ during the last move, and, possibly, $4 k+2=1+(4 k+1)$ during the first move if $n=4 k+1$. Notice that 2 has not yet been involved in the process, to conclude that the outcome of this $(k+1)$-move round is the string of even numbers 2 through $4 k+2$ written down on the board. At this stage, the problem is clearly brought down to the case where the numbers on the board are $1,2, \ldots, 2 k+1=\lceil n / 2\rceil$, as desired.
Solution 2. We will prove the following, more general statement: Claim. Write down a finite number (at least two) of pairwise distinct positive integers on a board. A move consists in erasing any two numbers $a$ and $b$, and, for each $c$ in ${a+b,|a-b|}$, writing $c$ down on the board, unless $c$ is already there; if $c$ is already on the board, do nothing. Then it is possible to be left with exactly two numbers on the board after a finite number of moves.
Notice that, if we divide all numbers on the board by some common factor, the resulting process goes on equally well. Such a reduction can therefore be performed after any move.
Notice that we cannot be left with less than two numbers. So it suffices to show that, given $k$ positive integers on the board, $k \geq 3$, we can always decrease their number by at least 1 . Arguing indirectly, choose a set of $k \geq 3$ positive integers $S=\left{a_{1}, \ldots, a_{k}\right}$ which cannot be reduced in size by a sequence of moves, having a minimal possible sum $\sigma$. So, in any sequence of moves applied to $S$, two numbers are erased and exactly two numbers appear on each move. Moreover, the sum of any resulting set of $k$ numbers is at least $\sigma$.
Notice that, given two numbers $a>b$ on the board, we can replace them by $a+b$ and $a-b$, and then, performing a move on the two new numbers, by $(a+b)+(a-b)=2 a$ and $(a+b)-(a-b)=2 b$. So we can double any two numbers on the board.
We now show that, if the board contains two even numbers $a$ and $b$, we can divide them both by 2 , while keeping the other numbers unchanged. If $k$ is even, split the other numbers into pairs to multiply each pair by 2 ; then clear out the common factor 2 . If $k$ is odd, split all numbers but $a$ into pairs to multiply each by 2 ; then do the same for all numbers but $b$; finally, clear out the common factor 4.
Back to the problem, if two of the numbers $a_{1}, \ldots, a_{k}$ are even, reduce them both by 2 to get a set with a smaller sum, which is impossible. Otherwise, two numbers, say, $a_{1}<a_{2}$, are odd, and we may replace them by the two even numbers $a_{1}+a_{2}$ and $a_{2}-a_{1}$, and then by $\frac{1}{2}\left(a_{1}+a_{2}\right)$ and $\frac{1}{2}\left(a_{2}-a_{1}\right)$, to get a set with a smaller sum, which is again impossible.
Problem 5. Let $n$ be a positive integer. The kingdom of Zoomtopia is a convex polygon with integer sides, perimeter $6 n$, and $60^{\circ}$ rotational symmetry (that is, there is a point $O$ such that a $60^{\circ}$ rotation about $O$ maps the polygon to itself). In light of the pandemic, the government of Zoomtopia would like to relocate its $3 n^{2}+3 n+1$ citizens at $3 n^{2}+3 n+1$ points in the kingdom so that every two citizens have a distance of at least 1 for proper social distancing. Prove that this is possible. (The kingdom is assumed to contain its boundary.)
USA, Ankan Bhattacharya Solution. Let $P$ denote the given polygon, i.e., the kingdom of Zoomtopia. Throughout the solution, we interpret polygons with integer sides and perimeter $6 k$ as $6 k$-gons with unit sides (some of their angles may equal $180^{\circ}$ ). The argument hinges on the claim below: Claim. Let $P$ be a convex polygon satisfying the problem conditions - i.e., it has integer sides, perimeter $6 n$, and $60^{\circ}$ rotational symmetry. Then $P$ can be tiled with unit equilateral triangles and unit lozenges with angles at least $60^{\circ}$, with tiles meeting completely along edges, so that the tile configuration has a total of exactly $3 n^{2}+3 n+1$ distinct vertices. Proof. Induct on $n$. The base case, $n=1$, is clear. Now take a polygon $P$ of perimeter $6 n \geq 12$. Place six equilateral triangles inwards on six edges corresponding to each other upon rotation at $60^{\circ}$. It is possible to stick a lozenge to each other edge, as shown in the Figure below.
We show that all angles of the lozenges are at least $60^{\circ}$. Let an edge $X Y$ of the polygon bearing some lozenge lie along a boundary segment between edges $A B$ and $C D$ bearing equilateral triangles $A B P$ and $C D Q$. Then the angle formed by $\overrightarrow{X Y}$ and $\overrightarrow{B P}$ is between those formed by $\overrightarrow{A B}, \overrightarrow{B P}$ and $\overrightarrow{C D}, \overrightarrow{C Q}$, i.e., between $60^{\circ}$ and $120^{\circ}$, as desired.
Removing all obtained tiles, we get a $60^{\circ}$-symmetric convex $6(n-1)$-gon with unit sides which can be tiled by the inductive hypothesis. Finally, the number of vertices in the tiling of $P$ is $6 n+3(n-1)^{2}+3(n-1)+1=3 n^{2}+3 n+1$, as desired.

Using the Claim above, we now show that the citizens may be placed at the $3 n^{2}+3 n+1$ tile vertices.
Consider any tile $T_{1}$; its vertices are at least 1 apart from each other. Moreover, let $B A C$ be a part of the boundary of some tile $T$, and let $X$ be any point of the boundary of $T$, lying outside the half-open intervals $[A, B)$ and $[A, C)$ (in this case, we say that $X$ is not adjacent to $A$ ). Then $A X \geq \sqrt{3} / 2$.
Now consider any two tile vertices $A$ and $B$. If they are vertices of the same tile we already know $A B \geq 1$; otherwise, the segment $A B$ crosses the boundaries of some tiles containing $A$ and $B$ at some points $X$ and $Y$ not adjacent to $A$ and $B$, respectively. Hence $A B \geq A X+Y B \geq \sqrt{3}>1$.
Problem 6. Initially, a non-constant polynomial $S(x)$ with real coefficients is written down on a board. Whenever the board contains a polynomial $P(x)$, not necessarily alone, one can write down on the board any polynomial of the form $P(C+x)$ or $C+P(x)$, where $C$ is a real constant. Moreover, if the board contains two (not necessarily distinct) polynomials $P(x)$ and $Q(x)$, one can write $P(Q(x))$ and $P(x)+Q(x)$ down on the board. No polynomial is ever erased from the board.
Given two sets of real numbers, $A=\left{a_{1}, a_{2}, \ldots, a_{n}\right}$ and $B=\left{b_{1}, b_{2}, \ldots, b_{n}\right}$, a polynomial $f(x)$ with real coefficients is $(A, B)$-nice if $f(A)=B$, where $f(A)=\left{f\left(a_{i}\right): i=1,2, \ldots, n\right}$.
Determine all polynomials $S(x)$ that can initially be written down on the board such that, for any two finite sets $A$ and $B$ of real numbers, with $|A|=|B|$, one can produce an $(A, B)$-nice polynomial in a finite number of steps.
Iran, Navid SafaEi Solution. The required polynomials are all polynomials of an even degree $d \geq 2$, and all polynomials of odd degree $d \geq 3$ with negative leading coefficient.
Part I. We begin by showing that any (non-constant) polynomial $S(x)$ not listed above is not $(A, B)$-nice for some pair $(A, B)$ with either $|A|=|B|=2$, or $|A|=|B|=3$.
If $S(x)$ is linear, then so are all the polynomials appearing on the board. Therefore, none of them will be $(A, B)$-nice, say, for $A={1,2,3}$ and $B={1,2,4}$, as desired.
Otherwise, $\operatorname{deg} S=d \geq 3$ is odd, and the leading coefficient is positive. In this case, we make use of the following technical fact, whose proof is presented at the end of the solution.
Claim. There exists a positive constant $T$ such that $S(x)$ satisfies the following condition:
Fix a constant $T$ provided by the Claim. Then, an immediate check shows that all newly appearing polynomials on the board also satisfy $(*)$ (with the same value of $T$ ). Therefore, none of them will be $(A, B)$-nice, say, for $A={0, T}$ and $B={0, T / 2}$, as desired.
Part II. We show that the polynomials listed in the Answer satisfy the requirements. We will show that for any $a_{1}<a_{2}<\cdots<a_{n}$ and any $b_{1} \leq b_{2} \leq \cdots \leq b_{n}$ there exists a polynomial $f(x)$ satisfying $f\left(a_{i}\right)=b_{\sigma(i)}$ for all $i=1,2, \ldots, n$, where $\sigma$ is some permutation.
The proof goes by induction on $n \geq 2$. It is based on the following two lemmas, first of which is merely the base case $n=2$; the proofs of the lemmas are also at the end of the solution.
Lemma 1. For any $a_{1}<a_{2}$ and any $b_{1}, b_{2}$ one can write down on the board a polynomial $F(x)$ satisfying $F\left(a_{i}\right)=b_{i}, i=1,2$.
Lemma 2. For any distinct numbers $a_{1}<a_{2}<\cdots<a_{n}$ one can produce a polynomial $F(x)$ on the board such that the list $F\left(a_{1}\right), F\left(a_{2}\right), \ldots, F\left(a_{n}\right)$ contains exactly $n-1$ distinct numbers, and $F\left(a_{1}\right)=F\left(a_{2}\right)$.
Now, in order to perform the inductive step, we may replace the polynomial $S(x)$ with its shifted copy $S(C+x)$ so that the values $S\left(a_{i}\right)$ are pairwise distinct. Applying Lemma 2 , we get a polynomial $f(x)$ such that only two among the numbers $c_{i}=f\left(a_{i}\right)$ coincide, namely $c_{1}$ and $c_{2}$. Now apply Lemma 1 to get a polynomial $g(x)$ such that $g\left(a_{1}\right)=b_{1}$ and $g\left(a_{2}\right)=b_{2}$. Apply the inductive hypothesis in order to obtain a polynomial $h(x)$ satisfying $h\left(c_{i}\right)=b_{i}-g\left(a_{i}\right)$ for all $i=2,3, \ldots, n$. Then the polynomial $h(f(x))+g(x)$ is a desired one; indeed, we have $h\left(f\left(a_{i}\right)\right)+g\left(a_{i}\right)=h\left(c_{i}\right)+g\left(a_{i}\right)=b_{i}$ for all $i=2,3, \ldots, n$, and finally $h\left(f\left(a_{1}\right)\right)+g\left(a_{1}\right)=$ $h\left(c_{1}\right)+g\left(a_{1}\right)=b_{2}-g\left(a_{2}\right)+g\left(a_{1}\right)=b_{1}$.
It remains to prove the Claim and the two Lemmas. Proof of the Claim. There exists some segment $\Delta=\left[\alpha^{\prime}, \beta^{\prime}\right]$ such that $S(x)$ is monotone increasing outside that segment. Now one can choose $\alpha \leq \alpha^{\prime}$ and $\beta \geq \beta^{\prime}$ such that $S(\alpha)<\min _{x \in \Delta} S(x)$ and $S(\beta)>\max _{x \in \Delta} S(x)$. Therefore, for any $x, y, z$ with $x \leq \alpha \leq y \leq \beta \leq z$ we get $S(x) \leq S(\alpha) \leq$ $S(y) \leq S(\beta) \leq S(z)$.
We may decrease $\alpha$ and increase $\beta$ (preserving the condition above) so that, in addition, $S^{\prime}(x)>3$ for all $x \notin[\alpha, \beta]$. Now we claim that the number $T=3(\beta-\alpha)$ fits the bill.
Indeed, take any $a$ and $b$ with $b-a \geq T$. Even if the segment $[a, b]$ crosses $[\alpha, \beta]$, there still is a segment $\left[a^{\prime}, b^{\prime}\right] \subseteq[a, b] \backslash(\alpha, \beta)$ of length $b^{\prime}-a^{\prime} \geq(b-a) / 3$. Then
for some $\xi \in\left(a^{\prime}, b^{\prime}\right)$. Proof of Lemma 1. If $S(x)$ has an even degree, then the polynomial $T(x)=S\left(x+a_{2}\right)-S\left(x+a_{1}\right)$ has an odd degree, hence there exists $x_{0}$ with $T\left(x_{0}\right)=S\left(x_{0}+a_{2}\right)-S\left(x_{0}+a_{1}\right)=b_{2}-b_{1}$. Setting $G(x)=S\left(x+x_{0}\right)$, we see that $G\left(a_{2}\right)-G\left(a_{1}\right)=b_{2}-b_{1}$, so a suitable shift $F(x)=G(x)+\left(b_{1}-G\left(a_{1}\right)\right)$ fits the bill.
Assume now that $S(x)$ has odd degree and a negative leading coefficient. Notice that the polynomial $S^{2}(x):=S(S(x))$ has an odd degree and a positive leading coefficient. So, the polynomial $S^{2}\left(x+a_{2}\right)-S^{2}\left(x+a_{1}\right)$ attains all sufficiently large positive values, while $S\left(x+a_{2}\right)-$ $S\left(x+a_{1}\right)$ attains all sufficiently large negative values. Therefore, the two-variable polynomial $S^{2}\left(x+a_{2}\right)-S^{2}\left(x+a_{1}\right)+S\left(y+a_{2}\right)-S\left(y+a_{1}\right)$ attains all real values; in particular, there exist $x_{0}$ and $y_{0}$ with $S^{2}\left(x_{0}+a_{2}\right)+S\left(y_{0}+a_{2}\right)-S^{2}\left(x_{0}+a_{1}\right)-S\left(y_{0}+a_{1}\right)=b_{2}-b_{1}$. Setting $G(x)=S^{2}\left(x+x_{0}\right)+S\left(x+y_{0}\right)$, we see that $G\left(a_{2}\right)-G\left(a_{1}\right)=b_{2}-b_{1}$, so a suitable shift of $G$ fits the bill.
Proof of Lemma 2. Let $\Delta$ denote the segment $\left[a_{1} ; a_{n}\right]$. We modify the proof of Lemma 1 in order to obtain a polynomial $F$ convex (or concave) on $\Delta$ such that $F\left(a_{1}\right)=F\left(a_{2}\right)$; then $F$ is a desired polynomial. Say that a polynomial $H(x)$ is good if $H$ is convex on $\Delta$.
If $\operatorname{deg} S$ is even, and its leading coefficient is positive, then $S(x+c)$ is good for all sufficiently large negative $c$, and $S\left(a_{2}+c\right)-S\left(a_{1}+c\right)$ attains all sufficiently large negative values for such $c$. Similarly, $S(x+c)$ is good for all sufficiently large positive $c$, and $S\left(a_{2}+c\right)-S\left(a_{1}+c\right)$ attains all sufficiently large positive values for such $c$. Therefore, there exist large $c_{1}<0<c_{2}$ such that $S\left(x+c_{1}\right)+S\left(x+c_{2}\right)$ is a desired polynomial. If the leading coefficient of $H$ is negative, we similarly find a desired polynomial which is concave on $\Delta$.
If $\operatorname{deg} S \geq 3$ is odd (and the leading coefficient is negative), then $S(x+c)$ is good for all sufficiently large negative $c$, and $S\left(a_{2}+c\right)-S\left(a_{1}+c\right)$ attains all sufficiently large negative values for such $c$. Similarly, $S^{2}(x+c)$ is good for all sufficiently large positive $c$, and $S^{2}\left(a_{2}+c\right)-S^{2}\left(a_{1}+c\right)$ attains all sufficiently large positive values for such $c$. Therefore, there exist large $c_{1}<0<c_{2}$ such that $S\left(x+c_{1}\right)+S^{2}\left(x+c_{2}\right)$ is a desired polynomial.
Comment. Both parts above allow some variations. In Part I, the same scheme of the proof works for many conditions similar to (*), e.g.,
Let us sketch an alternative approach for Part II. It suffices to construct, for each $i$, a polynomial $f_{i}(x)$ such that $f_{i}\left(a_{i}\right)=b_{i}$ and $f_{i}\left(a_{j}\right)=0, j \neq i$. The construction of such polynomials may be reduced to the construction of those for $n=3$ similarly to what happens in the proof of Lemma 2. However, this approach (as well as any in this part) needs some care in order to work properly.