Shortlisted Problems (with solutions)
Confidential until 1:30pm on 12 July 2022 (Norwegian time)
62 ${ }^{\text {nd }}$ International Mathematical Olympiad Saint-Petersburg — Russia, 16th-24th July 2021
The Shortlist has to be kept strictly confidential until the conclusion of the following International Mathematical Olympiad. IMO General Regulations §6.6
Contributing Countries
The Organising Committee and the Problem Selection Committee of IMO 2021 thank the following 51 countries for contributing 175 problem proposals:
Albania, Algeria, Armenia, Australia, Austria, Azerbaijan, Belgium, Bangladesh, Canada, China, Colombia, Croatia, Czech Republic, Denmark, Estonia, France, Germany, Greece, Hong Kong, Iceland, India, Iran, Ireland, Israel, Japan, Kazakhstan, Kosovo, Luxembourg, Malaysia, Mexico, Morocco, Myanmar, Netherlands, New Zealand, North Macedonia, Poland, Romania, Singapore, Slovakia, Slovenia, South Africa, South Korea, Spain, Switzerland, Taiwan, Thailand, U.S.A., Ukraine, United Kingdom, Uzbekistan, Vietnam
Problem Selection Committee
Géza Kós, Gerhard Woeginger, Alexey Ustinov, Dmitry Krachun, Ivan Mitrofanov, Sergey Berlov, Fedor Petrov, Ivan Frolov, Paul Vaderlind, Alexander Golovanov, Ilya I. Bogdanov (chair)
Problems
Algebra
A1. Let $n$ be an integer, and let $A$ be a subset of $\left{0,1,2,3, \ldots, 5^{n}\right}$ consisting of $4 n+2$ numbers. Prove that there exist $a, b, c \in A$ such that $a<b<c$ and $c+2 a>3 b$.
A2. For every integer $n \geqslant 1$ consider the $n \times n$ table with entry $\left\lfloor\frac{i j}{n+1}\right\rfloor$ at the intersection of row $i$ and column $j$, for every $i=1, \ldots, n$ and $j=1, \ldots, n$. Determine all integers $n \geqslant 1$ for which the sum of the $n^{2}$ entries in the table is equal to $\frac{1}{4} n^{2}(n-1)$.
A3. Given a positive integer $n$, find the smallest value of $\left\lfloor\frac{a_{1}}{1}\right\rfloor+\left\lfloor\frac{a_{2}}{2}\right\rfloor+\cdots+\left\lfloor\frac{a_{n}}{n}\right\rfloor$ over all permutations $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ of $(1,2, \ldots, n)$.
A4. Show that for all real numbers $x_{1}, \ldots, x_{n}$ the following inequality holds:
A5. Let $n \geqslant 2$ be an integer, and let $a_{1}, a_{2}, \ldots, a_{n}$ be positive real numbers such that $a_{1}+a_{2}+\cdots+a_{n}=1$. Prove that
A6. Let $A$ be a finite set of (not necessarily positive) integers, and let $m \geqslant 2$ be an integer. Assume that there exist non-empty subsets $B_{1}, B_{2}, B_{3}, \ldots, B_{m}$ of $A$ whose elements add up to the sums $m^{1}, m^{2}, m^{3}, \ldots, m^{m}$, respectively. Prove that $A$ contains at least $m / 2$ elements.
A7. Let $n \geqslant 1$ be an integer, and let $x_{0}, x_{1}, \ldots, x_{n+1}$ be $n+2$ non-negative real numbers that satisfy $x_{i} x_{i+1}-x_{i-1}^{2} \geqslant 1$ for all $i=1,2, \ldots, n$. Show that
A8. Determine all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfy
for all real numbers $a, b, c$.
Combinatorics
C1. Let $S$ be an infinite set of positive integers, such that there exist four pairwise distinct $a, b, c, d \in S$ with $\operatorname{gcd}(a, b) \neq \operatorname{gcd}(c, d)$. Prove that there exist three pairwise distinct $x, y, z \in S$ such that $\operatorname{gcd}(x, y)=\operatorname{gcd}(y, z) \neq \operatorname{gcd}(z, x)$.
C2. Let $n \geqslant 3$ be an integer. An integer $m \geqslant n+1$ is called $n$-colourful if, given infinitely many marbles in each of $n$ colours $C_{1}, C_{2}, \ldots, C_{n}$, it is possible to place $m$ of them around a circle so that in any group of $n+1$ consecutive marbles there is at least one marble of colour $C_{i}$ for each $i=1, \ldots, n$.
Prove that there are only finitely many positive integers which are not $n$-colourful. Find the largest among them.
C3. A thimblerigger has 2021 thimbles numbered from 1 through 2021. The thimbles are arranged in a circle in arbitrary order. The thimblerigger performs a sequence of 2021 moves; in the $k^{\text {th }}$ move, he swaps the positions of the two thimbles adjacent to thimble $k$.
Prove that there exists a value of $k$ such that, in the $k^{\text {th }}$ move, the thimblerigger swaps some thimbles $a$ and $b$ such that $a<k<b$.
C4. The kingdom of Anisotropy consists of $n$ cities. For every two cities there exists exactly one direct one-way road between them. We say that a path from $X$ to $Y$ is a sequence of roads such that one can move from $X$ to $Y$ along this sequence without returning to an already visited city. A collection of paths is called diverse if no road belongs to two or more paths in the collection.
Let $A$ and $B$ be two distinct cities in Anisotropy. Let $N_{A B}$ denote the maximal number of paths in a diverse collection of paths from $A$ to $B$. Similarly, let $N_{B A}$ denote the maximal number of paths in a diverse collection of paths from $B$ to $A$. Prove that the equality $N_{A B}=N_{B A}$ holds if and only if the number of roads going out from $A$ is the same as the number of roads going out from $B$.
C5. Let $n$ and $k$ be two integers with $n>k \geqslant 1$. There are $2 n+1$ students standing in a circle. Each student $S$ has $2 k$ neighbours - namely, the $k$ students closest to $S$ on the right, and the $k$ students closest to $S$ on the left.
Suppose that $n+1$ of the students are girls, and the other $n$ are boys. Prove that there is a girl with at least $k$ girls among her neighbours.
C6. A hunter and an invisible rabbit play a game on an infinite square grid. First the hunter fixes a colouring of the cells with finitely many colours. The rabbit then secretly chooses a cell to start in. Every minute, the rabbit reports the colour of its current cell to the hunter, and then secretly moves to an adjacent cell that it has not visited before (two cells are adjacent if they share a side). The hunter wins if after some finite time either
- the rabbit cannot move; or
- the hunter can determine the cell in which the rabbit started.
Decide whether there exists a winning strategy for the hunter.
C7. Consider a checkered $3 m \times 3 m$ square, where $m$ is an integer greater than 1 . A frog sits on the lower left corner cell $S$ and wants to get to the upper right corner cell $F$. The frog can hop from any cell to either the next cell to the right or the next cell upwards.
Some cells can be sticky, and the frog gets trapped once it hops on such a cell. A set $X$ of cells is called blocking if the frog cannot reach $F$ from $S$ when all the cells of $X$ are sticky. A blocking set is minimal if it does not contain a smaller blocking set. (a) Prove that there exists a minimal blocking set containing at least $3 m^{2}-3 m$ cells. (b) Prove that every minimal blocking set contains at most $3 m^{2}$ cells.
Note. An example of a minimal blocking set for $m=2$ is shown below. Cells of the set $X$ are marked by letters $x$.

C8. Determine the largest $N$ for which there exists a table $T$ of integers with $N$ rows and 100 columns that has the following properties: (i) Every row contains the numbers $1,2, \ldots, 100$ in some order. (ii) For any two distinct rows $r$ and $s$, there is a column $c$ such that $|T(r, c)-T(s, c)| \geqslant 2$.
Here $T(r, c)$ means the number at the intersection of the row $r$ and the column $c$.
Geometry
G1. Let $A B C D$ be a parallelogram such that $A C=B C$. A point $P$ is chosen on the extension of the segment $A B$ beyond $B$. The circumcircle of the triangle $A C D$ meets the segment $P D$ again at $Q$, and the circumcircle of the triangle $A P Q$ meets the segment $P C$ again at $R$. Prove that the lines $C D, A Q$, and $B R$ are concurrent.
G2. Let $A B C D$ be a convex quadrilateral circumscribed around a circle with centre $I$.
Let $\omega$ be the circumcircle of the triangle $A C I$. The extensions of $B A$ and $B C$ beyond $A$ and $C$ meet $\omega$ at $X$ and $Z$, respectively. The extensions of $A D$ and $C D$ beyond $D$ meet $\omega$ at $Y$ and $T$, respectively. Prove that the perimeters of the (possibly self-intersecting) quadrilaterals $A D T X$ and $C D Y Z$ are equal.
G3.
Version 1. Let $n$ be a fixed positive integer, and let S be the set of points $(x, y)$ on the Cartesian plane such that both coordinates $x$ and $y$ are nonnegative integers smaller than $2 n$ (thus $|S|=4 n^{2}$ ). Assume that $\mathcal{F}$ is a set consisting of $n^{2}$ quadrilaterals such that all their vertices lie in $S$, and each point in $S$ is a vertex of exactly one of the quadrilaterals in $\mathcal{F}$.
Determine the largest possible sum of areas of all $n^{2}$ quadrilaterals in $\mathcal{F}$. Version 2. Let $n$ be a fixed positive integer, and let S be the set of points $(x, y)$ on the Cartesian plane such that both coordinates $x$ and $y$ are nonnegative integers smaller than $2 n$ (thus $|\mathrm{S}|=4 n^{2}$ ). Assume that $\mathcal{F}$ is a set of polygons such that all vertices of polygons in $\mathcal{F}$ lie in S , and each point in S is a vertex of exactly one of the polygons in $\mathcal{F}$.
Determine the largest possible sum of areas of all polygons in $\mathcal{F}$. G4. Let $A B C D$ be a quadrilateral inscribed in a circle $\Omega$. Let the tangent to $\Omega$ at $D$ intersect the rays $B A$ and $B C$ at points $E$ and $F$, respectively. A point $T$ is chosen inside the triangle $A B C$ so that $T E | C D$ and $T F | A D$. Let $K \neq D$ be a point on the segment $D F$ such that $T D=T K$. Prove that the lines $A C, D T$ and $B K$ intersect at one point.
G5. Let $A B C D$ be a cyclic quadrilateral whose sides have pairwise different lengths. Let $O$ be the circumcentre of $A B C D$. The internal angle bisectors of $\angle A B C$ and $\angle A D C$ meet $A C$ at $B_{1}$ and $D_{1}$, respectively. Let $O_{B}$ be the centre of the circle which passes through $B$ and is tangent to $A C$ at $D_{1}$. Similarly, let $O_{D}$ be the centre of the circle which passes through $D$ and is tangent to $A C$ at $B_{1}$.
Assume that $B D_{1} | D B_{1}$. Prove that $O$ lies on the line $O_{B} O_{D}$. G6. Determine all integers $n \geqslant 3$ satisfying the following property: every convex $n$-gon whose sides all have length 1 contains an equilateral triangle of side length 1. (Every polygon is assumed to contain its boundary.)
G7. A point $D$ is chosen inside an acute-angled triangle $A B C$ with $A B>A C$ so that $\angle B A D=\angle D A C$. A point $E$ is constructed on the segment $A C$ so that $\angle A D E=\angle D C B$. Similarly, a point $F$ is constructed on the segment $A B$ so that $\angle A D F=\angle D B C$. A point $X$ is chosen on the line $A C$ so that $C X=B X$. Let $O_{1}$ and $O_{2}$ be the circumcentres of the triangles $A D C$ and $D X E$. Prove that the lines $B C, E F$, and $O_{1} O_{2}$ are concurrent.
G8. Let $\omega$ be the circumcircle of a triangle $A B C$, and let $\Omega_{A}$ be its excircle which is tangent to the segment $B C$. Let $X$ and $Y$ be the intersection points of $\omega$ and $\Omega_{A}$. Let $P$ and $Q$ be the projections of $A$ onto the tangent lines to $\Omega_{A}$ at $X$ and $Y$, respectively. The tangent line at $P$ to the circumcircle of the triangle $A P X$ intersects the tangent line at $Q$ to the circumcircle of the triangle $A Q Y$ at a point $R$. Prove that $A R \perp B C$.
Number Theory
N1. Determine all integers $n \geqslant 1$ for which there exists a pair of positive integers $(a, b)$ such that no cube of a prime divides $a^{2}+b+3$ and
N2. Let $n \geqslant 100$ be an integer. The numbers $n, n+1, \ldots, 2 n$ are written on $n+1$ cards, one number per card. The cards are shuffled and divided into two piles. Prove that one of the piles contains two cards such that the sum of their numbers is a perfect square.
N3. Find all positive integers $n$ with the following property: the $k$ positive divisors of $n$ have a permutation $\left(d_{1}, d_{2}, \ldots, d_{k}\right)$ such that for every $i=1,2, \ldots, k$, the number $d_{1}+\cdots+d_{i}$ is a perfect square.
N4. Alice is given a rational number $r>1$ and a line with two points $B \neq R$, where point $R$ contains a red bead and point $B$ contains a blue bead. Alice plays a solitaire game by performing a sequence of moves. In every move, she chooses a (not necessarily positive) integer $k$, and a bead to move. If that bead is placed at point $X$, and the other bead is placed at $Y$, then Alice moves the chosen bead to point $X^{\prime}$ with $\overrightarrow{Y X^{\prime}}=r^{k} \overrightarrow{Y X}$.
Alice's goal is to move the red bead to the point $B$. Find all rational numbers $r>1$ such that Alice can reach her goal in at most 2021 moves.
N5. Prove that there are only finitely many quadruples $(a, b, c, n)$ of positive integers such that
N6. Determine all integers $n \geqslant 2$ with the following property: every $n$ pairwise distinct integers whose sum is not divisible by $n$ can be arranged in some order $a_{1}, a_{2}, \ldots, a_{n}$ so that $n$ divides $1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n}$.
N7. Let $a_{1}, a_{2}, a_{3}, \ldots$ be an infinite sequence of positive integers such that $a_{n+2 m}$ divides $a_{n}+a_{n+m}$ for all positive integers $n$ and $m$. Prove that this sequence is eventually periodic, i.e. there exist positive integers $N$ and $d$ such that $a_{n}=a_{n+d}$ for all $n>N$.
N8. For a polynomial $P(x)$ with integer coefficients let $P^{1}(x)=P(x)$ and $P^{k+1}(x)=$ $P\left(P^{k}(x)\right)$ for $k \geqslant 1$. Find all positive integers $n$ for which there exists a polynomial $P(x)$ with integer coefficients such that for every integer $m \geqslant 1$, the numbers $P^{m}(1), \ldots, P^{m}(n)$ leave exactly $\left\lceil n / 2^{m}\right\rceil$ distinct remainders when divided by $n$.
Solutions
Algebra
A1. Let $n$ be an integer, and let $A$ be a subset of $\left{0,1,2,3, \ldots, 5^{n}\right}$ consisting of $4 n+2$ numbers. Prove that there exist $a, b, c \in A$ such that $a<b<c$ and $c+2 a>3 b$.
Solution 1. (By contradiction) Suppose that there exist $4 n+2$ non-negative integers $x_{0}<$ $x_{1}<\cdots<x_{4 n+1}$ that violate the problem statement. Then in particular $x_{4 n+1}+2 x_{i} \leqslant 3 x_{i+1}$ for all $i=0, \ldots, 4 n-1$, which gives
By a trivial induction we then get
which for $i=0$ yields the contradiction
Solution 2. Denote the maximum element of $A$ by $c$. For $k=0, \ldots, 4 n-1$ let
Note that
which shows that the sets $A_{0}, A_{1}, \ldots, A_{4 n-1}$ form a partition of $A \backslash{c}$. Since $A \backslash{c}$ has $4 n+1$ elements, by the pigeonhole principle some set $A_{k}$ does contain at least two elements of $A \backslash{c}$. Denote these two elements $a$ and $b$ and assume $a<b$, so that $a<b<c$. Then
as desired.
A2. For every integer $n \geqslant 1$ consider the $n \times n$ table with entry $\left\lfloor\frac{i j}{n+1}\right\rfloor$ at the intersection of row $i$ and column $j$, for every $i=1, \ldots, n$ and $j=1, \ldots, n$. Determine all integers $n \geqslant 1$ for which the sum of the $n^{2}$ entries in the table is equal to $\frac{1}{4} n^{2}(n-1)$.
Answer: All integers $n$ for which $n+1$ is a prime. Solution 1. First, observe that every pair $x, y$ of real numbers for which the sum $x+y$ is integer satisfies
The inequality is strict if $x$ and $y$ are integers, and it holds with equality otherwise. We estimate the sum $S$ as follows.
The inequality in the last line follows from (1) by setting $x=i j /(n+1)$ and $y=(n+1-$ i) $j /(n+1)$, so that $x+y=j$ is integral.
Now $S=\frac{1}{4} n^{2}(n-1)$ if and only if the inequality in the last line holds with equality, which means that none of the values $i j /(n+1)$ with $1 \leqslant i, j \leqslant n$ may be integral.
Hence, if $n+1$ is composite with factorisation $n+1=a b$ for $2 \leqslant a, b \leqslant n$, one gets a strict inequality for $i=a$ and $j=b$. If $n+1$ is a prime, then $i j /(n+1)$ is never integral and $S=\frac{1}{4} n^{2}(n-1)$.
Solution 2. To simplify the calculation with indices, extend the table by adding a phantom column of index 0 with zero entries (which will not change the sum of the table). Fix a row $i$ with $1 \leqslant i \leqslant n$, and let $d:=\operatorname{gcd}(i, n+1)$ and $k:=(n+1) / d$. For columns $j=0, \ldots, n$, define the remainder $r_{j}:=i j \bmod (n+1)$. We first prove the following Claim. For every integer $g$ with $1 \leqslant g \leqslant d$, the remainders $r_{j}$ with indices $j$ in the range
form a permutation of the $k$ numbers $0 \cdot d, 1 \cdot d, 2 \cdot d, \ldots,(k-1) \cdot d$. Proof. If $r_{j^{\prime}}=r_{j}$ holds for two indices $j^{\prime}$ and $j$ in (2), then $i\left(j^{\prime}-j\right) \equiv 0 \bmod (n+1)$, so that $j^{\prime}-j$ is a multiple of $k$; since $\left|j^{\prime}-j\right| \leqslant k-1$, this implies $j^{\prime}=j$. Hence, the $k$ remainders are pairwise distinct. Moreover, each remainder $r_{j}=i j \bmod (n+1)$ is a multiple of $d=\operatorname{gcd}(i, n+1)$. This proves the claim.
We then have
By using (3), compute the sum $S_{i}$ of row $i$ as follows:
Equation (4) yields the following lower bound on the row sum $S_{i}$, which holds with equality if and only if $d=\operatorname{gcd}(i, n+1)=1$ :
By summing up the bounds (5) for the rows $i=1, \ldots, n$, we get the following lower bound for the sum of all entries in the table
In (6) we have equality if and only if equality holds in (5) for each $i=1, \ldots, n$, which happens if and only if $\operatorname{gcd}(i, n+1)=1$ for each $i=1, \ldots, n$, which is equivalent to the fact that $n+1$ is a prime. Thus the sum of the table entries is $\frac{1}{4} n^{2}(n-1)$ if and only if $n+1$ is a prime.
Comment. To simplify the answer, in the problem statement one can make a change of variables by introducing $m:=n+1$ and writing everything in terms of $m$. The drawback is that the expression for the sum will then be $\frac{1}{4}(m-1)^{2}(m-2)$ which seems more artificial.
A3. Given a positive integer $n$, find the smallest value of $\left\lfloor\frac{a_{1}}{1}\right\rfloor+\left\lfloor\frac{a_{2}}{2}\right\rfloor+\cdots+\left\lfloor\frac{a_{n}}{n}\right\rfloor$ over all permutations $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ of $(1,2, \ldots, n)$.
Answer: The minimum of such sums is $\left\lfloor\log {2} n\right\rfloor+1$; so if $2^{k} \leqslant n<2^{k+1}$, the minimum is $k+1$. Solution 1. Suppose that $2^{k} \leqslant n<2^{k+1}$ with some nonnegative integer $k$. First we show a permutation $\left(a{1}, a_{2}, \ldots, a_{n}\right)$ such that $\left\lfloor\frac{a_{1}}{1}\right\rfloor+\left\lfloor\frac{a_{2}}{2}\right\rfloor+\cdots+\left\lfloor\frac{a_{n}}{n}\right\rfloor=k+1$; then we will prove that $\left\lfloor\frac{a_{1}}{1}\right\rfloor+\left\lfloor\frac{a_{2}}{2}\right\rfloor+\cdots+\left\lfloor\frac{a_{n}}{n}\right\rfloor \geqslant k+1$ for every permutation. Hence, the minimal possible value will be $k+1$. I. Consider the permutation
This permutation consists of $k+1$ cycles. In every cycle $\left(a_{p}, \ldots, a_{q}\right)=(q, p, p+1, \ldots, q-1)$ we have $q<2 p$, so
The total sum over all cycles is precisely $k+1$. II. In order to establish the lower bound, we prove a more general statement.
Claim. If $b_{1}, \ldots, b_{2^{k}}$ are distinct positive integers then
From the Claim it follows immediately that $\sum_{i=1}^{n}\left\lfloor\frac{a_{i}}{i}\right\rfloor \geqslant \sum_{i=1}^{2^{k}}\left\lfloor\frac{a_{i}}{i}\right\rfloor \geqslant k+1$. Proof of the Claim. Apply induction on $k$. For $k=1$ the claim is trivial, $\left\lfloor\frac{b_{1}}{1}\right\rfloor \geqslant 1$. Suppose the Claim holds true for some positive integer $k$, and consider $k+1$.
If there exists an index $j$ such that $2^{k}<j \leqslant 2^{k+1}$ and $b_{j} \geqslant j$ then
by the induction hypothesis, so the Claim is satisfied. Otherwise we have $b_{j}<j \leqslant 2^{k+1}$ for every $2^{k}<j \leqslant 2^{k+1}$. Among the $2^{k+1}$ distinct numbers $b_{1}, \ldots, b_{2^{k+1}}$ there is some $b_{m}$ which is at least $2^{k+1}$; that number must be among $b_{1} \ldots, b_{2^{k}}$. Hence, $1 \leqslant m \leqslant 2^{k}$ and $b_{m} \geqslant 2^{k+1}$.
We will apply the induction hypothesis to the numbers
so take the first $2^{k}$ numbers but replace $b_{m}$ with $b_{2^{k}+1}$. Notice that
For the other indices $i$ with $1 \leqslant i \leqslant 2^{k}, i \neq m$ we have $\left\lfloor\frac{b_{i}}{i}\right\rfloor=\left\lfloor\frac{c_{i}}{i}\right\rfloor$, so
That proves the Claim and hence completes the solution. Solution 2. We present a different proof for the lower bound. Assume again $2^{k} \leqslant n<2^{k+1}$, and let $P=\left{2^{0}, 2^{1}, \ldots, 2^{k}\right}$ be the set of powers of 2 among $1,2, \ldots, n$. Call an integer $i \in{1,2, \ldots, n}$ and the interval $\left[i, a_{i}\right]$ good if $a_{i} \geqslant i$.
Lemma 1. The good intervals cover the integers $1,2, \ldots, n$. Proof. Consider an arbitrary $x \in{1,2 \ldots, n}$; we want to find a good interval $\left[i, a_{i}\right]$ that covers $x$; i.e., $i \leqslant x \leqslant a_{i}$. Take the cycle of the permutation that contains $x$, that is $\left(x, a_{x}, a_{a_{x}}, \ldots\right)$. In this cycle, let $i$ be the first element with $a_{i} \geqslant x$; then $i \leqslant x \leqslant a_{i}$.
Lemma 2. If a good interval $\left[i, a_{i}\right]$ covers $p$ distinct powers of 2 then $\left\lfloor\frac{a_{i}}{i}\right\rfloor \geqslant p$; more formally, $\left\lfloor\frac{a_{i}}{i}\right\rfloor \geqslant\left|\left[i, a_{i}\right] \cap P\right|$. Proof. The ratio of the smallest and largest powers of 2 in the interval is at least $2^{p-1}$. By Bernoulli's inequality, $\frac{a_{i}}{i} \geqslant 2^{p-1} \geqslant p$; that proves the lemma.
Now, by Lemma 1, the good intervals cover $P$. By applying Lemma 2 as well, we obtain that
Solution 3. We show yet another proof for the lower bound, based on the following inequality.
Lemma 3.
for every pair $a, b$ of positive integers. Proof. Let $t=\left\lfloor\frac{a}{b}\right\rfloor$, so $t \leqslant \frac{a}{b}$ and $\frac{a+1}{b} \leqslant t+1$. By applying the inequality $2^{t} \geqslant t+1$, we obtain
By applying the lemma to each term, we get
Notice that the numbers $a_{1}+1, a_{2}+1, \ldots, a_{n}+1$ form a permutation of $2,3, \ldots, n+1$. Hence, in the last two sums all terms cancel out, except for $\log _{2}(n+1)$ in the first sum and $\log _{2} 1=0$ in the second sum. Therefore,
As the left-hand side is an integer, it must be at least $k+1$.
A4. Show that for all real numbers $x_{1}, \ldots, x_{n}$ the following inequality holds:
Solution 1. If we add $t$ to all the variables then the left-hand side remains constant and the right-hand side becomes
Let $T$ be large enough such that both $H(-T)$ and $H(T)$ are larger than the value $L$ of the lefthand side of the inequality we want to prove. Not necessarily distinct points $p_{i, j}:=-\left(x_{i}+x_{j}\right) / 2$ together with $T$ and $-T$ split the real line into segments and two rays such that on each of these segments and rays the function $H(t)$ is concave since $f(t):=\sqrt{|\ell+2 t|}$ is concave on both intervals $(-\infty,-\ell / 2]$ and $[-\ell / 2,+\infty)$. Let $[a, b]$ be the segment containing zero. Then concavity implies $H(0) \geqslant \min {H(a), H(b)}$ and, since $H( \pm T)>L$, it suffices to prove the inequalities $H\left(-\left(x_{i}+x_{j}\right) / 2\right) \geqslant L$, that is to prove the original inequality in the case when all numbers are shifted in such a way that two variables $x_{i}$ and $x_{j}$ add up to zero. In the following we denote the shifted variables still by $x_{i}$.
If $i=j$, i.e. $x_{i}=0$ for some index $i$, then we can remove $x_{i}$ which will decrease both sides by $2 \sum_{k} \sqrt{\left|x_{k}\right|}$. Similarly, if $x_{i}+x_{j}=0$ for distinct $i$ and $j$ we can remove both $x_{i}$ and $x_{j}$ which decreases both sides by
In either case we reduced our inequality to the case of smaller $n$. It remains to note that for $n=0$ and $n=1$ the inequality is trivial.
Solution 2. For real $p$ consider the integral
which clearly converges to a strictly positive number. By changing the variable $y=|p| x$ one notices that $I(p)=\sqrt{|p|} I(1)$. Hence, by using the trigonometric formula $\cos (\alpha-\beta)-\cos (\alpha+$ $\beta)=2 \sin \alpha \sin \beta$ we obtain $\sqrt{|a+b|}-\sqrt{|a-b|}=\frac{1}{I(1)} \int_{0}^{\infty} \frac{\cos ((a-b) x)-\cos ((a+b) x)}{x \sqrt{x}} d x=\frac{1}{I(1)} \int_{0}^{\infty} \frac{2 \sin (a x) \sin (b x)}{x \sqrt{x}} d x$, from which our inequality immediately follows:
Comment 1. A more general inequality
holds for any $r \in[0,2]$. The first solution can be repeated verbatim for any $r \in[0,1]$ but not for $r>1$. In the second solution, by putting $x^{r+1}$ in the denominator in place of $x \sqrt{x}$ we can prove the inequality for any $r \in(0,2)$ and the cases $r=0,2$ are easy to check by hand. Comment 2. In fact, the integral from Solution 2 can be computed explicitly, we have $I(1)=\sqrt{2 \pi}$.
A5. Let $n \geqslant 2$ be an integer, and let $a_{1}, a_{2}, \ldots, a_{n}$ be positive real numbers such that $a_{1}+a_{2}+\cdots+a_{n}=1$. Prove that
Solution 1. For all $k \leqslant n$, let
with the convention that $s_{0}=0$. Note that $b_{k}$ is exactly a summand in the sum we need to estimate. We shall prove the inequality
Indeed, it suffices to check that
which holds since $a_{k}+s_{k-1}=s_{k} \leqslant 1$ and $a_{k} \in(0,1)$. Thus, adding inequalities (1) for $k=1, \ldots, n$, we conclude that
as desired. Comment 1. There are many ways of proving (1) which can be written as
for non-negative $a$ and $s$ satisfying $a+s \leqslant 1$ and $a>0$. E.g., note that for any fixed $a$ the expression in (2) is quadratic in $s$ with the leading coefficient $a /(1-a)-a>0$. Hence, it is convex as a function in $s$, so it suffices to check the inequality at $s=0$ and $s=1-a$. The former case is trivial and in the latter case the inequality can be rewritten as
which is trivial since $a+s=1$. Solution 2. First, let us define
For some index $i$, denote $a_{1}+\cdots+a_{i-1}$ by $s$. If we replace $a_{i}$ with two numbers $a_{i} / 2$ and $a_{i} / 2$, i.e. replace the tuple $\left(a_{1}, \ldots, a_{n}\right)$ with $\left(a_{1}, \ldots, a_{i-1}, a_{i} / 2, a_{i} / 2, a_{i+1}, \ldots, a_{n}\right)$, the sum will increase by
which is strictly positive. So every such replacement strictly increases the sum. By repeating this process and making maximal number in the tuple tend to zero, we keep increasing the sum which will converge to
This completes the proof. Solution 3. We sketch a probabilistic version of the first solution. Let $x_{1}, x_{2}, x_{3}$ be drawn uniformly and independently at random from the segment [0,1]. Let $I_{1} \cup I_{2} \cup \cdots \cup I_{n}$ be a partition of $[0,1]$ into segments of length $a_{1}, a_{2}, \ldots, a_{n}$ in this order. Let $J_{k}:=I_{1} \cup \cdots \cup I_{k-1}$ for $k \geqslant 2$ and $J_{1}:=\varnothing$. Then
where for the last inequality we used that $1-a_{k} \geqslant a_{1}+\cdots+a_{k-1}$. This completes the proof since
A6. Let $A$ be a finite set of (not necessarily positive) integers, and let $m \geqslant 2$ be an integer. Assume that there exist non-empty subsets $B_{1}, B_{2}, B_{3}, \ldots, B_{m}$ of $A$ whose elements add up to the sums $m^{1}, m^{2}, m^{3}, \ldots, m^{m}$, respectively. Prove that $A$ contains at least $m / 2$ elements.
Solution. Let $A=\left{a_{1}, \ldots, a_{k}\right}$. Assume that, on the contrary, $k=|A|<m / 2$. Let
be the sum of elements of $B_{i}$. We are given that $s_{i}=m^{i}$ for $i=1, \ldots, m$. Now consider all $m^{m}$ expressions of the form
Note that every number $f\left(c_{1}, \ldots, c_{m}\right)$ has the form
Hence, there are at most $(m(m-1)+1)^{k}<m^{2 k}<m^{m}$ distinct values of our expressions; therefore, at least two of them coincide.
Since $s_{i}=m^{i}$, this contradicts the uniqueness of representation of positive integers in the base- $m$ system.
Comment 1. For other rapidly increasing sequences of sums of $B_{i}$ 's the similar argument also provides lower estimates on $k=|A|$. For example, if the sums of $B_{i}$ are equal to 1!, 2!, 3!, $\ldots, m$ !, then for any fixed $\varepsilon>0$ and large enough $m$ we get $k \geqslant(1 / 2-\varepsilon) m$. The proof uses the fact that the combinations $\sum c_{i}$ ! with $c_{i} \in{0,1, \ldots, i}$ are all distinct.
Comment 2. The problem statement holds also if $A$ is a set of real numbers (not necessarily integers), the above proofs work in the real case.
A7. Let $n \geqslant 1$ be an integer, and let $x_{0}, x_{1}, \ldots, x_{n+1}$ be $n+2$ non-negative real numbers that satisfy $x_{i} x_{i+1}-x_{i-1}^{2} \geqslant 1$ for all $i=1,2, \ldots, n$. Show that
Solution 1.
Lemma 1.1. If $a, b, c$ are non-negative numbers such that $a b-c^{2} \geqslant 1$, then
Proof. $(a+2 b)^{2}-(b+2 c)^{2}=(a-b)^{2}+2(b-c)^{2}+6\left(a b-c^{2}\right) \geqslant 6$. Lemma 1.2. $\sqrt{1}+\cdots+\sqrt{n}>\frac{2}{3} n^{3 / 2}$. Proof. Bernoulli's inequality $(1+t)^{3 / 2}>1+\frac{3}{2} t$ for $0>t \geqslant-1$ (or, alternatively, a straightforward check) gives
Summing up (*) over $k=1,2, \ldots, n$ yields
Now put $y_{i}:=2 x_{i}+x_{i+1}$ for $i=0,1, \ldots, n$. We get $y_{0} \geqslant 0$ and $y_{i}^{2} \geqslant y_{i-1}^{2}+6$ for $i=1,2, \ldots, n$ by Lemma 1.1. Thus, an easy induction on $i$ gives $y_{i} \geqslant \sqrt{6 i}$. Using this estimate and Lemma 1.2 we get
Solution 2. Say that an index $i \in{0,1, \ldots, n+1}$ is good, if $x_{i} \geqslant \sqrt{\frac{2}{3}} i$, otherwise call the index $i$ bad. Lemma 2.1. There are no two consecutive bad indices. Proof. Assume the contrary and consider two bad indices $j, j+1$ with minimal possible $j$. Since 0 is good, we get $j>0$, thus by minimality $j-1$ is a good index and we have
that contradicts the AM-GM inequality for numbers $j$ and $j+1$. Lemma 2.2. If an index $j \leqslant n-1$ is good, then
Proof. We have
the last inequality follows from concavity of the square root function, or, alternatively, from the AM-QM inequality for the numbers $\sqrt{\frac{2}{3} j+\frac{2}{3}}$ and $\sqrt{\frac{2}{3} j+\frac{4}{3}}$.
Let $S_{i}=x_{1}+\ldots+x_{i}$ and $T_{i}=\sqrt{\frac{2}{3}}(\sqrt{1}+\ldots+\sqrt{i})$. Lemma 2.3. If an index $i$ is good, then $S_{i} \geqslant T_{i}$. Proof. Induction on $i$. The base case $i=0$ is clear. Assume that the claim holds for good indices less than $i$ and prove it for a good index $i>0$.
If $i-1$ is good, then by the inductive hypothesis we get $S_{i}=S_{i-1}+x_{i} \geqslant T_{i-1}+\sqrt{\frac{2}{3} i}=T_{i}$. If $i-1$ is bad, then $i>1$, and $i-2$ is good by Lemma 2.1. Then using Lemma 2.2 and the inductive hypothesis we get
Since either $n$ or $n+1$ is good by Lemma 2.1, Lemma 2.3 yields in both cases $S_{n+1} \geqslant T_{n}$, and it remains to apply Lemma 1.2 from Solution 1.
Comment 1. Another way to get (*) is the integral bound
Comment 2. If $x_{i}=\sqrt{2 / 3} \cdot(\sqrt{i}+1)$, the conditions of the problem hold. Indeed, the inequality to check is
that rewrites as
which follows from
For these numbers we have $x_{0}+\ldots+x_{n+1}=\left(\frac{2 n}{3}\right)^{3 / 2}+O(n)$, thus the multiplicative constant $(2 / 3)^{3 / 2}$ in the problem statement is sharp.
A8. Determine all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfy
for all real numbers $a, b, c$. Answer: $f(x)=\alpha x+\beta$ or $f(x)=\alpha x^{3}+\beta$ where $\alpha \in{-1,0,1}$ and $\beta \in \mathbb{R}$. Solution. It is straightforward to check that above functions satisfy the equation. Now let $f(x)$ satisfy the equation, which we denote $E(a, b, c)$. Then clearly $f(x)+C$ also does; therefore, we may suppose without loss of generality that $f(0)=0$.We start with proving Lemma. Either $f(x) \equiv 0$ or $f$ is injective. Proof. Denote by $\Theta \subseteq \mathbb{R}^{2}$ the set of points $(a, b)$ for which $f(a)=f(b)$. Let $\Theta^{*}={(x, y) \in \Theta$ : $x \neq y}$. The idea is that if $(a, b) \in \Theta$, then by $E(a, b, x)$ we get
for all real $x$. Reproducing this argument starting with $(a, b) \in \Theta^{*}$, we get more and more points in $\Theta$. There are many ways to fill in the details, we give below only one of them.
Assume that $(a, b) \in \Theta^{*}$. Note that
and
Hence, there exists $x$ for which both $g_{-}(x) \neq 0$ and $g_{+}(x) \neq 0$. This gives a point $(\alpha, \beta)=$ $H_{a, b}(x) \in \Theta^{}$ for which $\alpha \neq-\beta$. Now compare $E(\alpha, 1,0)$ and $E(\beta, 1,0)$. The left-hand side expressions coincide, on right-hand side we get $f(\alpha)-f\left(\alpha^{2}\right)=f(\beta)-f\left(\beta^{2}\right)$, respectively. Hence, $f\left(\alpha^{2}\right)=f\left(\beta^{2}\right)$ and we get a point $\left(\alpha_{1}, \beta_{1}\right):=\left(\alpha^{2}, \beta^{2}\right) \in \Theta^{}$ with both coordinates $\alpha_{1}, \beta_{1}$ non-negative. Continuing squaring the coordinates, we get a point $(\gamma, \delta) \in \Theta^{}$ for which $\delta>5 \gamma \geqslant 0$. Our nearest goal is to get a point $(0, r) \in \Theta^{}$. If $\gamma=0$, this is already done. If $\gamma>0$, denote by $x$ a real root of the quadratic equation $\delta \gamma^{2}+\gamma x^{2}+x \delta^{2}=0$, which exists since the discriminant $\delta^{4}-4 \delta \gamma^{3}$ is positive. Also $x<0$ since this equation cannot have non-negative root. For the point $H_{\delta, \gamma}(x)=:(0, r) \in \Theta$ the first coordinate is 0 . The difference of coordinates equals $-r=(\delta-\gamma)(\gamma-x)(x-\delta)<0$, so $r \neq 0$ as desired.
Now, let $(0, r) \in \Theta^{*}$. We get $H_{0, r}(x)=\left(r x^{2}, r^{2} x\right) \in \Theta$. Thus $f\left(r x^{2}\right)=f\left(r^{2} x\right)$ for all $x \in \mathbb{R}$. Replacing $x$ to $-x$ we get $f\left(r x^{2}\right)=f\left(r^{2} x\right)=f\left(-r^{2} x\right)$, so $f$ is even: $(a,-a) \in \Theta$ for all $a$. Then $H_{a,-a}(x)=\left(a^{3}-a x^{2}+x a^{2},-a^{3}+a^{2} x+x^{2} a\right) \in \Theta$ for all real $a, x$. Putting $x=\frac{1+\sqrt{5}}{2} a$ we obtain $\left(0,(1+\sqrt{5}) a^{3}\right) \in \Theta$ which means that $f(y)=f(0)=0$ for every real $y$.
Hereafter we assume that $f$ is injective and $f(0)=0$. By $E(a, b, 0)$ we get
Let $\kappa:=f(1)$ and note that $\kappa=f(1) \neq f(0)=0$ by injectivity. Putting $b=1$ in ( $\Omega$ ) we get
Subtracting the same equality for $-a$ we get
Now, if $a \neq 0$, by injectivity we get $f(a)-f(-a) \neq 0$ and thus
It follows that
for all non-zero $a, b$. Replace non-zero numbers $a, b$ in ( $\odot$ ) with $-a,-b$, respectively, and add the two equalities. Due to ( $\boldsymbol{\uparrow}$ ) we get
thus $f(a) f(b)=f(-a) f(-b)=(\lambda-f(a))(\lambda-f(b))$ for all non-zero $a \neq b$. If $\lambda \neq 0$, this implies $f(a)+f(b)=\lambda$ that contradicts injectivity when we vary $b$ with fixed $a$. Therefore, $\lambda=0$ and $\kappa= \pm 1$. Thus $f$ is odd. Replacing $f$ with $-f$ if necessary (this preserves the original equation) we may suppose that $f(1)=1$.
Now, (&) yields $f\left(a^{2}\right)=f^{2}(a)$. Summing relations $(\bigcirc)$ for pairs $(a, b)$ and $(a,-b)$, we get $-2 f(a) f^{2}(b)=-2 f\left(a b^{2}\right)$, i.e. $f(a) f\left(b^{2}\right)=f\left(a b^{2}\right)$. Putting $b=\sqrt{x}$ for each non-negative $x$ we get $f(a x)=f(a) f(x)$ for all real $a$ and non-negative $x$. Since $f$ is odd, this multiplicativity relation is true for all $a, x$. Also, from $f\left(a^{2}\right)=f^{2}(a)$ we see that $f(x) \geqslant 0$ for $x \geqslant 0$. Next, $f(x)>0$ for $x>0$ by injectivity.
Assume that $f(x)$ for $x>0$ does not have the form $f(x)=x^{\tau}$ for a constant $\tau$. The known property of multiplicative functions yields that the graph of $f$ is dense on $(0, \infty)^{2}$. In particular, we may find positive $b<1 / 10$ for which $f(b)>1$. Also, such $b$ can be found if $f(x)=x^{\tau}$ for some $\tau<0$. Then for all $x$ we have $x^{2}+x b^{2}+b \geqslant 0$ and so $E(1, b, x)$ implies that
is bounded from below (the quadratic trinomial bound $(t-f(1))(t-f(b)) \geqslant-(f(b)-1)^{2} / 4$ for $t=f(x)$ is used). Hence, $f$ is bounded from below on $\left(b^{2}-\frac{1}{4 b},+\infty\right)$, and since $f$ is odd it is bounded from above on $\left(0, \frac{1}{4 b}-b^{2}\right)$. This is absurd if $f(x)=x^{\tau}$ for $\tau<0$, and contradicts to the above dense graph condition otherwise.
Therefore, $f(x)=x^{\tau}$ for $x>0$ and some constant $\tau>0$. Dividing $E(a, b, c)$ by $(a-b)(b-$ $c)(c-a)=\left(a b^{2}+b c^{2}+c a^{2}\right)-\left(a^{2} b+b^{2} c+c^{2} a\right)$ and taking a limit when $a, b, c$ all go to 1 (the divided ratios tend to the corresponding derivatives, say, $\frac{a^{\tau}-b^{\tau}}{a-b} \rightarrow\left(x^{\tau}\right)_{x=1}^{\prime}=\tau$ ), we get $\tau^{3}=\tau \cdot 3^{\tau-1}, \tau^{2}=3^{\tau-1}, F(\tau):=3^{\tau / 2-1 / 2}-\tau=0$. Since function $F$ is strictly convex, it has at most two roots, and we get $\tau \in{1,3}$.
Combinatorics
C1. Let $S$ be an infinite set of positive integers, such that there exist four pairwise distinct $a, b, c, d \in S$ with $\operatorname{gcd}(a, b) \neq \operatorname{gcd}(c, d)$. Prove that there exist three pairwise distinct $x, y, z \in S$ such that $\operatorname{gcd}(x, y)=\operatorname{gcd}(y, z) \neq \operatorname{gcd}(z, x)$.
Solution. There exists $\alpha \in S$ so that ${\operatorname{gcd}(\alpha, s) \mid s \in S, s \neq \alpha}$ contains at least two elements. Since $\alpha$ has only finitely many divisors, there is a $d \mid \alpha$ such that the set $B={\beta \in$ $S \mid \operatorname{gcd}(\alpha, \beta)=d}$ is infinite. Pick $\gamma \in S$ so that $\operatorname{gcd}(\alpha, \gamma) \neq d$. Pick $\beta_{1}, \beta_{2} \in B$ so that $\operatorname{gcd}\left(\beta_{1}, \gamma\right)=\operatorname{gcd}\left(\beta_{2}, \gamma\right)=: d^{\prime}$. If $d=d^{\prime}$, then $\operatorname{gcd}\left(\alpha, \beta_{1}\right)=\operatorname{gcd}\left(\gamma, \beta_{1}\right) \neq \operatorname{gcd}(\alpha, \gamma)$. If $d \neq d^{\prime}$, then either $\operatorname{gcd}\left(\alpha, \beta_{1}\right)=\operatorname{gcd}\left(\alpha, \beta_{2}\right)=d$ and $\operatorname{gcd}\left(\beta_{1}, \beta_{2}\right) \neq d$ or $\operatorname{gcd}\left(\gamma, \beta_{1}\right)=\operatorname{gcd}\left(\gamma, \beta_{2}\right)=d^{\prime}$ and $\operatorname{gcd}\left(\beta_{1}, \beta_{2}\right) \neq d^{\prime}$.
Comment. The situation can be modelled as a complete graph on the infinite vertex set $S$, where every edge ${s, t}$ is colored by $c(s, t):=\operatorname{gcd}(s, t)$. For every vertex the incident edges carry only finitely many different colors, and by the problem statement at least two different colors show up on the edge set. The goal is to show that there exists a bi-colored triangle (a triangle, whose edges carry exactly two different colors).
For the proof, consider a vertex $v$ whose incident edges carry at least two different colors. Let $X \subset S$ be an infinite subset so that $c(v, x) \equiv c_{1}$ for all $x \in X$. Let $y \in S$ be a vertex so that $c(v, y) \neq c_{1}$. Let $x_{1}, x_{2} \in X$ be two vertices with $c\left(y, x_{1}\right)=c\left(y, x_{2}\right)=c_{2}$. If $c_{1}=c_{2}$, then the triangle $v, y, x_{1}$ is bi-colored. If $c_{1} \neq c_{2}$, then one of $v, x_{1}, x_{2}$ and $y, x_{1}, x_{2}$ is bi-colored.
C2. Let $n \geqslant 3$ be an integer. An integer $m \geqslant n+1$ is called $n$-colourful if, given infinitely many marbles in each of $n$ colours $C_{1}, C_{2}, \ldots, C_{n}$, it is possible to place $m$ of them around a circle so that in any group of $n+1$ consecutive marbles there is at least one marble of colour $C_{i}$ for each $i=1, \ldots, n$.
Prove that there are only finitely many positive integers which are not $n$-colourful. Find the largest among them.
Answer: $m_{\max }=n^{2}-n-1$. Solution. First suppose that there are $n(n-1)-1$ marbles. Then for one of the colours, say blue, there are at most $n-2$ marbles, which partition the non-blue marbles into at most $n-2$ groups with at least $(n-1)^{2}>n(n-2)$ marbles in total. Thus one of these groups contains at least $n+1$ marbles and this group does not contain any blue marble.
Now suppose that the total number of marbles is at least $n(n-1)$. Then we may write this total number as $n k+j$ with some $k \geqslant n-1$ and with $0 \leqslant j \leqslant n-1$. We place around a circle $k-j$ copies of the colour sequence $[1,2,3, \ldots, n]$ followed by $j$ copies of the colour sequence $[1,1,2,3, \ldots, n]$.
C3. A thimblerigger has 2021 thimbles numbered from 1 through 2021. The thimbles are arranged in a circle in arbitrary order. The thimblerigger performs a sequence of 2021 moves; in the $k^{\text {th }}$ move, he swaps the positions of the two thimbles adjacent to thimble $k$.
Prove that there exists a value of $k$ such that, in the $k^{\text {th }}$ move, the thimblerigger swaps some thimbles $a$ and $b$ such that $a<k<b$.
Solution. Assume the contrary. Say that the $k^{\mathrm{th}}$ thimble is the central thimble of the $k^{\mathrm{th}}$ move, and its position on that move is the central position of the move.
Step 1: Black and white colouring.
Before the moves start, let us paint all thimbles in white. Then, after each move, we repaint its central thimble in black. This way, at the end of the process all thimbles have become black.
By our assumption, in every move $k$, the two swapped thimbles have the same colour (as their numbers are either both larger or both smaller than $k$ ). At every moment, assign the colours of the thimbles to their current positions; then the only position which changes its colour in a move is its central position. In particular, each position is central for exactly one move (when it is being repainted to black).
Step 2: Red and green colouring.
Now we introduce a colouring of the positions. If in the $k^{\text {th }}$ move, the numbers of the two swapped thimbles are both less than $k$, then we paint the central position of the move in red; otherwise we paint that position in green. This way, each position has been painted in red or green exactly once. We claim that among any two adjacent positions, one becomes green and the other one becomes red; this will provide the desired contradiction since 2021 is odd.
Consider two adjacent positions $A$ and $B$, which are central in the $a^{\text {th }}$ and in the $b^{\text {th }}$ moves, respectively, with $a<b$. Then in the $a^{\text {th }}$ move the thimble at position $B$ is white, and therefore has a number greater than $a$. After the $a^{\text {th }}$ move, position $A$ is green and the thimble at position $A$ is black. By the arguments from Step 1, position $A$ contains only black thimbles after the $a^{\text {th }}$ step. Therefore, on the $b^{\text {th }}$ move, position $A$ contains a black thimble whose number is therefore less than $b$, while thimble $b$ is at position $B$. So position $B$ becomes red, and hence $A$ and $B$ have different colours.
Comment 1. Essentially, Step 1 provides the proof of the following two assertions (under the indirect assumption): (1) Each position $P$ becomes central in exactly one move (denote that move's number by $k$ ); and (2) Before the $k^{\text {th }}$ move, position $P$ always contains a thimble whose number is larger than the number of the current move, while after the $k^{\text {th }}$ move the position always contains a thimble whose number is smaller than the number of the current move.
Both (1) and (2) can be proved without introduction of colours, yet the colours help to visualise the argument.
After these two assertions have been proved, Step 2 can be performed in various ways, e.g., as follows.
At any moment in the process, the black positions are split into several groups consisting of one or more contiguous black positions each; different groups are separated by white positions. Now one can prove by induction on $k$ that, after the $k^{\text {th }}$ move, all groups have odd sizes. Indeed, in every move, the new black position either forms a separate group, or merges two groups (say, of lengths $a$ and $b$ ) into a single group of length $a+b+1$.
However, after the $2020^{\text {th }}$ move the black positions should form one group of length 2020. This is a contradiction.
This argument has several variations; e.g., one can check in a similar way that, after the process starts, at least one among the groups of white positions has an even size.
Comment 2. The solution above works equally well for any odd number of thimbles greater than 1 , instead of 2021. On the other hand, a similar statement with an even number $n=2 k \geqslant 4$ of thimbles is wrong. To show that, the thimblerigger can enumerate positions from 1 through $n$ clockwise, and then put thimbles $1,2, \ldots, k$ at the odd positions, and thimbles $k+1, k+2, \ldots, 2 k$ at the even positions.
C4. The kingdom of Anisotropy consists of $n$ cities. For every two cities there exists exactly one direct one-way road between them. We say that a path from $X$ to $Y$ is a sequence of roads such that one can move from $X$ to $Y$ along this sequence without returning to an already visited city. A collection of paths is called diverse if no road belongs to two or more paths in the collection.
Let $A$ and $B$ be two distinct cities in Anisotropy. Let $N_{A B}$ denote the maximal number of paths in a diverse collection of paths from $A$ to $B$. Similarly, let $N_{B A}$ denote the maximal number of paths in a diverse collection of paths from $B$ to $A$. Prove that the equality $N_{A B}=N_{B A}$ holds if and only if the number of roads going out from $A$ is the same as the number of roads going out from $B$.
Solution 1. We write $X \rightarrow Y$ (or $Y \leftarrow X$ ) if the road between $X$ and $Y$ goes from $X$ to $Y$. Notice that, if there is any route moving from $X$ to $Y$ (possibly passing through some cities more than once), then there is a path from $X$ to $Y$ consisting of some roads in the route. Indeed, any cycle in the route may be removed harmlessly; after some removals one obtains a path.
Say that a path is short if it consists of one or two roads. Partition all cities different from $A$ and $B$ into four groups, $\mathcal{I}, \mathcal{O}, \mathcal{A}$, and $\mathcal{B}$ according to the following rules: for each city $C$,
Lemma. Let $\mathcal{P}$ be a diverse collection consisting of $p$ paths from $A$ to $B$. Then there exists a diverse collection consisting of at least $p$ paths from $A$ to $B$ and containing all short paths from $A$ to $B$. Proof. In order to obtain the desired collection, modify $\mathcal{P}$ as follows. If there is a direct road $A \rightarrow B$ and the path consisting of this single road is not in $\mathcal{P}$, merely add it to $\mathcal{P}$.
Now consider any city $C \in \mathcal{A}$ such that the path $A \rightarrow C \rightarrow B$ is not in $\mathcal{P}$. If $\mathcal{P}$ contains at most one path containing a road $A \rightarrow C$ or $C \rightarrow B$, remove that path (if it exists), and add the path $A \rightarrow C \rightarrow B$ to $\mathcal{P}$ instead. Otherwise, $\mathcal{P}$ contains two paths of the forms $A \rightarrow C \rightarrow B$ and $A \rightarrow C \rightarrow B$, where $C \rightarrow B$ and $A \rightarrow C$ are some paths. In this case, we recombine the edges to form two new paths $A \rightarrow C \rightarrow B$ and $A \rightarrow C \rightarrow B$ (removing cycles from the latter if needed). Now we replace the old two paths in $\mathcal{P}$ with the two new ones.
After any operation described above, the number of paths in the collection does not decrease, and the collection remains diverse. Applying such operation to each $C \in \mathcal{A}$, we obtain the desired collection.
Back to the problem, assume, without loss of generality, that there is a road $A \rightarrow B$, and let $a$ and $b$ denote the numbers of roads going out from $A$ and $B$, respectively. Choose a diverse collection $\mathcal{P}$ consisting of $N_{A B}$ paths from $A$ to $B$. We will transform it into a diverse collection $\mathcal{Q}$ consisting of at least $N_{A B}+(b-a)$ paths from $B$ to $A$. This construction yields
whence $N_{B A}-N_{A B}=b-a$. This yields the desired equivalence. Apply the lemma to get a diverse collection $\mathcal{P}^{\prime}$ of at least $N_{A B}$ paths containing all $|\mathcal{A}|+1$ short paths from $A$ to $B$. Notice that the paths in $\mathcal{P}^{\prime}$ contain no edge of a short path from $B$ to $A$. Each non-short path in $\mathcal{P}^{\prime}$ has the form $A \rightarrow C \rightarrow D \rightarrow B$, where $C \rightarrow D$ is a path from some city $C \in \mathcal{I}$ to some city $D \in \mathcal{O}$. For each such path, put into $\mathcal{Q}$ the path $B \rightarrow C \longrightarrow D \rightarrow A$; also put into $\mathcal{Q}$ all short paths from $B$ to $A$. Clearly, the collection $\mathcal{Q}$ is diverse.
Now, all roads going out from $A$ end in the cities from $\mathcal{I} \cup \mathcal{A} \cup{B}$, while all roads going out from $B$ end in the cities from $\mathcal{I} \cup \mathcal{B}$. Therefore,
On the other hand, since there are $|\mathcal{A}|+1$ short paths from $A$ to $B$ (including $A \rightarrow B$ ) and $|\mathcal{B}|$ short paths from $B$ to $A$, we infer
as desired. Solution 2. We recall some graph-theoretical notions. Let $G$ be a finite graph, and let $V$ be the set of its vertices; fix two distinct vertices $s, t \in V$. An $(s, t)$-cut is a partition of $V$ into two parts $V=S \sqcup T$ such that $s \in S$ and $t \in T$. The cut-edges in the cut $(S, T)$ are the edges going from $S$ to $T$, and the size $e(S, T)$ of the cut is the number of cut-edges.
We will make use of the following theorem (which is a partial case of the Ford-Fulkerson "min-cut max-flow" theorem). Theorem (Menger). Let $G$ be a directed graph, and let $s$ and $t$ be its distinct vertices. Then the maximal number of edge-disjoint paths from $s$ to $t$ is equal to the minimal size of an $(s, t)$-cut.
Back to the problem. Consider a directed graph $G$ whose vertices are the cities, and edges correspond to the roads. Then $N_{A B}$ is the maximal number of edge-disjoint paths from $A$ to $B$ in this graph; the number $N_{B A}$ is interpreted similarly.
As in the previous solution, denote by $a$ and $b$ the out-degrees of vertices $A$ and $B$, respectively. To solve the problem, we show that for any $(A, B)$-cut $\left(S_{A}, T_{A}\right)$ in our graph there exists a $(B, A)$-cut $\left(S_{B}, T_{B}\right)$ satisfying
This yields
whence again $N_{B A}-N_{A B}=b-a$. The construction is simple: we put $S_{B}=S_{A} \cup{B} \backslash{A}$ and hence $T_{B}=T_{A} \cup{A} \backslash{B}$. To show that it works, let A and B denote the sets of cut-edges in $\left(S_{A}, T_{A}\right)$ and $\left(S_{B}, T_{B}\right)$, respectively. Let $a_{s}$ and $a_{t}=a-a_{s}$ denote the numbers of edges going from $A$ to $S_{A}$ and $T_{A}$, respectively. Similarly, denote by $b_{s}$ and $b_{t}=b-b_{s}$ the numbers of edges going from $B$ to $S_{B}$ and $T_{B}$, respectively.
Notice that any edge incident to none of $A$ and $B$ either belongs to both A and B , or belongs to none of them. Denote the number of such edges belonging to A by $c$. The edges in A which are not yet accounted for split into two categories: those going out from $A$ to $T_{A}$ (including $A \rightarrow B$ if it exists), and those going from $S_{A} \backslash{A}$ to $B$ - in other words, going from $S_{B}$ to $B$. The numbers of edges in the two categories are $a_{t}$ and $\left|S_{B}\right|-1-b_{s}$, respectively. Therefore,
and hence
since $\left|S_{A}\right|=\left|S_{B}\right|$. This finishes the solution.
C5. Let $n$ and $k$ be two integers with $n>k \geqslant 1$. There are $2 n+1$ students standing in a circle. Each student $S$ has $2 k$ neighbours - namely, the $k$ students closest to $S$ on the right, and the $k$ students closest to $S$ on the left.
Suppose that $n+1$ of the students are girls, and the other $n$ are boys. Prove that there is a girl with at least $k$ girls among her neighbours.
Solution. We replace the girls by 1's, and the boys by 0 's, getting the numbers $a_{1}, a_{2}, \ldots, a_{2 n+1}$ arranged in a circle. We extend this sequence periodically by letting $a_{2 n+1+k}=a_{k}$ for all $k \in \mathbb{Z}$. We get an infinite periodic sequence
Consider the numbers $b_{i}=a_{i}+a_{i-k-1}-1 \in{-1,0,1}$ for all $i \in \mathbb{Z}$. We know that
in particular, this yields that there exists some $i_{0}$ with $b_{i_{0}}=1$. Now we want to find an index $i$ such that
This will imply that $a_{i}=1$ and
as desired. Suppose, to the contrary, that for every index $i$ with $b_{i}=1$ the sum $b_{i+1}+b_{i+2}+\cdots+b_{i+k}$ is negative. We start from some index $i_{0}$ with $b_{i_{0}}=1$ and construct a sequence $i_{0}, i_{1}, i_{2}, \ldots$, where $i_{j}(j>0)$ is the smallest possible index such that $i_{j}>i_{j-1}+k$ and $b_{i_{j}}=1$. We can choose two numbers among $i_{0}, i_{1}, \ldots, i_{2 n+1}$ which are congruent modulo $2 n+1$ (without loss of generality, we may assume that these numbers are $i_{0}$ and $i_{T}$ ).
On the one hand, for every $j$ with $0 \leqslant j \leqslant T-1$ we have
since $b_{i_{j}+k+1}, \ldots, b_{i_{j+1}-1} \leqslant 0$. On the other hand, since $\left(i_{T}-i_{0}\right) \mid(2 n+1)$, from (1) we deduce
This contradiction finishes the solution. Comment 1. After the problem is reduced to finding an index $i$ satisfying (2), one can finish the solution by applying the (existence part of) following statement. Lemma (Raney). If $\left\langle x_{1}, x_{2}, \ldots, x_{m}\right\rangle$ is any sequence of integers whose sum is +1 , exactly one of the cyclic shifts $\left\langle x_{1}, x_{2}, \ldots, x_{m}\right\rangle,\left\langle x_{2}, \ldots, x_{m}, x_{1}\right\rangle, \ldots,\left\langle x_{m}, x_{1}, \ldots, x_{m-1}\right\rangle$ has all of its partial sums positive.
A (possibly wider known) version of this lemma, which also can be used in order to solve the problem, is the following Claim (Gas stations problem). Assume that there are several fuel stations located on a circular route which together contain just enough gas to make one trip around. Then one can make it all the way around, starting at the right station with an empty tank.
Both Raney's theorem and the Gas stations problem admit many different (parallel) proofs. Their ideas can be disguised in direct solutions of the problem at hand (as it, in fact, happens in the above solution); such solutions may avoid the introduction of the $b_{i}$. Below, in Comment 2 we present a variant of such solution, while in Comment 3 we present an alternative proof of Raney's theorem.
Comment 2. Here is a version of the solution which avoids the use of the $b_{i}$. Suppose the contrary. Introduce the numbers $a_{i}$ as above. Starting from any index $s_{0}$ with $a_{s_{0}}=1$, we construct a sequence $s_{0}, s_{1}, s_{2}, \ldots$ by letting $s_{i}$ to be the smallest index larger than $s_{i-1}+k$ such that $a_{s_{i}}=1$, for $i=1,2, \ldots$. Choose two indices among $s_{1}, \ldots, s_{2 n+1}$ which are congruent modulo $2 n+1$; we assume those two are $s_{0}$ and $s_{T}$, with $s_{T}-s_{0}=t(2 n+1)$. Notice here that $s_{T+1}-s_{T}=s_{1}-s_{0}$.
For every $i=0,1,2, \ldots, T$, put
Now, by the indirect assumption, for every $i=1,2, \ldots, T$, we have
Recall that $a_{j}=0$ for all $j$ with $s_{i}+k<j<a_{s_{i+1}}$. Therefore,
Summing up these equalities over $i=1,2, \ldots, T$ we get
which is a contradiction.
Comment 3. Here we present a proof of Raney's lemma different from the one used above.
If we plot the partial sums $s_{n}=x_{1}+\cdots+x_{n}$ as a function of $n$, the graph of $s_{n}$ has an average slope of $1 / m$, because $s_{m+n}=s_{n}+1$.

The entire graph can be contained between two lines of slope $1 / m$. In general these bounding lines touch the graph just once in each cycle of $m$ points, since lines of slope $1 / m$ hit points with integer coordinates only once per $m$ units. The unique (in one cycle) lower point of intersection is the only place in the cycle from which all partial sums will be positive.
Comment 4. The following example shows that for different values of $k$ the required girl may have different positions: 011001101.
C6. A hunter and an invisible rabbit play a game on an infinite square grid. First the hunter fixes a colouring of the cells with finitely many colours. The rabbit then secretly chooses a cell to start in. Every minute, the rabbit reports the colour of its current cell to the hunter, and then secretly moves to an adjacent cell that it has not visited before (two cells are adjacent if they share a side). The hunter wins if after some finite time either
- the rabbit cannot move; or
- the hunter can determine the cell in which the rabbit started.
Decide whether there exists a winning strategy for the hunter. Answer: Yes, there exists a colouring that yields a winning strategy for the hunter. Solution. A central idea is that several colourings $C_{1}, C_{2}, \ldots, C_{k}$ can be merged together into a single product colouring $C_{1} \times C_{2} \times \cdots \times C_{k}$ as follows: the colours in the product colouring are ordered tuples $\left(c_{1}, \ldots, c_{n}\right)$ of colours, where $c_{i}$ is a colour used in $C_{i}$, so that each cell gets a tuple consisting of its colours in the individual colourings $C_{i}$. This way, any information which can be determined from one of the individual colourings can also be determined from the product colouring.
Now let the hunter merge the following colourings:
- The first two colourings $C_{1}$ and $C_{2}$ allow the tracking of the horizontal and vertical movements of the rabbit. The colouring $C_{1}$ colours the cells according to the residue of their $x$-coordinates modulo 3 , which allows to determine whether the rabbit moves left, moves right, or moves vertically. Similarly, the colouring $C_{2}$ uses the residues of the $y$-coordinates modulo 3, which allows to determine whether the rabbit moves up, moves down, or moves horizontally.
- Under the condition that the rabbit's $x$-coordinate is unbounded, colouring $C_{3}$ allows to determine the exact value of the $x$-coordinate: In $C_{3}$, the columns are coloured white and black so that the gaps between neighboring black columns are pairwise distinct. As the rabbit's $x$-coordinate is unbounded, it will eventually visit two black cells in distinct columns. With the help of colouring $C_{1}$ the hunter can catch that moment, and determine the difference of $x$-coordinates of those two black cells, hence deducing the precise column. Symmetrically, under the condition that the rabbit's $y$-coordinate is unbounded, there is a colouring $C_{4}$ that allows the hunter to determine the exact value of the $y$-coordinate.
- Finally, under the condition that the sum $x+y$ of the rabbit's coordinates is unbounded, colouring $C_{5}$ allows to determine the exact value of this sum: The diagonal lines $x+y=$ const are coloured black and white, so that the gaps between neighboring black diagonals are pairwise distinct.
Unless the rabbit gets stuck, at least two of the three values $x, y$ and $x+y$ must be unbounded as the rabbit keeps moving. Hence the hunter can eventually determine two of these three values; thus he does know all three. Finally the hunter works backwards with help of the colourings $C_{1}$ and $C_{2}$ and computes the starting cell of the rabbit.
Comment. There are some variations of the solution above: e.g., the colourings $C_{3}, C_{4}$ and $C_{5}$ can be replaced with different ones. However, such alternatives are more technically involved, and we do not present them here.
C7. Consider a checkered $3 m \times 3 m$ square, where $m$ is an integer greater than 1. A frog sits on the lower left corner cell $S$ and wants to get to the upper right corner cell $F$. The frog can hop from any cell to either the next cell to the right or the next cell upwards.
Some cells can be sticky, and the frog gets trapped once it hops on such a cell. A set $X$ of cells is called blocking if the frog cannot reach $F$ from $S$ when all the cells of $X$ are sticky. A blocking set is minimal if it does not contain a smaller blocking set. (a) Prove that there exists a minimal blocking set containing at least $3 m^{2}-3 m$ cells. (b) Prove that every minimal blocking set contains at most $3 m^{2}$ cells.
Note. An example of a minimal blocking set for $m=2$ is shown below. Cells of the set $X$ are marked by letters $x$.
| $F$ | |||||
|---|---|---|---|---|---|
| $x$ | $x$ | ||||
| $x$ | |||||
| $x$ | |||||
| $x$ | |||||
| $S$ | $x$ |
Solution for part (a). In the following example the square is divided into $m$ stripes of size $3 \times 3 \mathrm{~m}$. It is easy to see that $X$ is a minimal blocking set. The first and the last stripe each contains $3 m-1$ cells from the set $X$; every other stripe contains $3 m-2$ cells, see Figure 1 . The total number of cells in the set $X$ is $3 m^{2}-2 m+2$.

Figure 1 Solution 1 for part (b). For a given blocking set $X$, say that a non-sticky cell is red if the frog can reach it from $S$ via some hops without entering set $X$. We call a non-sticky cell blue if the frog can reach $F$ from that cell via hops without entering set $X$. One can regard the blue cells as those reachable from $F$ by anti-hops, i.e. moves downwards and to the left. We also colour all cells in $X$ green. It follows from the definition of the blocking set that no cell will be coloured twice. In Figure 2 we show a sample of a blocking set and the corresponding colouring.
Now assume that $X$ is a minimal blocking set. We denote by $R$ (resp., $B$ and $G$ ) be the total number of red (resp., blue and green) cells.
We claim that $G \leqslant R+1$ and $G \leqslant B+1$. Indeed, there are at most $2 R$ possible frog hops from red cells. Every green or red cell (except for $S$ ) is accessible by such hops. Hence $2 R \geqslant G+(R-1)$, or equivalently $G \leqslant R+1$. In order to prove the inequality $G \leqslant B+1$, we turn over the board and apply the similar arguments.
Therefore we get $9 m^{2} \geqslant B+R+G \geqslant 3 G-2$, so $G \leqslant 3 m^{2}$.
| $x$ | |||||||
|---|---|---|---|---|---|---|---|
| $x$ | $x$ | $x$ | |||||
| $x$ | $x$ | $x$ | |||||
| $x$ | $x$ | $x$ | |||||
| $x$ | $x$ | $x$ | |||||
| $x$ | $x$ | $x$ | |||||
| $x$ | $x$ | $x$ | |||||
| $x$ | $x$ | $x$ | |||||
| $S$ |
Figure 2 (b)
Solution 2 for part (b). We shall use the same colouring as in the above solution. Again, assume that $X$ is a minimal blocking set.
Note that any $2 \times 2$ square cannot contain more than 2 green cells. Indeed, on Figure 3(a) the cell marked with "?" does not block any path, while on Figure 3(b) the cell marked with "?" should be coloured red and blue simultaneously. So we can split all green cells into chains consisting of three types of links shown on Figure 4 (diagonal link in the other direction is not allowed, corresponding green cells must belong to different chains). For example, there are 3 chains in Figure 2(b).

Figure 5
We will inscribe green chains in disjoint axis-aligned rectangles so that the number of green cells in each rectangle will not exceed $1 / 3$ of the area of the rectangle. This will give us the bound $G \leqslant 3 \mathrm{~m}^{2}$. Sometimes the rectangle will be the minimal bounding rectangle of the chain, sometimes minimal bounding rectangles will be expanded in one or two directions in order to have sufficiently large area.
Note that for any two consecutive cells in the chain the colouring of some neighbouring cells is uniquely defined (see Figure 5). In particular, this observation gives a corresponding rectangle for the chains of height (or width) 1 (see Figure 6(a)). A separate green cell can be inscribed in $1 \times 3$ or $3 \times 1$ rectangle with one red and one blue cell, see Figure 6(b)-(c), otherwise we get one of impossible configurations shown in Figure 3.

Figure 6 Figure 7 Any diagonal chain of length 2 is always inscribed in a $2 \times 3$ or $3 \times 2$ rectangle without another green cells. Indeed, one of the squares marked with "?" in Figure 7(a) must be red. If it is the bottom question mark, then the remaining cell in the corresponding $2 \times 3$ rectangle must have the same colour, see Figure 7(b).
A longer chain of height (or width) 2 always has a horizontal (resp., vertical) link and can be inscribed into a $3 \times a$ rectangle. In this case we expand the minimal bounding rectangle across the long side which touches the mentioned link. On Figure 8(a) the corresponding expansion of the minimal bounding rectangle is coloured in light blue. The upper right corner cell must be also blue. Indeed it cannot be red or green. If it is not coloured in blue, see Figure 8(b), then all anti-hop paths from $F$ to "?" are blocked with green cells. And these green cells are surrounded by blue ones, what is impossible. In this case the green chain contains $a$ cells, which is exactly $1 / 3$ of the area of the rectangle.

Figure 8 (b)
In the remaining case the minimal bounding rectangle of the chain is of size $a \times b$ where $a, b \geqslant 3$. Denote by $\ell$ the length of the chain (i.e. the number of cells in the chain).
If the chain has at least two diagonal links (see Figure 9), then $\ell \leqslant a+b-3 \leqslant a b / 3$. If the chain has only one diagonal link then $\ell=a+b-2$. In this case the chain has horizontal and vertical end-links, and we expand the minimal bounding rectangle in two directions to get an $(a+1) \times(b+1)$ rectangle. On Figure 10 a corresponding expansion of the minimal bounding rectangle is coloured in light red. Again the length of the chain does not exceed $1 / 3$ of the rectangle's area: $\ell \leqslant a+b-2 \leqslant(a+1)(b+1) / 3$.
On the next step we will use the following statement: all cells in constructed rectangles are coloured red, green or blue (the cells upwards and to the right of green cells are blue; the cells downwards and to the left of green cells are red). The proof repeats the same arguments as before (see Figure 8(b).)

Figure 11 Note that all constructed rectangles are disjoint. Indeed, assume that two rectangles have a common cell. Using the above statement, one can see that the only such cell can be a common corner cell, as shown in Figure 11. Moreover, in this case both rectangles should be expanded, otherwise they would share a green corner cell.
If they were expanded along the same axis (see Figure 11(a)), then again the common corner cannot be coloured correctly. If they were expanded along different axes (see Figure 11(b)) then the two chains have a common point and must be connected in one chain. (These arguments work for $2 \times 3$ and $1 \times 3$ rectangles in a similar manner.)
Comment 1. We do not a priori know whether all points are either red, or blue, or green. One might colour the remaining cells in black. The arguments from Solution 2 allow to prove that black cells do not exist. (One can start with a black cell which is nearest to $S$. Its left and downward neighbours must be coloured green or blue. In all cases one gets a configuration similar to Figure 8(b).)
Comment 2. The maximal possible size of a minimal blocking set in $3 m \times 3 m$ rectangle seems to be $3 m^{2}-2 m+2$.
One can prove a more precise upper bound on the cardinality of the minimal blocking set: $G \leqslant$ $3 m^{2}-m+2$. Denote by $D_{R}$ the number of red branching cells (i.e. such cells which have 2 red subsequent neighbours). And let $D_{B}$ be the number of similar blue cells. Then a double counting argument allows to prove that $G \leqslant R-D_{R}+1$ and $G \leqslant B-D_{B}+1$. Thus, we can bound $G$ in terms of $D_{B}$ and $D_{R}$ as
Now one can estimate the number of branching cells in order to obtain that $G \leqslant 3 m^{2}-m+2$.
Comment 3. An example with $3 m^{2}-2 m+2$ green cells may look differently; see, e.g., Figure 12.

Figure 12
C8. Determine the largest $N$ for which there exists a table $T$ of integers with $N$ rows and 100 columns that has the following properties: (i) Every row contains the numbers $1,2, \ldots, 100$ in some order. (ii) For any two distinct rows $r$ and $s$, there is a column $c$ such that $|T(r, c)-T(s, c)| \geqslant 2$.
Here $T(r, c)$ means the number at the intersection of the row $r$ and the column $c$. Answer: The largest such integer is $N=100!/ 2^{50}$.
Solution 1.
Non-existence of a larger table. Let us consider some fixed row in the table, and let us replace (for $k=1,2, \ldots, 50$ ) each of two numbers $2 k-1$ and $2 k$ respectively by the symbol $x_{k}$. The resulting pattern is an arrangement of 50 symbols $x_{1}, x_{2}, \ldots, x_{50}$, where every symbol occurs exactly twice. Note that there are $N=100!/ 2^{50}$ distinct patterns $P_{1}, \ldots, P_{N}$.
If two rows $r \neq s$ in the table have the same pattern $P_{i}$, then $|T(r, c)-T(s, c)| \leqslant 1$ holds for all columns $c$. As this violates property (ii) in the problem statement, different rows have different patterns. Hence there are at most $N=100!/ 2^{50}$ rows.
Existence of a table with $N$ rows. We construct the table by translating every pattern $P_{i}$ into a corresponding row with the numbers $1,2, \ldots, 100$. We present a procedure that inductively replaces the symbols by numbers. The translation goes through steps $k=1,2, \ldots, 50$ in increasing order and at step $k$ replaces the two occurrences of symbol $x_{k}$ by $2 k-1$ and $2 k$.
- The left occurrence of $x_{1}$ is replaced by 1 , and its right occurrence is replaced by 2.
- For $k \geqslant 2$, we already have the number $2 k-2$ somewhere in the row, and now we are looking for the places for $2 k-1$ and $2 k$. We make the three numbers $2 k-2,2 k-1,2 k$ show up (ordered from left to right) either in the order $2 k-2,2 k-1,2 k$, or as $2 k, 2 k-2,2 k-1$, or as $2 k-1,2 k, 2 k-2$. This is possible, since the number $2 k-2$ has been placed in the preceding step, and shows up before / between / after the two occurrences of the symbol $x_{k}$. We claim that the $N$ rows that result from the $N$ patterns yield a table with the desired property (ii). Indeed, consider the $r$-th and the $s$-th row ( $r \neq s$ ), which by construction result from patterns $P_{r}$ and $P_{s}$. Call a symbol $x_{i}$ aligned, if it occurs in the same two columns in $P_{r}$ and in $P_{s}$. Let $k$ be the largest index, for which symbol $x_{k}$ is not aligned. Note that $k \geqslant 2$. Consider the column $c^{\prime}$ with $T\left(r, c^{\prime}\right)=2 k$ and the column $c^{\prime \prime}$ with $T\left(s, c^{\prime \prime}\right)=2 k$. Then $T\left(r, c^{\prime \prime}\right) \leqslant 2 k$ and $T\left(s, c^{\prime}\right) \leqslant 2 k$, as all symbols $x_{i}$ with $i \geqslant k+1$ are aligned.
- If $T\left(r, c^{\prime \prime}\right) \leqslant 2 k-2$, then $\left|T\left(r, c^{\prime \prime}\right)-T\left(s, c^{\prime \prime}\right)\right| \geqslant 2$ as desired.
- If $T\left(s, c^{\prime}\right) \leqslant 2 k-2$, then $\left|T\left(r, c^{\prime}\right)-T\left(s, c^{\prime}\right)\right| \geqslant 2$ as desired.
- If $T\left(r, c^{\prime \prime}\right)=2 k-1$ and $T\left(s, c^{\prime}\right)=2 k-1$, then the symbol $x_{k}$ is aligned; contradiction.
In the only remaining case we have $c^{\prime}=c^{\prime \prime}$, so that $T\left(r, c^{\prime}\right)=T\left(s, c^{\prime}\right)=2 k$ holds. Now let us consider the columns $d^{\prime}$ and $d^{\prime \prime}$ with $T\left(r, d^{\prime}\right)=2 k-1$ and $T\left(s, d^{\prime \prime}\right)=2 k-1$. Then $d \neq d^{\prime \prime}$ (as the symbol $x_{k}$ is not aligned), and $T\left(r, d^{\prime \prime}\right) \leqslant 2 k-2$ and $T\left(s, d^{\prime}\right) \leqslant 2 k-2$ (as all symbols $x_{i}$ with $i \geqslant k+1$ are aligned).
- If $T\left(r, d^{\prime \prime}\right) \leqslant 2 k-3$, then $\left|T\left(r, d^{\prime \prime}\right)-T\left(s, d^{\prime \prime}\right)\right| \geqslant 2$ as desired.
- If $T\left(s, c^{\prime}\right) \leqslant 2 k-3$, then $\left|T\left(r, d^{\prime}\right)-T\left(s, d^{\prime}\right)\right| \geqslant 2$ as desired.
In the only remaining case we have $T\left(r, d^{\prime \prime}\right)=2 k-2$ and $T\left(s, d^{\prime}\right)=2 k-2$. Now the row $r$ has the numbers $2 k-2,2 k-1,2 k$ in the three columns $d^{\prime}, d^{\prime \prime}, c^{\prime}$. As one of these triples violates the ordering property of $2 k-2,2 k-1,2 k$, we have the final contradiction.
Comment 1. We can identify rows of the table $T$ with permutations of $\mathcal{M}:={1, \ldots, 100}$; also for every set $S \subset \mathcal{M}$ each row induces a subpermutation of $S$ obtained by ignoring all entries not from $S$.
The example from Solution 1 consists of all permutations for which all subpermutations of the 50 sets ${1,2},{2,3,4},{4,5,6}, \ldots,{98,99,100}$ are even.
Solution 2. We provide a bit different proof why the example from Solution 1 (see also Comment 1) works. Lemma. Let $\pi_{1}$ and $\pi_{2}$ be two permutations of the set ${1,2, \ldots, n}$ such that $\left|\pi_{1}(i)-\pi_{2}(i)\right| \leqslant 1$ for every $i$. Then there exists a set of disjoint pairs $(i, i+1)$ such that $\pi_{2}$ is obtained from $\pi_{1}$ by swapping elements in each pair from the set. Proof. We may assume that $\pi_{1}(i)=i$ for every $i$ and proceed by induction on $n$. The case $n=1$ is trivial. If $\pi_{2}(n)=n$, we simply apply the induction hypothesis. If $\pi_{2}(n)=n-1$, then $\pi_{2}(i)=n$ for some $i<n$. It is clear that $i=n-1$, and we can also use the induction hypothesis.
Now let $\pi_{1}$ and $\pi_{2}$ be two rows (which we identify with permutations of ${1,2, \ldots, 100}$ ) of the table constructed in Solution 1. Assume that $\left|\pi_{1}(i)-\pi_{2}(i)\right| \leqslant 1$ for any $i$. From the Lemma it follows that there exists a set $S \subset{1, \ldots, 99}$ such that any two numbers from $S$ differ by at least 2 and $\pi_{2}$ is obtained from $\pi_{1}$ by applying the permutations $(j, j+1)$, $j \in S$. Let $r=\min (S)$. If $r=2 k-1$ is odd, then $\pi_{1}$ and $\pi_{2}$ induce two subpermutations of ${2 k-2,2 k-1,2 k}$ (or of ${1,2}$ for $k=1$ ) of opposite parities. Thus $r=2 k$ is even. Since $\pi_{1}$ and $\pi_{2}$ induce subpermutations of the same (even) parity of ${2 k, 2 k+1,2 k+2}$, we must have $2 k+2 \in S$. Next, $2 k+4 \in S$ and so on, we get $98 \in S$, but then the parities of the subpermutations of ${98,99,100}$ in $\pi_{1}, \pi_{2}$ are opposite. A contradiction.
Comment 2. In Solution 2 we only used that for each set from ${1,2},{2,3,4},{4,5,6}, \ldots,{98,99,100}$ any two rows of $T$ induce a subpermutation of the same parity, not necessarily even.
This page is intentionally left blank
Geometry
G1. Let $A B C D$ be a parallelogram such that $A C=B C$. A point $P$ is chosen on the extension of the segment $A B$ beyond $B$. The circumcircle of the triangle $A C D$ meets the segment $P D$ again at $Q$, and the circumcircle of the triangle $A P Q$ meets the segment $P C$ again at $R$. Prove that the lines $C D, A Q$, and $B R$ are concurrent.
Common remarks. The introductory steps presented here are used in all solutions below. Since $A C=B C=A D$, we have $\angle A B C=\angle B A C=\angle A C D=\angle A D C$. Since the quadrilaterals $A P R Q$ and $A Q C D$ are cyclic, we obtain
so the points $A, B, C$, and $R$ lie on some circle $\gamma$. Solution 1. Introduce the point $X=A Q \cap C D$; we need to prove that $B, R$ and $X$ are collinear.
By means of the circle $(A P R Q)$ we have
(the last equality holds in view of $A B | C D$ ), which means that the points $C, Q, R$, and $X$ also lie on some circle $\delta$.
Using the circles $\delta$ and $\gamma$ we finally obtain
that proves the desired collinearity.

Solution 2. Let $\alpha$ denote the circle ( $A P R Q)$. Since
the line $A C$ is tangent to $\alpha$. Now, let $A D$ meet $\alpha$ again at a point $Y$ (which necessarily lies on the extension of $D A$ beyond $A$ ). Using the circle $\gamma$, along with the fact that $A C$ is tangent to $\alpha$, we have
so the points $Y, B$, and $R$ are collinear. Applying Pascal's theorem to the hexagon $A A Y R P Q$ (where $A A$ is regarded as the tangent to $\alpha$ at $A$ ), we see that the points $A A \cap R P=C, A Y \cap P Q=D$, and $Y R \cap Q A$ are collinear. Hence the lines $C D, A Q$, and $B R$ are concurrent.
Comment 1. Solution 2 consists of two parts: (1) showing that $B R$ and $D A$ meet on $\alpha$; and (2) showing that this yields the desired concurrency. Solution 3 also splits into those parts, but the proofs are different.

Solution 3. As in Solution 1, we introduce the point $X=A Q \cap C D$ and aim at proving that the points $B, R$, and $X$ are collinear. As in Solution 2, we denote $\alpha=(A P Q R)$; but now we define $Y$ to be the second meeting point of $R B$ with $\alpha$.
Using the circle $\alpha$ and noticing that $C D$ is tangent to $\gamma$, we obtain
So $A Y | B C$, and hence $Y$ lies on $D A$. Now the chain of equalities (1) shows also that $\angle R Y D=\angle R C X$, which implies that the points $C, D, Y$, and $R$ lie on some circle $\beta$. Hence, the lines $C D, A Q$, and $Y B R$ are the pairwise radical axes of the circles $(A Q C D), \alpha$, and $\beta$, so those lines are concurrent.
Comment 2. The original problem submission contained an additional assumption that $B P=A B$. The Problem Selection Committee removed this assumption as superfluous.
G2. Let $A B C D$ be a convex quadrilateral circumscribed around a circle with centre $I$. Let $\omega$ be the circumcircle of the triangle $A C I$. The extensions of $B A$ and $B C$ beyond $A$ and $C$ meet $\omega$ at $X$ and $Z$, respectively. The extensions of $A D$ and $C D$ beyond $D$ meet $\omega$ at $Y$ and $T$, respectively. Prove that the perimeters of the (possibly self-intersecting) quadrilaterals $A D T X$ and $C D Y Z$ are equal.
Solution. The point $I$ is the intersection of the external bisector of the angle $T C Z$ with the circumcircle $\omega$ of the triangle $T C Z$, so $I$ is the midpoint of the $\operatorname{arc} T C Z$ and $I T=I Z$. Similarly, $I$ is the midpoint of the arc $Y A X$ and $I X=I Y$. Let $O$ be the centre of $\omega$. Then $X$ and $T$ are the reflections of $Y$ and $Z$ in $I O$, respectively. So $X T=Y Z$.

Let the incircle of $A B C D$ touch $A B, B C, C D$, and $D A$ at points $P, Q, R$, and $S$, respectively.
The right triangles $I X P$ and $I Y S$ are congruent, since $I P=I S$ and $I X=I Y$. Similarly, the right triangles $I R T$ and $I Q Z$ are congruent. Therefore, $X P=Y S$ and $R T=Q Z$.
Denote the perimeters of $A D T X$ and $C D Y Z$ by $P_{A D T X}$ and $P_{C D Y Z}$ respectively. Since $A S=A P, C Q=R C$, and $S D=D R$, we obtain
as required. Comment 1. After proving that $X$ and $T$ are the reflections of $Y$ and $Z$ in $I O$, respectively, one can finish the solution as follows. Since $X T=Y Z$, the problem statement is equivalent to
Since $A B C D$ is circumscribed, $A B-A D=B C-C D$. Adding this to (1), we come to an equivalent equality $X A+A B+D T=Y D+B C+C Z$, or
Let $\lambda=\frac{X Z}{A C}=\frac{T Y}{A C}$. Since $X A C Z$ is cyclic, the triangles $Z B X$ and $A B C$ are similar, hence
It follows that $X B=\lambda B C$ and $B Z=\lambda A B$. Likewise, the triangles $T D Y$ and $A D C$ are similar, hence
Therefore, (2) rewrites as $\lambda B C+\lambda A D=\lambda C D+\lambda A B$. This is equivalent to $B C+A D=C D+A B$ which is true as $A B C D$ is circumscribed. Comment 2. Here is a more difficult modification of the original problem, found by the PSC. Let $A B C D$ be a convex quadrilateral circumscribed around a circle with centre $I$. Let $\omega$ be the circumcircle of the triangle $A C I$. The extensions of $B A$ and $B C$ beyond $A$ and $C$ meet $\omega$ at $X$ and $Z$, respectively. The extensions of $A D$ and $C D$ beyond $D$ meet $\omega$ at $Y$ and $T$, respectively. Let $U=B C \cap A D$ and $V=B A \cap C D$. Let $I_{U}$ be the incentre of $U Y Z$ and let $J_{V}$ be the $V$-excentre of $V X T$. Then $I_{U} J_{V} \perp B D$.
G3.
Version 1. Let $n$ be a fixed positive integer, and let S be the set of points $(x, y)$ on the Cartesian plane such that both coordinates $x$ and $y$ are nonnegative integers smaller than $2 n$ (thus $|\mathrm{S}|=4 n^{2}$ ). Assume that $\mathcal{F}$ is a set consisting of $n^{2}$ quadrilaterals such that all their vertices lie in $S$, and each point in $S$ is a vertex of exactly one of the quadrilaterals in $\mathcal{F}$.
Determine the largest possible sum of areas of all $n^{2}$ quadrilaterals in $\mathcal{F}$. Version 2. Let $n$ be a fixed positive integer, and let $\mathbf{S}$ be the set of points $(x, y)$ on the Cartesian plane such that both coordinates $x$ and $y$ are nonnegative integers smaller than $2 n$ (thus $|\mathrm{S}|=4 n^{2}$ ). Assume that $\mathcal{F}$ is a set of polygons such that all vertices of polygons in $\mathcal{F}$ lie in S , and each point in S is a vertex of exactly one of the polygons in $\mathcal{F}$.
Determine the largest possible sum of areas of all polygons in $\mathcal{F}$. Answer for both Versions: The largest possible sum of areas is $\Sigma(n):=\frac{1}{3} n^{2}(2 n+1)(2 n-1)$. Common remarks. Throughout all solutions, the area of a polygon $P$ will be denoted by $[P]$. We say that a polygon is legal if all its vertices belong to S . Let $O=\left(n-\frac{1}{2}, n-\frac{1}{2}\right)$ be the centre of S . We say that a legal square is central if its centre is situated at $O$. Finally, say that a set $\mathcal{F}$ of polygons is acceptable if it satisfies the problem requirements, i.e. if all polygons in $\mathcal{F}$ are legal, and each point in $S$ is a vertex of exactly one polygon in $\mathcal{F}$. For an acceptable set $\mathcal{F}$, we denote by $\Sigma(\mathcal{F})$ the sum of areas of polygons in $\mathcal{F}$.
Solution 1, for both Versions. Each point in $S$ is a vertex of a unique central square. Thus the set $\mathcal{G}$ of central squares is acceptable. We will show that
thus establishing the answer. We will use the following key lemma. Lemma 1. Let $P=A_{1} A_{2} \ldots A_{m}$ be a polygon, and let $O$ be an arbitrary point in the plane. Then
moreover, if $P$ is a square centred at $O$, then the inequality (2) turns into an equality. Proof. Put $A_{n+1}=A_{1}$. For each $i=1,2, \ldots, m$, we have
Therefore,
which proves (2). Finally, all the above inequalities turn into equalities when $P$ is a square centred at $O$.
Back to the problem, consider an arbitrary acceptable set $\mathcal{F}$. Applying Lemma 1 to each element in $\mathcal{F}$ and to each element in $\mathcal{G}$ (achieving equality in the latter case), we obtain
which establishes the left inequality in (1).
It remains to compute $\Sigma(\mathcal{G})$. We have
Comment. There are several variations of the above solution, also working for both versions of the problem. E.g., one may implement only the inequality $\left[O A_{i} A_{i+1}\right] \leqslant \frac{1}{2} O A_{i} \cdot O A_{i+1}$ to obtain
where both $\left(K_{i}\right)$ and $\left(L_{i}\right)$ are permutations of all points in S . The right hand side can then be bounded from above by means of the rearrangement inequality; the bound is also achieved on the collection $\mathcal{G}$.
However, Version 2 seems to be more difficult than Version 1. First of all, the optimal model for this version is much less easy to guess, until one finds an idea for proving the upper bound. Moreover, Version 1 allows different solutions which do not seem to be generalized easily - such as Solution 2 below.
Solution 2, for Version 1. Let $\mathcal{F}$ be an accessible set of quadrilaterals. For every quadrilateral $A B C D$ in $\mathcal{F}$ write
where $\phi$ is the angle between $A C$ and $B D$. Applying this estimate to all members in $\mathcal{F}$ we obtain
where $A_{1}, A_{2}, \ldots, A_{2 n^{2}}, B_{1}, B_{2}, \ldots, B_{2 n^{2}}$ is some permutation of S . For brevity, denote
The rest of the solution is based on the following lemma. Lemma 2. The maximal value of $f\left(\left(A_{i}\right),\left(B_{i}\right)\right)$ over all permutations of $S$ equals $\frac{4}{3} n^{2}\left(4 n^{2}-1\right)$ and is achieved when $A_{i}$ is symmetric to $B_{i}$ with respect to $O$, for every $i=1,2, \ldots, 2 n^{2}$. Proof. Let $A_{i}=\left(p_{i}, q_{i}\right)$ and $B_{i}=\left(r_{i}, s_{i}\right)$, for $i=1,2, \ldots, 2 n^{2}$. We have
it suffices to bound the first sum, the second is bounded similarly. This can be done, e.g., by means of the QM-AM inequality as follows:
All the estimates are sharp if $p_{i}+r_{i}=2 n-1$ for all $i$. Thus,
and the estimate is sharp when $p_{i}+r_{i}=q_{i}+s_{i}=2 n-1$ for all $i$, i.e. when $A_{i}$ and $B_{i}$ are symmetric with respect to $O$.
Lemma 2 yields
Finally, all estimates are achieved simultaneously on the set $\mathcal{G}$ of central squares. Comment 2. Lemma 2 also allows different proofs. E.g., one may optimize the sum $\sum_{i} p_{i} r_{i}$ step by step: if $p_{i}<p_{j}$ and $r_{i}<r_{j}$, then a swap $r_{i} \leftrightarrow r_{j}$ increases the sum. By applying a proper chain of such replacements (possibly swapping elements in some pairs ( $\left.p_{i}, r_{i}\right)$ ), one eventually comes to a permutation where $p_{i}+r_{i}=2 n-1$ for all $i$.
Comment 3. Version 2 can also be considered for a square grid with odd number $n$ of points on each side. If we allow a polygon consisting of one point, then Solution 1 is applied verbatim, providing an answer $\frac{1}{12} n^{2}\left(n^{2}-1\right)$. If such polygons are not allowed, then one needs to subtract $\frac{1}{2}$ from the answer.
G4. Let $A B C D$ be a quadrilateral inscribed in a circle $\Omega$. Let the tangent to $\Omega$ at $D$ intersect the rays $B A$ and $B C$ at points $E$ and $F$, respectively. A point $T$ is chosen inside the triangle $A B C$ so that $T E | C D$ and $T F | A D$. Let $K \neq D$ be a point on the segment $D F$ such that $T D=T K$. Prove that the lines $A C, D T$ and $B K$ intersect at one point.
Solution 1. Let the segments $T E$ and $T F$ cross $A C$ at $P$ and $Q$, respectively. Since $P E | C D$ and $E D$ is tangent to the circumcircle of $A B C D$, we have
and so the points $A, P, D$, and $E$ lie on some circle $\alpha$. Similarly, the points $C, Q, D$, and $F$ lie on some circle $\gamma$.
We now want to prove that the line $D T$ is tangent to both $\alpha$ and $\gamma$ at $D$. Indeed, since $\angle F C D+\angle E A D=180^{\circ}$, the circles $\alpha$ and $\gamma$ are tangent to each other at $D$. To prove that $T$ lies on their common tangent line at $D$ (i.e., on their radical axis), it suffices to check that $T P \cdot T E=T Q \cdot T F$, or that the quadrilateral $P E F Q$ is cyclic. This fact follows from
Since $T D=T K$, we have $\angle T K D=\angle T D K$. Next, as $T D$ and $D E$ are tangent to $\alpha$ and $\Omega$, respectively, we obtain
which implies $T K | B D$. Next we prove that the five points $T, P, Q, D$, and $K$ lie on some circle $\tau$. Indeed, since $T D$ is tangent to the circle $\alpha$ we have
which means that the point $P$ lies on the circle (TDK). Similarly, we have $Q \in(T D K)$. Finally, we prove that $P K | B C$. Indeed, using the circles $\tau$ and $\gamma$ we conclude that
which means that $P K | B C$.
Triangles $T P K$ and $D C B$ have pairwise parallel sides, which implies the fact that $T D, P C$ and $K B$ are concurrent, as desired.

Comment 1. There are several variations of the above solution. E.g., after finding circles $\alpha$ and $\gamma$, one can notice that there exists a homothety $h$ mapping the triangle $T P Q$ to the triangle $D C A$; the centre of that homothety is $Y=A C \cap T D$. Since
the quadrilateral $T P D Q$ is inscribed in some circle $\tau$. We have $h(\tau)=\Omega$, so the point $D^{*}=h(D)$ lies on $\Omega$.
Finally, by
the points $B$ and $D^{}$ are symmetric with respect to the diameter of $\Omega$ passing through $D$. This yields $D B=D D^{}$ and $B D^{*} | E F$, so $h(K)=B$, and $B K$ passes through $Y$.
Solution 2. Consider the spiral similarity $\phi$ centred at $D$ which maps $B$ to $F$. Recall that for any two points $X$ and $Y$, the triangles $D X \phi(X)$ and $D Y \phi(Y)$ are similar.
Define $T^{\prime}=\phi(E)$. Then
so $C D | T^{\prime} E$. Using the fact that $D E$ is tangent to $(A B D)$ and then applying $\phi$ we infer
so $A D | T^{\prime} F$; hence $T^{\prime}$ coincides with $T$. Therefore,
whence $T K | B D$. Let $B K \cap T D=X, A C \cap T D=Y$, and $A C \cap T F=Q$. Notice that $T K | B D$ implies
So we wish to prove that $\frac{T Y}{Y D}$ is equal to the same ratio. We first show that $\phi(A)=Q$. Indeed,
and so $\phi(A) \in A C$. Together with $\phi(A) \in \phi(E B)=T F$ this yields $\phi(A)=Q$. It follows that
Now, since $T F | A D$ and $\triangle E A D \sim \triangle E D B$, we have
which completes the proof. Comment 2. The point $D$ is the Miquel point for any 4 of the 5 lines $B A, B C, T E, T F$ and $A C$. Essentially, this is proved in both solutions by different methods.
G5. Let $A B C D$ be a cyclic quadrilateral whose sides have pairwise different lengths. Let $O$ be the circumcentre of $A B C D$. The internal angle bisectors of $\angle A B C$ and $\angle A D C$ meet $A C$ at $B_{1}$ and $D_{1}$, respectively. Let $O_{B}$ be the centre of the circle which passes through $B$ and is tangent to $A C$ at $D_{1}$. Similarly, let $O_{D}$ be the centre of the circle which passes through $D$ and is tangent to $A C$ at $B_{1}$.
Assume that $B D_{1} | D B_{1}$. Prove that $O$ lies on the line $O_{B} O_{D}$. Common remarks. We introduce some objects and establish some preliminary facts common for all solutions below.
Let $\Omega$ denote the circle $(A B C D)$, and let $\gamma_{B}$ and $\gamma_{D}$ denote the two circles from the problem statement (their centres are $O_{B}$ and $O_{D}$, respectively). Clearly, all three centres $O, O_{B}$, and $O_{D}$ are distinct.
Assume, without loss of generality, that $A B>B C$. Suppose that $A D>D C$, and let $H=A C \cap B D$. Then the rays $B B_{1}$ and $D D_{1}$ lie on one side of $B D$, as they contain the midpoints of the arcs $A D C$ and $A B C$, respectively. However, if $B D_{1} | D B_{1}$, then $B_{1}$ and $D_{1}$ should be separated by $H$. This contradiction shows that $A D<C D$.
Let $\gamma_{B}$ and $\gamma_{D}$ meet $\Omega$ again at $T_{B}$ and $T_{D}$, respectively. The common chord $B T_{B}$ of $\Omega$ and $\gamma_{B}$ is perpendicular to their line of centres $O_{B} O$; likewise, $D T_{D} \perp O_{D} O$. Therefore, $O \in O_{B} O_{D} \Longleftrightarrow O_{B} O\left|O_{D} O \Longleftrightarrow B T_{B}\right|$ $D T_{D}$, and the problem reduces to showing that

Comment 1. It seems that the discussion of the positions of points is necessary for both Solutions below. However, this part automatically follows from the angle chasing in Comment 2.
Solution 1. Let the diagonals $A C$ and $B D$ cross at $H$. Consider the homothety $h$ centred at $H$ and mapping $B$ to $D$. Since $B D_{1} | D B_{1}$, we have $h\left(D_{1}\right)=B_{1}$.
Let the tangents to $\Omega$ at $B$ and $D$ meet $A C$ at $L_{B}$ and $L_{D}$, respectively. We have
which means that the triangle $L_{B} B B_{1}$ is isosceles, $L_{B} B=L_{B} B_{1}$. The powers of $L_{B}$ with respect to $\Omega$ and $\gamma_{D}$ are $L_{B} B^{2}$ and $L_{B} B_{1}^{2}$, respectively; so they are equal, whence $L_{B}$ lies on the radical axis $T_{D} D$ of those two circles. Similarly, $L_{D}$ lies on the radical axis $T_{B} B$ of $\Omega$ and $\gamma_{B}$.
By the sine rule in the triangle $B H L_{B}$, we obtain
similarly,
Clearly, $\angle B H L_{B}=\angle D H L_{D}$. In the circle $\Omega$, tangent lines $B L_{B}$ and $D L_{D}$ form equal angles with the chord $B D$, so $\sin \angle H B L_{B}=\sin \angle H D L_{D}$ (this equality does not depend on the picture). Thus, dividing (2) by (3) we get
Since $h\left(D_{1}\right)=B_{1}$, the obtained relation yields $h\left(L_{D}\right)=L_{B}$, so $h$ maps the line $L_{D} B$ to $L_{B} D$, and these lines are parallel, as desired.

Comment 2. In the solution above, the key relation $h\left(L_{D}\right)=L_{B}$ was obtained via a short computation in sines. Here we present an alternative, pure synthetical way of establishing that.
Let the external bisectors of $\angle A B C$ and $\angle A D C$ cross $A C$ at $B_{2}$ and $D_{2}$, respectively; assume that $\overparen{A B}>\overparen{C B}$. In the right-angled triangle $B B_{1} B_{2}$, the point $L_{B}$ is a point on the hypothenuse such that $L_{B} B_{1}=L_{B} B$, so $L_{B}$ is the midpoint of $B_{1} B_{2}$.
Since $D D_{1}$ is the internal angle bisector of $\angle A D C$, we have
so the points $B, B_{2}, D$, and $D_{1}$ lie on some circle $\omega_{B}$. Similarly, $L_{D}$ is the midpoint of $D_{1} D_{2}$, and the points $D, D_{2}, B$, and $B_{1}$ lie on some circle $\omega_{D}$.
Now we have
Therefore, the corresponding sides of the triangles $D B_{1} B_{2}$ and $B D_{1} D_{2}$ are parallel, and the triangles are homothetical (in $H$ ). So their corresponding medians $D L_{B}$ and $B L_{D}$ are also parallel.

Yet alternatively, after obtaining the circles $\omega_{B}$ and $\omega_{D}$, one may notice that $H$ lies on their radical axis $B D$, whence $H B_{1} \cdot H D_{2}=H D_{1} \cdot H B_{2}$, or
Since $h\left(D_{1}\right)=B_{1}$, this yields $h\left(D_{2}\right)=B_{2}$ and hence $h\left(L_{D}\right)=L_{B}$.
Comment 3. Since $h$ preserves the line $A C$ and maps $B \mapsto D$ and $D_{1} \mapsto B_{1}$, we have $h\left(\gamma_{B}\right)=\gamma_{D}$. Therefore, $h\left(O_{B}\right)=O_{D}$; in particular, $H$ also lies on $O_{B} O_{D}$.
Solution 2. Let $B D_{1}$ and $T_{B} D_{1}$ meet $\Omega$ again at $X_{B}$ and $Y_{B}$, respectively. Then
which shows that $X_{B} Y_{B} | A C$. Similarly, let $D B_{1}$ and $T_{D} B_{1}$ meet $\Omega$ again at $X_{D}$ and $Y_{D}$, respectively; then $X_{D} Y_{D} | A C$.
Let $M_{D}$ and $M_{B}$ be the midpoints of the arcs $A B C$ and $A D C$, respectively; then the points $D_{1}$ and $B_{1}$ lie on $D M_{D}$ and $B M_{B}$, respectively. Let $K$ be the midpoint of $A C$ (which lies on $M_{B} M_{D}$ ). Applying Pascal's theorem to $M_{D} D X_{D} X_{B} B M_{B}$, we obtain that the points $D_{1}=M_{D} D \cap X_{B} B, B_{1}=D X_{D} \cap B M_{B}$, and $X_{D} X_{B} \cap M_{B} M_{D}$ are collinear, which means that $X_{B} X_{D}$ passes through $K$. Due to symmetry, the diagonals of an isosceles trapezoid $X_{B} Y_{B} X_{D} Y_{D}$ cross at $K$.

Let $b$ and $d$ denote the distances from the lines $X_{B} Y_{B}$ and $X_{D} Y_{D}$, respectively, to $A C$. Then we get
where the second equation holds in view of $D_{1} X_{B} | B_{1} X_{D}$. Therefore, the triangles $D_{1} X_{B} Y_{B}$ and $B_{1} X_{D} Y_{D}$ are similar. The triangles $D_{1} T_{B} B$ and $B_{1} T_{D} D$ are similar to them and hence to each other. Since $B D_{1} | D B_{1}$, these triangles are also homothetical. This yields $B T_{B} | D T_{D}$, as desired.
Comment 4. The original problem proposal asked to prove that the relations $B D_{1} | D B_{1}$ and $O \in O_{1} O_{2}$ are equivalent. After obtaining $B D_{1} | D B_{1} \Rightarrow O \in O_{1} O_{2}$, the converse proof is either repeated backwards mutatis mutandis, or can be obtained by the usual procedure of varying some points in the construction.
The Problem Selection Committee chose the current version, because it is less technical, yet keeps most of the ideas.
G6. Determine all integers $n \geqslant 3$ satisfying the following property: every convex $n$-gon whose sides all have length 1 contains an equilateral triangle of side length 1.
(Every polygon is assumed to contain its boundary.)
Answer: All odd $n \geqslant 3$.
Solution. First we show that for every even $n \geqslant 4$ there exists a polygon violating the required statement. Consider a regular $k$-gon $A_{0} A_{1}, \ldots A_{k-1}$ with side length 1 . Let $B_{1}, B_{2}, \ldots, B_{n / 2-1}$ be the points symmetric to $A_{1}, A_{2}, \ldots, A_{n / 2-1}$ with respect to the line $A_{0} A_{n / 2}$. Then $P=$ $A_{0} A_{1} A_{2} \ldots A_{n / 2-1} A_{n / 2} B_{n / 2-1} B_{n / 2-2} \ldots B_{2} B_{1}$ is a convex $n$-gon whose sides all have length 1 . If $k$ is big enough, $P$ is contained in a strip of width $1 / 2$, which clearly does not contain any equilateral triangle of side length 1.

Assume now that $n=2 k+1$. As the case $k=1$ is trivially true, we assume $k \geqslant 2$ henceforth. Consider a convex $(2 k+1)$-gon $P$ whose sides all have length 1 . Let $d$ be its longest diagonal. The endpoints of $d$ split the perimeter of $P$ into two polylines, one of which has length at least $k+1$. Hence we can label the vertices of $P$ so that $P=A_{0} A_{1} \ldots A_{2 k}$ and $d=A_{0} A_{\ell}$ with $\ell \geqslant k+1$. We will show that, in fact, the polygon $A_{0} A_{1} \ldots A_{\ell}$ contains an equilateral triangle of side length 1 .
Suppose that $\angle A_{\ell} A_{0} A_{1} \geqslant 60^{\circ}$. Since $d$ is the longest diagonal, we have $A_{1} A_{\ell} \leqslant A_{0} A_{\ell}$, so $\angle A_{0} A_{1} A_{\ell} \geqslant \angle A_{\ell} A_{0} A_{1} \geqslant 60^{\circ}$. It follows that there exists a point $X$ inside the triangle $A_{0} A_{1} A_{\ell}$ such that the triangle $A_{0} A_{1} X$ is equilateral, and this triangle is contained in $P$. Similar arguments apply if $\angle A_{\ell-1} A_{\ell} A_{0} \geqslant 60^{\circ}$.

From now on, assume $\angle A_{\ell} A_{0} A_{1}<60^{\circ}$ and $A_{\ell-1} A_{\ell} A_{0}<60^{\circ}$.
Consider an isosceles trapezoid $A_{0} Y Z A_{\ell}$ such that $A_{0} A_{\ell} | Y Z, A_{0} Y=Z A_{\ell}=1$, and $\angle A_{\ell} A_{0} Y=\angle Z A_{\ell} A_{0}=60^{\circ}$. Suppose that $A_{0} A_{1} \ldots A_{\ell}$ is contained in $A_{0} Y Z A_{\ell}$. Note that the perimeter of $A_{0} A_{1} \ldots A_{\ell}$ equals $\ell+A_{0} A_{\ell}$ and the perimeter of $A_{0} Y Z A_{\ell}$ equals $2 A_{0} A_{\ell}+1$.

Recall a well-known fact stating that if a convex polygon $P_{1}$ is contained in a convex polygon $P_{2}$, then the perimeter of $P_{1}$ is at most the perimeter of $P_{2}$. Hence we obtain
On the other hand, the triangle inequality yields
which gives a contradiction. Therefore, there exists a vertex $A_{m}$ of $A_{0} A_{1} \ldots A_{\ell}$ which lies outside $A_{0} Y Z A_{\ell}$. Since
the distance between $A_{m}$ and $A_{0} A_{\ell}$ is at least $\sqrt{3} / 2$.
Let $P$ be the projection of $A_{m}$ to $A_{0} A_{\ell}$. Then $P A_{m} \geqslant \sqrt{3} / 2$, and by (1) we have $A_{0} P>1 / 2$ and $P A_{\ell}>1 / 2$. Choose points $Q \in A_{0} P, R \in P A_{\ell}$, and $S \in P A_{m}$ such that $P Q=P R=1 / 2$ and $P S=\sqrt{3} / 2$. Then $Q R S$ is an equilateral triangle of side length 1 contained in $A_{0} A_{1} \ldots A_{\ell}$.

Comment. In fact, for every odd $n$ a stronger statement holds, which is formulated in terms defined in the solution above: there exists an equilateral triangle $A_{i} A_{i+1} B$ contained in $A_{0} A_{1} \ldots A_{\ell}$ for some $0 \leqslant i<\ell$. We sketch an indirect proof below.
As above, we get $\angle A_{\ell} A_{0} A_{1}<60^{\circ}$ and $A_{\ell-1} A_{\ell} A_{0}<60^{\circ}$. Choose an index $m \in[1, \ell-1]$ maximising the distance between $A_{m}$ and $A_{0} A_{\ell}$. Arguments from the above solution yield $1<m<\ell-1$. Then $\angle A_{0} A_{m-1} A_{m}>120^{\circ}$ and $\angle A_{m-1} A_{m} A_{\ell}>\angle A_{0} A_{m} A_{\ell} \geqslant 60^{\circ}$. We construct an equilateral triangle $A_{m-1} A_{m} B$ as in the figure below. If $B$ lies in $A_{0} A_{m-1} A_{m} A_{\ell}$, then we are done. Otherwise $B$ and $A_{m}$ lie on different sides of $A_{0} A_{\ell}$. As before, let $P$ be the projection of $A_{m}$ to $A_{0} A_{\ell}$. We will show that
There exists a point $C$ on the segment $A_{0} P$ such that $\angle A_{m-1} C P=60^{\circ}$. Construct a parallelogram $A_{0} C A_{m-1} K$. Then the polyline $A_{0} A_{1} \ldots A_{m-1}$ is contained in the triangle $A_{m-1} K A_{0}$, so
To prove (2), it suffices to show that $C A_{m-1}<C P-1 / 2$. Let the line through $B$ parallel to $C P$ intersect the rays $A_{m-1} C$ and $A_{m} P$ at $D$ and $T$, respectively. It is easy to see that the desired inequality will follow from $D A_{m-1} \leqslant D T-1 / 2$.
Two possible arrangements of points are shown in the figures below.
Observe that $\angle D A_{m-1} B \geqslant 60^{\circ}$, so there is a point $M$ on the segment $D B$ such that the triangle $D M A_{m-1}$ is equilateral. Then $\angle A_{m-1} M D=60^{\circ}=\angle A_{m-1} A_{m} B$, so $A_{m-1} M B A_{m}$ is a cyclic quadrilateral. Therefore, $\angle A_{m} M B=60^{\circ}$. Thus, $T$ lies on the ray $M B$ and we have to show that $M T \geqslant 1 / 2$. Indeed, $M T=A_{m} M / 2$ and $A_{m} M \geqslant A_{m} B=1$. This completes the proof of the inequality (2).

Similarly, either there exists an equilateral triangle $A_{m} A_{m+1} B^{\prime}$ contained in $A_{0} A_{1} \ldots A_{\ell}$, or
Adding (2) and (3) yields $A_{0} A_{1}+A_{1} A_{2}+\ldots+A_{\ell-1} A_{\ell}<A_{0} A_{\ell}+1$, which gives a contradiction.
This page is intentionally left blank
G7. A point $D$ is chosen inside an acute-angled triangle $A B C$ with $A B>A C$ so that $\angle B A D=\angle D A C$. A point $E$ is constructed on the segment $A C$ so that $\angle A D E=\angle D C B$. Similarly, a point $F$ is constructed on the segment $A B$ so that $\angle A D F=\angle D B C$. A point $X$ is chosen on the line $A C$ so that $C X=B X$. Let $O_{1}$ and $O_{2}$ be the circumcentres of the triangles $A D C$ and $D X E$. Prove that the lines $B C, E F$, and $O_{1} O_{2}$ are concurrent.
Common remarks. Let $Q$ be the isogonal conjugate of $D$ with respect to the triangle $A B C$. Since $\angle B A D=\angle D A C$, the point $Q$ lies on $A D$. Then $\angle Q B A=\angle D B C=\angle F D A$, so the points $Q, D, F$, and $B$ are concyclic. Analogously, the points $Q, D, E$, and $C$ are concyclic. Thus $A F \cdot A B=A D \cdot A Q=A E \cdot A C$ and so the points $B, F, E$, and $C$ are also concyclic.

Let $T$ be the intersection of $B C$ and $F E$. Claim. TD $D^{2}=T B \cdot T C=T F \cdot T E$. Proof. We will prove that the circles $(D E F)$ and $(B D C)$ are tangent to each other. Indeed, using the above arguments, we get
which implies the desired tangency. Since the points $B, C, E$, and $F$ are concyclic, the powers of the point $T$ with respect to the circles $(B D C)$ and $(E D F)$ are equal. So their radical axis, which coincides with the common tangent at $D$, passes through $T$, and hence $T D^{2}=T E \cdot T F=T B \cdot T C$.
Solution 1. Let $T A$ intersect the circle $(A B C)$ again at $M$. Due to the circles ( $B C E F$ ) and $(A M C B)$, and using the above Claim, we get $T M \cdot T A=T F \cdot T E=T B \cdot T C=T D^{2}$; in particular, the points $A, M, E$, and $F$ are concyclic.
Under the inversion with centre $T$ and radius $T D$, the point $M$ maps to $A$, and $B$ maps to $C$, which implies that the circle $(M B D)$ maps to the circle $(A D C)$. Their common point $D$ lies on the circle of the inversion, so the second intersection point $K$ also lies on that circle, which means $T K=T D$. It follows that the point $T$ and the centres of the circles ( $K D E$ ) and $(A D C)$ lie on the perpendicular bisector of $K D$.
Since the center of $(A D C)$ is $O_{1}$, it suffices to show now that the points $D, K, E$, and $X$ are concyclic (the center of the corresponding circle will be $O_{2}$ ).
The lines $B M, D K$, and $A C$ are the pairwise radical axes of the circles $(A B C M),(A C D K)$ and $(B M D K)$, so they are concurrent at some point $P$. Also, $M$ lies on the circle $(A E F)$, thus
so the points $M, E, X$, and $B$ are concyclic. Therefore, $P E \cdot P X=P M \cdot P B=P K \cdot P D$, so the points $E, K, D$, and $X$ are concyclic, as desired.

Comment 1. We present here a different solution which uses similar ideas. Perform the inversion $\iota$ with centre $T$ and radius $T D$. It swaps $B$ with $C$ and $E$ with $F$; the point $D$ maps to itself. Let $X^{\prime}=\iota(X)$. Observe that the points $E, F, X$, and $X^{\prime}$ are concyclic, as well as the points $B, C, X$, and $X^{\prime}$. Then
therefore the points $C, X^{\prime}, A$, and $F$ are concyclic. Let $X^{\prime} F$ intersect $A C$ at $P$, and let $K$ be the second common point of $D P$ and the circle $(A C D)$. Then
hence, the points $K, X, D$, and $E$ lie on some circle $\omega_{1}$, while the points $K, X^{\prime}, D$, and $F$ lie on some circle $\omega_{2}$. (These circles are distinct since $\angle E X F+\angle E D F<\angle E A F+\angle D C B+\angle D B C<180^{\circ}$ ). The inversion $\iota$ swaps $\omega_{1}$ with $\omega_{2}$ and fixes their common point $D$, so it fixes their second common point $K$. Thus $T D=T K$ and the perpendicular bisector of $D K$ passes through $T$, as well as through the centres of the circles $(C D K A)$ and $(D E K X)$.

Solution 2. We use only the first part of the Common remarks, namely, the facts that the tuples $(C, D, Q, E)$ and $(B, C, E, F)$ are both concyclic. We also introduce the point $T=$ $B C \cap E F$. Let the circle $(C D E)$ meet $B C$ again at $E_{1}$. Since $\angle E_{1} C Q=\angle D C E$, the $\operatorname{arcs} D E$ and $Q E_{1}$ of the circle $(C D Q)$ are equal, so $D Q | E E_{1}$.
Since $B F E C$ is cyclic, the line $A D$ forms equal angles with $B C$ and $E F$, hence so does $E E_{1}$. Therefore, the triangle $E E_{1} T$ is isosceles, $T E=T E_{1}$, and $T$ lies on the common perpendicular bisector of $E E_{1}$ and $D Q$.
Let $U$ and $V$ be the centres of circles $(A D E)$ and $(C D Q E)$, respectively. Then $U O_{1}$ is the perpendicular bisector of $A D$. Moreover, the points $U, V$, and $O_{2}$ belong to the perpendicular bisector of $D E$. Since $U O_{1} | V T$, in order to show that $O_{1} O_{2}$ passes through $T$, it suffices to show that
Denote angles $A, B$, and $C$ of the triangle $A B C$ by $\alpha, \beta$, and $\gamma$, respectively. Projecting onto $A C$ we obtain
The projection of $O_{1} U$ onto $A C$ is $(A C-A E) / 2=C E / 2$; the angle between $O_{1} U$ and $A C$ is $90^{\circ}-\alpha / 2$, so
Next, we claim that $E, V, C$, and $T$ are concyclic. Indeed, the point $V$ lies on the perpendicular bisector of $C E$, as well as on the internal angle bisector of $\angle C T F$. Therefore, $V$ coincides with the midpoint of the arc $C E$ of the circle (TCE).
Now we have $\angle E V C=2 \angle E E_{1} C=180^{\circ}-(\gamma-\beta)$ and $\angle V E T=\angle V E_{1} T=90^{\circ}-\angle E_{1} E C=$ $90^{\circ}-\alpha / 2$. Therefore,
Recalling (2) and multiplying (3) and (4) we establish (1):
Solution 3. Notice that $\angle A Q E=\angle Q C B$ and $\angle A Q F=\angle Q B C$; so, if we replace the point $D$ with $Q$ in the problem set up, the points $E, F$, and $T$ remain the same. So, by the Claim, we have $T Q^{2}=T B \cdot T C=T D^{2}$.
Thus, there exists a circle $\Gamma$ centred at $T$ and passing through $D$ and $Q$. We denote the second meeting point of the circles $\Gamma$ and $(A D C)$ by $K$. Let the line $A C$ meet the circle ( $D E K$ ) again at $Y$; we intend to prove that $Y=X$. As in Solution 1, this will yield that the point $T$, as well as the centres $O_{1}$ and $O_{2}$, all lie on the perpendicular bisector of $D K$.
Let $L=A D \cap B C$. We perform an inversion centred at $C$; the images of the points will be denoted by primes, e.g., $A^{\prime}$ is the image of $A$. We obtain the following configuration, constructed in a triangle $A^{\prime} C L^{\prime}$.
The points $D^{\prime}$ and $Q^{\prime}$ are chosen on the circumcircle $\Omega$ of $A^{\prime} L^{\prime} C$ such that $\Varangle\left(L^{\prime} C, D^{\prime} C\right)=$ $\Varangle\left(Q^{\prime} C, A^{\prime} C\right)$, which means that $A^{\prime} L^{\prime} | D^{\prime} Q^{\prime}$. The lines $D^{\prime} Q^{\prime}$ and $A^{\prime} C$ meet at $E^{\prime}$.
A circle $\Gamma^{\prime}$ centred on $C L^{\prime}$ passes through $D^{\prime}$ and $Q^{\prime}$. Notice here that $B^{\prime}$ lies on the segment $C L^{\prime}$, and that $\angle A^{\prime} B^{\prime} C=\angle B A C=2 \angle L A C=2 \angle A^{\prime} L^{\prime} C$, so that $B^{\prime} L^{\prime}=B^{\prime} A^{\prime}$, and $B^{\prime}$ lies on the perpendicular bisector of $A^{\prime} L^{\prime}$ (which coincides with that of $D^{\prime} Q^{\prime}$ ). All this means that $B^{\prime}$ is the centre of $\Gamma^{\prime}$.
Finally, $K^{\prime}$ is the second meeting point of $A^{\prime} D^{\prime}$ and $\Gamma^{\prime}$, and $Y^{\prime}$ is the second meeting point of the circle $\left(D^{\prime} K^{\prime} E^{\prime}\right)$ and the line $A^{\prime} E^{\prime}$, We have $\Varangle\left(Y^{\prime} K^{\prime}, K^{\prime} A^{\prime}\right)=\Varangle\left(Y^{\prime} E^{\prime}, E^{\prime} D^{\prime}\right)=$ $\Varangle\left(Y^{\prime} A^{\prime}, A^{\prime} L^{\prime}\right)$, so $A^{\prime} L^{\prime}$ is tangent to the circumcircle $\omega$ of the triangle $Y^{\prime} A^{\prime} K^{\prime}$.
Let $O$ and $O^{}$ be the centres of $\Omega$ and $\omega$, respectively. Then $O^{} A^{\prime} \perp A^{\prime} L^{\prime} \perp B^{\prime} O$. The projections of vectors $\overrightarrow{O^{} A^{\prime}}$ and $\overrightarrow{B^{\prime} O}$ onto $K^{\prime} D^{\prime}$ are equal to $\overrightarrow{K^{\prime} A^{\prime}} / 2=\overrightarrow{K^{\prime} D^{\prime}} / 2-\overrightarrow{A^{\prime} D^{\prime}} / 2$. So $\overrightarrow{O^{} A^{\prime}}=\overrightarrow{B^{\prime} O}$, or equivalently $\overrightarrow{A^{\prime} O}=\overrightarrow{O^{} B^{\prime}}$. Projecting this equality onto $A^{\prime} C$, we see that the projection of $\overrightarrow{O^{} \overrightarrow{B^{\prime}}}$ equals $\overrightarrow{A^{\prime} C} / 2$. Since $O^{*}$ is projected to the midpoint of $A^{\prime} Y^{\prime}$, this yields that $B^{\prime}$ is projected to the midpoint of $C Y^{\prime}$, i.e., $B^{\prime} Y^{\prime}=B^{\prime} C$ and $\angle B^{\prime} Y^{\prime} C=\angle B^{\prime} C Y^{\prime}$. In the original figure, this rewrites as $\angle C B Y=\angle B C Y$, so $Y$ lies on the perpendicular bisector of $B C$, as desired.

Comment 2. The point $K$ appears to be the same in Solutions 1 and 3 (and Comment 1 as well). One can also show that $K$ lies on the circle passing through $A, X$, and the midpoint of the arc $B A C$.
Comment 3. There are different proofs of the facts from the Common remarks, namely, the cyclicity of $B, C, E$, and $F$, and the Claim. We present one such alternative proof here.
We perform the composition $\phi$ of a homothety with centre $A$ and the reflection in $A D$, which maps $E$ to $B$. Let $U=\phi(D)$. Then $\Varangle(B C, C D)=\Varangle(A D, D E)=\Varangle(B U, U D)$, so the points $B, U, C$, and $D$ are concyclic. Therefore, $\Varangle(C U, U D)=\Varangle(C B, B D)=\Varangle(A D, D F)$, so $\phi(F)=C$. Then the coefficient of the homothety is $A C / A F=A B / A E$, and thus points $C, E, F$, and $B$ are concyclic.
Denote the centres of the circles $(E D F)$ and $(B U C D)$ by $O_{3}$ and $O_{4}$, respectively. Then $\phi\left(O_{3}\right)=$ $O_{4}$, hence $\Varangle\left(O_{3} D, D A\right)=-\Varangle\left(O_{4} U, U A\right)=\Varangle\left(O_{4} D, D A\right)$, whence the circle $(B D C)$ is tangent to the circle ( $E D F$ ).
Now, the radical axes of circles $(D E F),(B D C)$ and $(B C E F)$ intersect at $T$, and the claim follows.

This suffices for Solution 1 to work. However, Solutions 2 and 3 need properties of point $Q$, established in Common remarks before Solution 1.
Comment 4. In the original problem proposal, the point $X$ was hidden. Instead, a circle $\gamma$ was constructed such that $D$ and $E$ lie on $\gamma$, and its center is collinear with $O_{1}$ and $T$. The problem requested to prove that, in a fixed triangle $A B C$, independently from the choice of $D$ on the bisector of $\angle B A C$, all circles $\gamma$ pass through a fixed point.
G8. Let $\omega$ be the circumcircle of a triangle $A B C$, and let $\Omega_{A}$ be its excircle which is tangent to the segment $B C$. Let $X$ and $Y$ be the intersection points of $\omega$ and $\Omega_{A}$. Let $P$ and $Q$ be the projections of $A$ onto the tangent lines to $\Omega_{A}$ at $X$ and $Y$, respectively. The tangent line at $P$ to the circumcircle of the triangle $A P X$ intersects the tangent line at $Q$ to the circumcircle of the triangle $A Q Y$ at a point $R$. Prove that $A R \perp B C$.
Solution 1. Let $D$ be the point of tangency of $B C$ and $\Omega_{A}$. Let $D^{\prime}$ be the point such that $D D^{\prime}$ is a diameter of $\Omega_{A}$. Let $R^{\prime}$ be (the unique) point such that $A R^{\prime} \perp B C$ and $R^{\prime} D^{\prime} | B C$. We shall prove that $R^{\prime}$ coincides with $R$.
Let $P X$ intersect $A B$ and $D^{\prime} R^{\prime}$ at $S$ and $T$, respectively. Let $U$ be the ideal common point of the parallel lines $B C$ and $D^{\prime} R^{\prime}$. Note that the (degenerate) hexagon $A S X T U C$ is circumscribed around $\Omega_{A}$, hence by the Brianchon theorem $A T, S U$, and $X C$ concur at a point which we denote by $V$. Then $V S | B C$. It follows that $\Varangle(S V, V X)=\Varangle(B C, C X)=$ $\Varangle(B A, A X)$, hence $A X S V$ is cyclic. Therefore, $\Varangle(P X, X A)=\Varangle(S V, V A)=\Varangle\left(R^{\prime} T, T A\right)$. Since $\angle A P T=\angle A R^{\prime} T=90^{\circ}$, the quadrilateral $A P R^{\prime} T$ is cyclic. Hence,
It follows that $P R^{\prime}$ is tangent to the circle $(A P X)$.
Analogous argument shows that $Q R^{\prime}$ is tangent to the circle $(A Q Y)$. Therefore, $R=R^{\prime}$ and $A R \perp B C$.

Comment 1. After showing $\Varangle(P X, X A)=\Varangle\left(R^{\prime} T, T A\right)$ one can finish the solution as follows. There exists a spiral similarity mapping the triangle $A T R^{\prime}$ to the triangle $A X P$. So the triangles $A T X$ and $A R^{\prime} P$ are similar and equioriented. Thus, $\Varangle(T X, X A)=\Varangle\left(R^{\prime} P, P A\right)$, which implies that $P R^{\prime}$ is tangent to the circle ( $A P X$ ).
Solution 2. Let $J$ and $r$ be the center and the radius of $\Omega_{A}$. Denote the diameter of $\omega$ by $d$ and its center by $O$. By Euler's formula, $O J^{2}=(d / 2)^{2}+d r$, so the power of $J$ with respect to $\omega$ equals $d r$.
Let $J X$ intersect $\omega$ again at $L$. Then $J L=d$. Let $L K$ be a diameter of $\omega$ and let $M$ be the midpoint of $J K$. Since $J L=L K$, we have $\angle L M K=90^{\circ}$, so $M$ lies on $\omega$. Let $R^{\prime}$ be the point such that $R^{\prime} P$ is tangent to the circle $(A P X)$ and $A R^{\prime} \perp B C$. Note that the line $A R^{\prime}$ is symmetric to the line $A O$ with respect to $A J$.

Lemma. Let $M$ be the midpoint of the side $J K$ in a triangle $A J K$. Let $X$ be a point on the circle $(A M K)$ such that $\angle J X K=90^{\circ}$. Then there exists a point $T$ on the line $K X$ such that the triangles $A K J$ and $A J T$ are similar and equioriented. Proof. Note that $M X=M K$. We construct a parallelogram $A J N K$. Let $T$ be a point on $K X$ such that $\Varangle(N J, J A)=\Varangle(K J, J T)$. Then
So there exists a spiral similarity with center $J$ mapping the triangle $A J N$ to the triangle $T J K$. Therefore, the triangles $N J K$ and $A J T$ are similar and equioriented. It follows that the triangles $A K J$ and $A J T$ are similar and equioriented.

Back to the problem, we construct a point $T$ as in the lemma. We perform the composition $\phi$ of inversion with centre $A$ and radius $A J$ and reflection in $A J$. It is known that every triangle $A E F$ is similar and equioriented to $A \phi(F) \phi(E)$.
So $\phi(K)=T$ and $\phi(T)=K$. Let $P^{}=\phi(P)$ and $R^{}=\phi\left(R^{\prime}\right)$. Observe that $\phi(T K)$ is a circle with diameter $A P^{}$. Let $A A^{\prime}$ be a diameter of $\omega$. Then $P^{} K \perp A K \perp A^{\prime} K$, so $A^{\prime}$ lies on $P^{} K$. The triangles $A R^{\prime} P$ and $A P^{} R^{}$ are similar and equioriented, hence $\Varangle\left(A A^{\prime}, A^{\prime} P^{}\right)=\Varangle\left(A A^{\prime}, A^{\prime} K\right)=\Varangle(A X, X P)=\Varangle(A X, X P)=\Varangle\left(A P, P R^{\prime}\right)=\Varangle\left(A R^{}, R^{} P^{}\right)$, so $A, A^{\prime}, R^{}$, and $P^{}$ are concyclic. Since $A^{\prime}$ and $R^{}$ lie on $A O$, we obtain $R^{*}=A^{\prime}$. So $R^{\prime}=\phi\left(A^{\prime}\right)$, and $\phi\left(A^{\prime}\right) P$ is tangent to the circle $(A P X)$.
An identical argument shows that $\phi\left(A^{\prime}\right) Q$ is tangent to the circle $(A Q Y)$. Therefore, $R=$ $\phi\left(A^{\prime}\right)$ and $A R \perp B C$.
Comment 2. One of the main ideas of Solution 2 is to get rid of the excircle, along with points $B$ and $C$. After doing so we obtain the following fact, which is, essentially, proved in Solution 2.
Let $\omega$ be the circumcircle of a triangle $A K_{1} K_{2}$. Let $J$ be a point such that the midpoints of $J K_{1}$ and $J K_{2}$ lie on $\omega$. Points $X$ and $Y$ are chosen on $\omega$ so that $\angle J X K_{1}=\angle J Y K_{2}=90^{\circ}$. Let $P$ and $Q$ be the projections of $A$ onto $X K_{1}$ and $Y K_{2}$, respectively. The tangent line at $P$ to the circumcircle of the triangle $A P X$ intersects the tangent line at $Q$ to the circumcircle of the triangle $A Q Y$ at a point $R$. Then the reflection of the line $A R$ in $A J$ passes through the centre $O$ of $\omega$.
Number Theory
N1. Determine all integers $n \geqslant 1$ for which there exists a pair of positive integers $(a, b)$ such that no cube of a prime divides $a^{2}+b+3$ and
Answer: The only integer with that property is $n=2$. Solution. As $b \equiv-a^{2}-3\left(\bmod a^{2}+b+3\right)$, the numerator of the given fraction satisfies
As $a^{2}+b+3$ is not divisible by $p^{3}$ for any prime $p$, if $a^{2}+b+3$ divides $(a+1)^{3}$ then it does also divide $(a+1)^{2}$. Since
we conclude $(a+1)^{2}=a^{2}+b+3$. This yields $b=2(a-1)$ and $n=2$. The choice $(a, b)=(2,2)$ with $a^{2}+b+3=9$ shows that $n=2$ indeed is a solution.
N2. Let $n \geqslant 100$ be an integer. The numbers $n, n+1, \ldots, 2 n$ are written on $n+1$ cards, one number per card. The cards are shuffled and divided into two piles. Prove that one of the piles contains two cards such that the sum of their numbers is a perfect square.
Solution. To solve the problem it suffices to find three squares and three cards with numbers $a, b, c$ on them such that pairwise sums $a+b, b+c, a+c$ are equal to the chosen squares. By choosing the three consecutive squares $(2 k-1)^{2},(2 k)^{2},(2 k+1)^{2}$ we arrive at the triple
We need a value for $k$ such that
A concrete $k$ is suitable for all $n$ with
For $k \geqslant 9$ the intervals $I_{k}$ and $I_{k+1}$ overlap because
Hence $I_{9} \cup I_{10} \cup \ldots=[99, \infty)$, which proves the statement for $n \geqslant 99$. Comment 1. There exist approaches which only work for sufficiently large $n$. One possible approach is to consider three cards with numbers $70 k^{2}, 99 k^{2}, 126 k^{2}$ on them. Then their pairwise sums are perfect squares and so it suffices to find $k$ such that $70 k^{2} \geqslant n$ and $126 k^{2} \leqslant 2 n$ which exists for sufficiently large $n$.
Another approach is to prove, arguing by contradiction, that $a$ and $a-2$ are in the same pile provided that $n$ is large enough and $a$ is sufficiently close to $n$. For that purpose, note that every pair of neighbouring numbers in the sequence $a, x^{2}-a, a+(2 x+1), x^{2}+2 x+3-a, a-2$ adds up to a perfect square for any $x$; so by choosing $x=\lfloor\sqrt{2 a}\rfloor+1$ and assuming that $n$ is large enough we conclude that $a$ and $a-2$ are in the same pile for any $a \in[n+2,3 n / 2]$. This gives a contradiction since it is easy to find two numbers from $[n+2,3 n / 2]$ of the same parity which sum to a square.
It then remains to separately cover the cases of small $n$ which appears to be quite technical. Comment 2. An alternative formulation for this problem could ask for a proof of the statement for all $n>10^{6}$. An advantage of this formulation is that some solutions, e.g. those mentioned in Comment 1 need not contain a technical part which deals with the cases of small $n$. However, the original formulation seems to be better because the bound it gives for $n$ is almost sharp, see the next comment for details.
Comment 3. The statement of the problem is false for $n=98$. As a counterexample, the first pile may contain the even numbers from 98 to 126 , the odd numbers from 129 to 161 , and the even numbers from 162 to 196.
N3. Find all positive integers $n$ with the following property: the $k$ positive divisors of $n$ have a permutation $\left(d_{1}, d_{2}, \ldots, d_{k}\right)$ such that for every $i=1,2, \ldots, k$, the number $d_{1}+\cdots+d_{i}$ is a perfect square.
Answer: $n=1$ and $n=3$. Solution. For $i=1,2, \ldots, k$ let $d_{1}+\ldots+d_{i}=s_{i}^{2}$, and define $s_{0}=0$ as well. Obviously $0=s_{0}<s_{1}<s_{2}<\ldots<s_{k}$, so
The number 1 is one of the divisors $d_{1}, \ldots, d_{k}$ but, due to $d_{i} \geqslant 2 i-1$, the only possibility is $d_{1}=1$.
Now consider $d_{2}$ and $s_{2} \geqslant 2$. By definition, $d_{2}=s_{2}^{2}-1=\left(s_{2}-1\right)\left(s_{2}+1\right)$, so the numbers $s_{2}-1$ and $s_{2}+1$ are divisors of $n$. In particular, there is some index $j$ such that $d_{j}=s_{2}+1$.
Notice that
since the sequence $s_{0}<s_{1}<\ldots<s_{k}$ increases, the index $j$ cannot be greater than 2 . Hence, the divisors $s_{2}-1$ and $s_{2}+1$ are listed among $d_{1}$ and $d_{2}$. That means $s_{2}-1=d_{1}=1$ and $s_{2}+1=d_{2}$; therefore $s_{2}=2$ and $d_{2}=3$.
We can repeat the above process in general. Claim. $d_{i}=2 i-1$ and $s_{i}=i$ for $i=1,2, \ldots, k$. Proof. Apply induction on $i$. The Claim has been proved for $i=1,2$. Suppose that we have already proved $d=1, d_{2}=3, \ldots, d_{i}=2 i-1$, and consider the next divisor $d_{i+1}$ :
The number $s_{i+1}+i$ is a divisor of $n$, so there is some index $j$ such that $d_{j}=s_{i+1}+i$. Similarly to (2), by (1) we have
since the sequence $s_{0}<s_{1}<\ldots<s_{k}$ increases, (3) forces $j \leqslant i+1$. On the other hand, $d_{j}=s_{i+1}+i>2 i>d_{i}>d_{i-1}>\ldots>d_{1}$, so $j \leqslant i$ is not possible. The only possibility is $j=i+1$.
Hence,
By solving this equation we get $s_{i+1}=i+1$ and $d_{i+1}=2 i+1$, that finishes the proof. Now we know that the positive divisors of the number $n$ are $1,3,5, \ldots, n-2, n$. The greatest divisor is $d_{k}=2 k-1=n$ itself, so $n$ must be odd. The second greatest divisor is $d_{k-1}=n-2$; then $n-2$ divides $n=(n-2)+2$, so $n-2$ divides 2 . Therefore, $n$ must be 1 or 3 .
The numbers $n=1$ and $n=3$ obviously satisfy the requirements: for $n=1$ we have $k=1$ and $d_{1}=1^{2}$; for $n=3$ we have $k=2, d_{1}=1^{2}$ and $d_{1}+d_{2}=1+3=2^{2}$.
This page is intentionally left blank
N4. Alice is given a rational number $r>1$ and a line with two points $B \neq R$, where point $R$ contains a red bead and point $B$ contains a blue bead. Alice plays a solitaire game by performing a sequence of moves. In every move, she chooses a (not necessarily positive) integer $k$, and a bead to move. If that bead is placed at point $X$, and the other bead is placed at $Y$, then Alice moves the chosen bead to point $X^{\prime}$ with $\overrightarrow{Y X^{\prime}}=r^{k} \overrightarrow{Y X}$.
Alice's goal is to move the red bead to the point $B$. Find all rational numbers $r>1$ such that Alice can reach her goal in at most 2021 moves.
Answer: All $r=(b+1) / b$ with $b=1, \ldots, 1010$. Solution. Denote the red and blue beads by $\mathcal{R}$ and $\mathcal{B}$, respectively. Introduce coordinates on the line and identify the points with their coordinates so that $R=0$ and $B=1$. Then, during the game, the coordinate of $\mathcal{R}$ is always smaller than the coordinate of $\mathcal{B}$. Moreover, the distance between the beads always has the form $r^{\ell}$ with $\ell \in \mathbb{Z}$, since it only multiplies by numbers of this form. Denote the value of the distance after the $m^{\text {th }}$ move by $d_{m}=r^{\alpha_{m}}$, $m=0,1,2, \ldots$ (after the $0^{\text {th }}$ move we have just the initial position, so $\alpha_{0}=0$ ).
If some bead is moved in two consecutive moves, then Alice could instead perform a single move (and change the distance from $d_{i}$ directly to $d_{i+2}$ ) which has the same effect as these two moves. So, if Alice can achieve her goal, then she may as well achieve it in fewer (or the same) number of moves by alternating the moves of $\mathcal{B}$ and $\mathcal{R}$. In the sequel, we assume that Alice alternates the moves, and that $\mathcal{R}$ is shifted altogether $t$ times.
If $\mathcal{R}$ is shifted in the $m^{\text {th }}$ move, then its coordinate increases by $d_{m}-d_{m+1}$. Therefore, the total increment of $\mathcal{R}$ 's coordinate, which should be 1 , equals
depending on whether $\mathcal{R}$ or $\mathcal{B}$ is shifted in the first move. Moreover, in the former case we should have $t \leqslant 1011$, while in the latter one we need $t \leqslant 1010$. So both cases reduce to an equation
for some $n \leqslant 1011$. Thus, if Alice can reach her goal, then this equation has a solution for $n=1011$ (we can add equal terms to both sums in order to increase $n$ ).
Conversely, if (1) has a solution for $n=1011$, then Alice can compose a corresponding sequence of distances $d_{0}, d_{1}, d_{2}, \ldots, d_{2021}$ and then realise it by a sequence of moves. So the problem reduces to the solvability of (1) for $n=1011$.
Assume that, for some rational $r$, there is a solution of (1). Write $r$ in lowest terms as $r=a / b$. Substitute this into (1), multiply by the common denominator, and collect all terms on the left hand side to get
for some $N \geqslant 0$. We assume that there exist indices $j_{-}$and $j_{+}$such that $\mu_{j_{-}}=0$ and $\mu_{j_{+}}=N$.
Reducing (2) modulo $a-b$ (so that $a \equiv b$ ), we get
Since $\operatorname{gcd}(a-b, b)=1$, this is possible only if $a-b=1$. Reducing (2) modulo $a+b$ (so that $a \equiv-b$ ), we get
for some odd (thus nonzero) $S$ with $|S| \leqslant 2 n-1$. Since $\operatorname{gcd}(a+b, b)=1$, this is possible only if $a+b \mid S$. So $a+b \leqslant 2 n-1$, and hence $b=a-1 \leqslant n-1=1010$.
Thus we have shown that any sought $r$ has the form indicated in the answer. It remains to show that for any $b=1,2, \ldots, 1010$ and $a=b+1$, Alice can reach the goal. For this purpose, in (1) we put $n=a, \beta_{1}=\beta_{2}=\cdots=\beta_{a}=0$, and $\gamma_{1}=\gamma_{2}=\cdots=\gamma_{b}=1$.
Comment 1. Instead of reducing modulo $a+b$, one can reduce modulo $a$ and modulo $b$. The first reduction shows that the number of terms in (2) with $\mu_{i}=0$ is divisible by $a$, while the second shows that the number of terms with $\mu_{i}=N$ is divisible by $b$.
Notice that, in fact, $N>0$, as otherwise (2) contains an alternating sum of an odd number of equal terms, which is nonzero. Therefore, all terms listed above have different indices, and there are at least $a+b$ of them.
Comment 2. Another way to investigate the solutions of equation (1) is to consider the Laurent polynomial
We can pick a sufficiently large integer $d$ so that $P(x)=x^{d} L(x)$ is a polynomial in $\mathbb{Z}[x]$. Then
and
If $r=p / q$ with integers $p>q \geqslant 1$ is a rational number with the properties listed in the problem statement, then $P(p / q)=L(p / q)=0$. As $P(x)$ has integer coefficients,
Plugging $x=1$ into (5) gives $(p-q) \mid P(1)=1$, which implies $p=q+1$. Moreover, plugging $x=-1$ into (5) gives $(p+q) \mid P(-1)$, which, along with (4), implies $p+q \leqslant 2021$ and $q \leqslant 1010$. Hence $x=(q+1) / q$ for some integer $q$ with $1 \leqslant q \leqslant 1010$.
N5. Prove that there are only finitely many quadruples $(a, b, c, n)$ of positive integers such that
Solution. For fixed $n$ there are clearly finitely many solutions; we will show that there is no solution with $n>100$. So, assume $n>100$. By the AM-GM inequality,
thus $a, b, c<(n-1) / 2$. For every prime $p$ and integer $m \neq 0$, let $\nu_{p}(m)$ denote the $p$-adic valuation of $m$; that is, the greatest non-negative integer $k$ for which $p^{k}$ divides $m$. Legendre's formula states that
and a well-know corollary of this formula is that
If $n$ is odd then $a^{n-1}, b^{n-1}, c^{n-1}$ are squares, and by considering them modulo 4 we conclude that $a, b$ and $c$ must be even. Hence, $2^{n-1} \mid n$ ! but that is impossible for odd $n$ because $\nu_{2}(n!)=\nu_{2}((n-1)!)<n-1$ by $(\bigcirc)$.
From now on we assume that $n$ is even. If all three numbers $a+b, b+c, c+a$ are powers of 2 then $a, b, c$ have the same parity. If they all are odd, then $n!=a^{n-1}+b^{n-1}+c^{n-1}$ is also odd which is absurd. If all $a, b, c$ are divisible by 4 , this contradicts $\nu_{2}(n!) \leqslant n-1$. If, say, $a$ is not divisible by 4 , then $2 a=(a+b)+(a+c)-(b+c)$ is not divisible by 8 , and since all $a+b, b+c$, $c+a$ are powers of 2 , we get that one of these sums equals 4 , so two of the numbers of $a, b, c$ are equal to 2. Say, $a=b=2$, then $c=2^{r}-2$ and, since $c \mid n$ !, we must have $c \mid a^{n-1}+b^{n-1}=2^{n}$ implying $r=2$, and so $c=2$, which is impossible because $n!\equiv 0 \not \equiv 3 \cdot 2^{n-1}(\bmod 5)$.
So now we assume that the sum of two numbers among $a, b, c$, say $a+b$, is not a power of 2 , so it is divisible by some odd prime $p$. Then $p \leqslant a+b<n$ and so $c^{n-1}=n!-\left(a^{n-1}+b^{n-1}\right)$ is divisible by $p$. If $p$ divides $a$ and $b$, we get $p^{n-1} \mid n$ !, contradicting ( $($ ). Next, using ( $\odot$ ) and the Lifting the Exponent Lemma we get
In view of $(\diamond)$, no number of $1,2, \ldots, n$ can be divisible by $p$, except $a+b$ and $n-1>a+b$. On the other hand, $p \mid c$ implies that $p<n / 2$ and so there must be at least two such numbers. Hence, there are two multiples of $p$ among $1,2, \ldots, n$, namely $a+b=p$ and $n-1=2 p$. But this is another contradiction because $n-1$ is odd. This final contradiction shows that there is no solution of the equation for $n>100$.
Comment 1. The original version of the problem asked to find all solutions to the equation. The solution to that version is not much different but is more technical.
Comment 2. To find all solutions we can replace the bound $a, b, c<(n-1) / 2$ for all $n$ with a weaker bound $a, b, c \leqslant n / 2$ only for even $n$, which is a trivial application of AM-GM to the tuple $(2,3, \ldots, n)$. Then we may use the same argument for odd $n$ (it works for $n \geqslant 5$ and does not require any bound on $a, b, c)$, and for even $n$ the same solution works for $n \geqslant 6$ unless we have $a+b=n-1$ and $2 \nu_{p}(n-1)=\nu_{p}(n!)$. This is only possible for $p=3$ and $n=10$ in which case we can consider the original equation modulo 7 to deduce that $7 \mid a b c$ which contradicts the fact that $7^{9}>10$ !. Looking at $n \leqslant 4$ we find four solutions, namely,
Comment 3. For sufficiently large $n$, the inequality $a, b, c<(n-1) / 2$ also follows from Stirling's formula.
N6. Determine all integers $n \geqslant 2$ with the following property: every $n$ pairwise distinct integers whose sum is not divisible by $n$ can be arranged in some order $a_{1}, a_{2}, \ldots, a_{n}$ so that $n$ divides $1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n}$.
Answer: All odd integers and all powers of 2.
Solution. If $n=2^{k} a$, where $a \geqslant 3$ is odd and $k$ is a positive integer, we can consider a set containing the number $2^{k}+1$ and $n-1$ numbers congruent to 1 modulo $n$. The sum of these numbers is congruent to $2^{k}$ modulo $n$ and therefore is not divisible by $n$; for any permutation $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ of these numbers
and $a$ fortiori $1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n}$ is not divisible by $n$. From now on, we suppose that $n$ is either odd or a power of 2 . Let $S$ be the given set of integers, and $s$ be the sum of elements of $S$. Lemma 1. If there is a permutation $\left(a_{i}\right)$ of $S$ such that $(n, s)$ divides $\sum_{i=1}^{n} i a_{i}$, then there is a permutation $\left(b_{i}\right)$ of $S$ such that $n$ divides $\sum_{i=1}^{n} i b_{i}$. Proof. Let $r=\sum_{i=1}^{n} i a_{i}$. Consider the permutation $\left(b_{i}\right)$ defined by $b_{i}=a_{i+x}$, where $a_{j+n}=a_{j}$. For this permutation, we have
Since $(n, s)$ divides $r$, the congruence $r-s x \equiv 0(\bmod n)$ admits a solution. Lemma 2. Every set $T$ of $k m$ integers, $m>1$, can be partitioned into $m$ sets of $k$ integers so that in every set either the sum of elements is not divisible by $k$ or all the elements leave the same remainder upon division by $k$. Proof. The base case, $m=2$. If $T$ contains $k$ elements leaving the same remainder upon division by $k$, we form one subset $A$ of these elements; the remaining elements form a subset $B$. If $k$ does not divide the sum of all elements of $B$, we are done. Otherwise it is enough to exchange any element of $A$ with any element of $B$ not congruent to it modulo $k$, thus making sums of both $A$ and $B$ not divisible by $k$. This cannot be done only when all the elements of $T$ are congruent modulo $k$; in this case any partition will do.
If no $k$ elements of $T$ have the same residue modulo $k$, there are three elements $a, b, c \in T$ leaving pairwise distinct remainders upon division by $k$. Let $t$ be the sum of elements of $T$. It suffices to find $A \subset T$ such that $|A|=k$ and $\sum_{x \in A} x \not \equiv 0, t(\bmod k)$ : then neither the sum of elements of $A$ nor the sum of elements of $B=T \backslash A$ is divisible by $k$. Consider $U^{\prime} \subset T \backslash{a, b, c}$ with $\left|U^{\prime}\right|=k-1$. The sums of elements of three sets $U^{\prime} \cup{a}, U^{\prime} \cup{b}, U^{\prime} \cup{c}$ leave three different remainders upon division by $k$, and at least one of them is not congruent either to 0 or to $t$.
Now let $m>2$. If $T$ contains $k$ elements leaving the same remainder upon division by $k$, we form one subset $A$ of these elements and apply the inductive hypothesis to the remaining $k(m-1)$ elements. Otherwise, we choose any $U \subset T,|U|=k-1$. Since all the remaining elements cannot be congruent modulo $k$, there is $a \in T \backslash U$ such that $a \not \equiv-\sum_{x \in U} x(\bmod k)$. Now we can take $A=U \cup{a}$ and apply the inductive hypothesis to $T \backslash A$.
Now we are ready to prove the statement of the problem for all odd $n$ and $n=2^{k}$. The proof is by induction.
If $n$ is prime, the statement follows immediately from Lemma 1 , since in this case $(n, s)=1$. Turning to the general case, we can find prime $p$ and an integer $t$ such that $p^{t} \mid n$ and $p^{t} \nmid s$. By Lemma 2, we can partition $S$ into $p$ sets of $\frac{n}{p}=k$ elements so that in every set either the sum of numbers is not divisible by $k$ or all numbers have the same residue modulo $k$.
For sets in the first category, by the inductive hypothesis there is a permutation $\left(a_{i}\right)$ such that $k \mid \sum_{i=1}^{k} i a_{i}$.
If $n$ (and therefore $k$ ) is odd, then for each permutation $\left(b_{i}\right)$ of a set in the second category we have
By combining such permutation for all sets of the partition, we get a permutation ( $c_{i}$ ) of $S$ such that $k \mid \sum_{i=1}^{n} i c_{i}$. Since this sum is divisible by $k$, and $k$ is divisible by $(n, s)$, we are done by Lemma 1 .
If $n=2^{s}$, we have $p=2$ and $k=2^{s-1}$. Then for each of the subsets there is a permutation $\left(a_{1}, \ldots, a_{k}\right)$ such that $\sum_{i=1}^{k} i a_{i}$ is divisible by $2^{s-2}=\frac{k}{2}$ : if the subset belongs to the first category, the expression is divisible even by $k$, and if it belongs to the second one,
Now the numbers of each permutation should be multiplied by all the odd or all the even numbers not exceeding $n$ in increasing order so that the resulting sums are divisible by $k$ :
Combining these two sums, we again get a permutation $\left(c_{i}\right)$ of $S$ such that $k \mid \sum_{i=1}^{n} i c_{i}$, and finish the case by applying Lemma 1.
Comment. We cannot dispense with the condition that $n$ does not divide the sum of all elements. Indeed, for each $n>1$ and the set consisting of $1,-1$, and $n-2$ elements divisible by $n$ the required permutation does not exist.
N7. Let $a_{1}, a_{2}, a_{3}, \ldots$ be an infinite sequence of positive integers such that $a_{n+2 m}$ divides $a_{n}+a_{n+m}$ for all positive integers $n$ and $m$. Prove that this sequence is eventually periodic, i.e. there exist positive integers $N$ and $d$ such that $a_{n}=a_{n+d}$ for all $n>N$.
Solution. We will make repeated use of the following simple observation: Lemma 1. If a positive integer $d$ divides $a_{n}$ and $a_{n-m}$ for some $m$ and $n>2 m$, it also divides $a_{n-2 m}$. If $d$ divides $a_{n}$ and $a_{n-2 m}$, it also divides $a_{n-m}$. Proof. Both parts are obvious since $a_{n}$ divides $a_{n-2 m}+a_{n-m}$. Claim. The sequence $\left(a_{n}\right)$ is bounded. Proof. Suppose the contrary. Then there exist infinitely many indices $n$ such that $a_{n}$ is greater than each of the previous terms $a_{1}, a_{2}, \ldots, a_{n-1}$. Let $a_{n}=k$ be such a term, $n>10$. For each $s<\frac{n}{2}$ the number $a_{n}=k$ divides $a_{n-s}+a_{n-2 s}<2 k$, therefore
In particular,
that is, $a_{n-1}=a_{n-4}$ and $a_{n-2}=a_{n-8}$. It follows from Lemma 1 that $a_{n-1}$ divides $a_{n-1-3 s}$ for $3 s<n-1$ and $a_{n-2}$ divides $a_{n-2-6 s}$ for $6 s<n-2$. Since at least one of the numbers $a_{n-1}$ and $a_{n-2}$ is at least $a_{n} / 2$, so is some $a_{i}$ with $i \leqslant 6$. However, $a_{n}$ can be arbitrarily large, a contradiction.
Since $\left(a_{n}\right)$ is bounded, there exist only finitely many $i$ for which $a_{i}$ appears in the sequence finitely many times. In other words, there exists $N$ such that if $a_{i}=t$ and $i>N$, then $a_{j}=t$ for infinitely many $j$.
Clearly the sequence $\left(a_{n+N}\right){n>0}$ satisfies the divisibility condition, and it is enough to prove that this sequence is eventually periodic. Thus truncating the sequence if necessary, we can assume that each number appears infinitely many times in the sequence. Let $k$ be the maximum number appearing in the sequence. Lemma 2. If a positive integer $d$ divides $a{n}$ for some $n$, then the numbers $i$ such that $d$ divides $a_{i}$ form an arithmetical progression with an odd difference. Proof. Let $i_{1}<i_{2}<i_{3}<\ldots$ be all the indices $i$ such that $d$ divides $a_{i}$. If $i_{s}+i_{s+1}$ is even, it follows from Lemma 1 that $d$ also divides $a_{\frac{i_{s}+i_{s+1}}{2}}$, impossible since $i_{s}<\frac{i_{s}+i_{s+1}}{2}<i_{s+1}$. Thus $i_{s}$ and $i_{s+1}$ are always of different parity, and therefore $i_{s}+i_{s+2}$ is even. Applying Lemma 1 again, we see that $d$ divides $a_{\frac{i_{s}+i_{s+2}}{2}}$, hence $\frac{i_{s}+i_{s+2}}{2}=i_{s+1}$,
We are ready now to solve the problem. The number of positive divisors of all terms of the progression is finite. Let $d_{s}$ be the difference of the progression corresponding to $s$, that is, $s$ divides $a_{n}$ if and only if it divides $a_{n+t d_{s}}$ for any positive integer $t$. Let $D$ be the product of all $d_{s}$. Then each $s$ dividing a term of the progression divides $a_{n}$ if and only if it divides $a_{n+D}$. This means that the sets of divisors of $a_{n}$ and $a_{n+D}$ coincide, and $a_{n+D}=a_{n}$. Thus $D$ is a period of the sequence.
Comment. In the above solution we did not try to find the exact structure of the periodic part of $\left(a_{n}\right)$. A little addition to the argument above shows that the period of the sequence has one of the following three forms: (i) $t$ (in this case the sequence is eventually constant); (ii) $t, 2 t, 3 t$ or $2 t, t, 3 t$ (so the period is 3 ); (iii) $t, t, \ldots, 2 t$ (the period can be any odd number).
In these three cases $t$ can be any positive integer. It is easy to see that all three cases satisfy the original condition.
We again denote by $k$ be the maximum number appearing in the sequence. All the indices $i$ such that $a_{i}=k$ form an arithmetical progression. If the difference of this progression is 1 , the sequence $\left(a_{n}\right)$ is constant, and we get the case (i). Assume that the difference $T$ is at least 3.
Take an index $n$ such that $a_{n}=k$ and let $a=a_{n-2}, b=a_{n-1}$. We have $a, b<k$ and therefore $k=a_{n}=a_{n-1}+a_{n-2}=a+b$. If $a=b=\frac{k}{2}$, then all the terms $a_{1}, a_{2}, \ldots, a_{n}$ are divisible by $k / 2$, that is, are equal to $k$ or $k / 2$. Since the indices $i$ such that $a_{i}=k$ form an arithmetical progression with odd diference, we get the case (iii).
Suppose now that $a \neq b$. Claim. For $\frac{n}{2}<m<n$ we have $a_{m}=a$ if $m \equiv n-2(\bmod 3)$ and $a_{m}=b$ if $m \equiv n-1(\bmod 3)$. Proof. The number $k=a_{n}$ divides $a_{n-2}+a_{n-1}=a+b$ and $a_{n-4}+a_{n-2}=a_{n-4}+a$ and is therefore equal to these sums (since $a, b<k$ and $a_{i} \leqslant k$ for all $i$ ). Therefore $a_{n-1}=a_{n-4}=b$, that is, $a_{n-4}<k$, $a_{n-4}+a_{n-8}=k$ and $a_{n-8}=a_{n-2}=a$. One of the numbers $a$ and $b$ is greater than $k / 2$.
If $b=a_{n-1}=a_{n-4}>\frac{k}{2}$, it follows from Lemma 1 that $a_{n-1}$ divides $a_{n-1-3 s}$ when $3 s<n-1$, and therefore $a_{n-1-3 s}=b$ when $3 s<n-1$. When $6 s<n-4, k$ also divides $a_{n-4-6 s}+a_{n-2-3 s}=b+a_{n-2-3}$, thus, $a_{n-2-3 s}=k-b=a$.
If $a=a_{n-2}=a_{n-8}>\frac{k}{2}$, all the terms $a_{n-2-6 s}$ with $6 s<n-2$ are divisible by $a$, that is, the indices $i$ for which $a$ divides $a_{i}$ form a progression with difference dividing 6 . Since this difference is odd and greater than 1 , it must be 3 , that is, $a_{n-2-3 s}=a$ when $3 s<n-2$. Similarly to the previous case, we have $a_{n-1-3 s}=a_{n}-a_{n-2-6 s}=k-a=b$ when $6 s<n-2$.
Let $a_{n}$ and $a_{n+T}$ be two consecutive terms of the sequence equal to $k$. If $n$ is large enough, $\frac{n+T}{2}<n-2$, and applying the claim to $n+T$ instead of $n$ we see that the three consecutive terms $a_{n-2}=a, a_{n-1}=b, a_{n}=k$ must be equal to $a_{n+T-2}, a_{n+T-1}$ and $a_{n+T}$ respectively. Thus, for some $i$ we have $a_{i+3 s}=a$ and $a_{i+1+3 s}=b$ for all $s$. Truncating the sequence again if necessary, we may assume that $a_{3 s+1}=a$ and $a_{3 s+2}=b$ for all $s$. We know also that $a_{n}=k$ if and only if $n$ is divisible by $T$ (incidentally, this proves that $T$ is divisible by 3 ).
If $a_{3 s}=c$ for some integer $s$, each of the numbers $a, b, c$ divides the sum of the other two. It is easy to see that these numbers are proportional to one of the triplets $(1,1,1),(1,1,2)$ and $(1,2,3)$ in some order. It follows that the greater of the two numbers $a$ and $b$ is the smaller multiplied by 2,3 or $3 / 2$. The last two cases are impossible because then $c$ cannot be the maximum element in the triplet $(a, b, c)$, while $c=k=a+b$ for infinitely many $s$. Thus the only possible case is 2 , the numbers $a$ and $b$ are $k / 3$ and $2 k / 3$ in some order, and the only possible values of $c$ are $k$ and $k / 3$. Suppose that $a_{3 s}=k / 3$ for some $s>1$. We can choose $s$ so that $a_{3 s+3}=k$. Therefore $T$, which we already know to be odd and divisible by 3 , is greater than 3 , that is, at least 9 . Then $a_{3 s-3} \neq k$, and the only other possibility is $a_{3 s-3}=k / 3$. However, $a_{3 s+3}=k$ must divide $a_{3 s}+a_{3 s-3}=2 k / 3$, which is impossible. We have proved then that $a_{3 s}=k$ for all $s>1$, which is the case (ii).
N8. For a polynomial $P(x)$ with integer coefficients let $P^{1}(x)=P(x)$ and $P^{k+1}(x)=$ $P\left(P^{k}(x)\right)$ for $k \geqslant 1$. Find all positive integers $n$ for which there exists a polynomial $P(x)$ with integer coefficients such that for every integer $m \geqslant 1$, the numbers $P^{m}(1), \ldots, P^{m}(n)$ leave exactly $\left\lceil n / 2^{m}\right\rceil$ distinct remainders when divided by $n$.
Answer: All powers of 2 and all primes. Solution. Denote the set of residues modulo $\ell$ by $\mathbb{Z}{\ell}$. Observe that $P$ can be regarded as a function $\mathbb{Z}{\ell} \rightarrow \mathbb{Z}{\ell}$ for any positive integer $\ell$. Denote the cardinality of the set $P^{m}\left(\mathbb{Z}{\ell}\right)$ by $f_{m, \ell}$. Note that $f_{m, n}=\left\lceil n / 2^{m}\right\rceil$ for all $m \geqslant 1$ if and only if $f_{m+1, n}=\left\lceil f_{m, n} / 2\right\rceil$ for all $m \geqslant 0$.
Part 1. The required polynomial exists when $n$ is a power of 2 or a prime. If $n$ is a power of 2 , set $P(x)=2 x$. If $n=p$ is an odd prime, every function $f: \mathbb{Z}{p} \rightarrow \mathbb{Z}{p}$ coincides with some polynomial with integer coefficients. So we can pick the function that sends $x \in{0,1, \ldots, p-1}$ to $\lfloor x / 2\rfloor$.
Part 2. The required polynomial does not exist when $n$ is not a prime power. Let $n=a b$ where $a, b>1$ and $\operatorname{gcd}(a, b)=1$. Note that, since $\operatorname{gcd}(a, b)=1$,
by the Chinese remainder theorem. Also, note that, if $f_{m, \ell}=f_{m+1, \ell}$, then $P$ permutes the image of $P^{m}$ on $\mathbb{Z}{\ell}$, and therefore $f{s, \ell}=f_{m, \ell}$ for all $s>m$. So, as $f_{m, a b}=1$ for sufficiently large $m$, we have for each $m$
Choose the smallest $m$ such that $f_{m+1, a}=1$ or $f_{m+1, b}=1$. Without loss of generality assume that $f_{m+1, a}=1$. Then $f_{m+1, a b}=f_{m+1, b}<f_{m, b} \leqslant f_{m, a b} / 2 \leqslant f_{m+1, a b}$, a contradiction.
Part 3. The required polynomial does not exist when $n$ is an odd prime power that is not a prime.
Let $n=p^{k}$, where $p \geqslant 3$ is prime and $k \geqslant 2$. For $r \in \mathbb{Z}{p}$ let $S{r}$ denote the subset of $\mathbb{Z}{p^{k}}$ consisting of numbers congruent to $r$ modulo $p$. We denote the cardinality of a set $S$ by $|S|$. Claim. For any residue $r$ modulo $p$, either $\left|P\left(S{r}\right)\right|=p^{k-1}$ or $\left|P\left(S_{r}\right)\right| \leqslant p^{k-2}$. Proof. Recall that $P(r+h)=P(r)+h P^{\prime}(r)+h^{2} Q(r, h)$, where $Q$ is an integer polynomial. If $p \mid P^{\prime}(r)$, then $P(r+p s) \equiv P(r)\left(\bmod p^{2}\right)$, hence all elements of $P\left(S_{r}\right)$ are congruent modulo $p^{2}$. So in this case $\left|P\left(S_{r}\right)\right| \leqslant p^{k-2}$.
Now we show that $p \nmid P^{\prime}(r)$ implies $\left|P\left(S_{r}\right)\right|=p^{k-1}$ for all $k$. Suppose the contrary: $\left|P\left(S_{r}\right)\right|<p^{k-1}$ for some $k>1$. Let us choose the smallest $k$ for which this is so. To each residue in $P\left(S_{r}\right)$ we assign its residue modulo $p^{k-1}$; denote the resulting set by $\bar{P}(S, r)$. We have $|\bar{P}(S, r)|=p^{k-2}$ by virtue of minimality of $k$. Then $\left|P\left(S_{r}\right)\right|<p^{k-1}=p \cdot|\bar{P}(S, r)|$, that is, there is $u=P(x) \in P\left(S_{r}\right)(x \equiv r(\bmod p))$ and $t \not \equiv 0$ $(\bmod p)$ such that $u+p^{k-1} t \notin P\left(S_{r}\right)$.
Note that $P\left(x+p^{k-1} s\right) \equiv u+p^{k-1} s P^{\prime}(x)\left(\bmod p^{k}\right)$. Since $P\left(x+p^{k-1} s\right) \not \equiv u+p^{k-1} t$ $\left(\bmod p^{k}\right)$, the congruence $p^{k-1} s P^{\prime}(x) \equiv p^{k-1} t\left(\bmod p^{k}\right)$ has no solutions. So the congruence $s P^{\prime}(x) \equiv t(\bmod p)$ has no solutions, which contradicts $p \nmid P^{\prime}(r)$.
Since the image of $P^{m}$ consists of one element for sufficiently large $m$, we can take the smallest $m$ such that $\left|P^{m-1}\left(S_{r}\right)\right|=p^{k-1}$ for some $r \in \mathbb{Z}{p}$, but $\left|P^{m}\left(S{q}\right)\right| \leqslant p^{k-2}$ for all $q \in \mathbb{Z}_{p}$.
From now on, we fix $m$ and $r$. Since the image of $P^{m-1}\left(\mathbb{Z}{p^{k}}\right) \backslash P^{m-1}\left(S{r}\right)$ under $P$ contains $P^{m}\left(\mathbb{Z}{p^{k}}\right) \backslash P^{m}\left(S{r}\right)$, we have
thus
so
Since $f_{i, p}=1$ for sufficiently large $i$, there is exactly one $t \in \mathbb{Z}{p}$ such that $P(t) \equiv t(\bmod p)$. Moreover, as $i$ increases, the cardinality of the set $\left{s \in \mathbb{Z}{p} \mid P^{i}(s) \equiv t(\bmod p)\right}$ increases (strictly), until it reaches the value $p$. So either
Therefore, either $f_{m-1, p}=1$ or there exists a subset $X \subset \mathbb{Z}_{p}$ of cardinality at least $m$ such that $P^{m-1}(x) \equiv t(\bmod p)$ for all $x \in X$.
In the first case $\left|P^{m-1}\left(\mathbb{Z}{p^{k}}\right)\right| \leqslant p^{k-1}=\left|P^{m-1}\left(S{r}\right)\right|$, so $a=0$, a contradiction. In the second case let $Y$ be the set of all elements of $\mathbb{Z}{p^{k}}$ congruent to some element of $X$ modulo $p$. Let $Z=\mathbb{Z}{p^{k}} \backslash Y$. Then $P^{m-1}(Y) \subset S_{t}, P\left(S_{t}\right) \subsetneq S_{t}$, and $Z=\bigcup_{i \in \mathbb{Z}{p} \backslash X} S{i}$, so
Hence,
and $m<3$. Then $\left|P^{2}\left(S_{q}\right)\right| \leqslant p^{k-2}$ for all $q \in \mathbb{Z}_{p}$, so
which is impossible for $p \geqslant 5$. It remains to consider the case $p=3$. As before, let $t$ be the only residue modulo 3 such that $P(t) \equiv t(\bmod 3)$. If $3 \nmid P^{\prime}(t)$, then $P\left(S_{t}\right)=S_{t}$ by the proof of the Claim above, which is impossible. So $3 \mid P^{\prime}(t)$. By substituting $h=3^{i} s$ into the formula $P(t+h)=P(t)+h P^{\prime}(t)+h^{2} Q(t, h)$, we obtain $P\left(t+3^{i} s\right) \equiv P(t)\left(\bmod 3^{i+1}\right)$. Using induction on $i$ we see that all elements of $P^{i}\left(S_{t}\right)$ are congruent modulo $3^{i+1}$. Thus, $\left|P^{k-1}\left(S_{t}\right)\right|=1$.
Note that $f_{1,3} \leqslant 2$ and $f_{2,3} \leqslant 1$, so $P^{2}\left(\mathbb{Z}{3^{k}}\right) \subset S{t}$. Therefore, $\left|P^{k+1}\left(\mathbb{Z}{3^{k}}\right)\right| \leqslant\left|P^{k-1}\left(S{t}\right)\right|=1$. It follows that $3^{k} \leqslant 2^{k+1}$, which is impossible for $k \geqslant 2$.
Comment. Here is an alternative version of the problem. A function $f: \mathbb{Z} \rightarrow \mathbb{Z}$ is chosen so that $a-b \mid f(a)-f(b)$ for all $a, b \in \mathbb{Z}$ with $a \neq b$. Let $S_{0}=\mathbb{Z}$, and for each positive integer $m$, let $S_{m}$ denote the image of $f$ on the set $S_{m-1}$. It is given that, for each nonnegative integer $m$, there are exactly $\left\lceil n / 2^{m}\right\rceil$ distinct residues modulo $n$ in the set $S_{m}$. Find all possible values of $n$.
Answer: All powers of primes. Solution. Observe that $f$ can be regarded as a function $\mathbb{Z}{\ell} \rightarrow \mathbb{Z}{\ell}$ for any positive integer $\ell$. We use notations $f^{m}$ and $f_{m, \ell}$ as in the above solution.
Part 1. There exists a function $f: \mathbb{Z}{p^{k}} \rightarrow \mathbb{Z}{p^{k}}$ satisfying the desired properties. For $x \in \mathbb{Z}{p^{k}}$, let $\operatorname{rev}(x)$ denote the reversal of the base- $p$ digits of $x$ (we write every $x \in \mathbb{Z}{p^{k}}$ with exactly $k$ digits, adding zeroes at the beginning if necessary). Choose
where, for dividing by $2, \operatorname{rev}(x)$ is interpreted as an integer in the range $\left[0, p^{k}\right)$. It is easy to see that $f_{m+1, k}=\left\lceil f_{m, k} / 2\right\rceil$.
We claim that if $a, b \in \mathbb{Z}_{p^{k}}$ so that $p^{m} \mid a-b$, then $p^{m} \mid f(a)-f(b)$. Let $x=\operatorname{rev}(a), y=\operatorname{rev}(b)$. The first $m$ digits of $x$ and $y$ are the same, i.e $\left\lfloor x / p^{m-k}\right\rfloor=\left\lfloor y / p^{m-k}\right\rfloor$. For every positive integers $c, d$ and $z$ we have $\lfloor\lfloor z / c\rfloor / d\rfloor=\lfloor z /(c d)\rfloor=\lfloor\lfloor z / d\rfloor / c\rfloor$, so
Thus, the first $m$ digits of $\lfloor x / 2\rfloor$ and $\lfloor y / 2\rfloor$ are the same. So the last $m$ digits of $f(a)$ and $f(b)$ are the same, i.e. $p^{m} \mid f(a)-f(b)$.
Part 2. Lifting the function $f: \mathbb{Z}{p^{k}} \rightarrow \mathbb{Z}{p^{k}}$ to a function on all of $\mathbb{Z}$. We show that, for any function $f: \mathbb{Z}{p^{k}} \rightarrow \mathbb{Z}{p^{k}}$ for which $\operatorname{gcd}\left(p^{k}, a-b\right) \mid f(a)-f(b)$, there is a corresponding function $g: \mathbb{Z} \rightarrow \mathbb{Z}$ for which $a-b \mid g(a)-g(b)$ for all distinct integers $a, b$ and $g(x) \equiv f(x)\left(\bmod p^{k}\right)$ for all $x \in \mathbb{Z}$, whence the proof will be completed. We will construct the values of such a function inductively; assume that we have constructed it for some interval $[a, b)$ and wish to define $g(b)$. (We will define $g(a-1)$ similarly.)
For every prime $q \leqslant|a-b|$, we choose the maximal $\alpha_{q}$ for which there exists $c_{q} \in[a, b)$, such that $b-c_{q} \vdots q^{\alpha_{q}}$, and choose one such $c_{q}$.
We apply Chinese remainder theorem to find $g(b)$ satisfying the following conditions:
It is not hard to verify that $b-c \mid g(b)-g(c)$ for every $c \in[a, b)$ and $g(b) \equiv f(b)\left(\bmod p^{k}\right)$. Part 3. The required function does not exist if $n$ has at least two different prime divisors. The proof is identical to the polynomial version.










