Solution: 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$. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-66.jpg?height=690&width=1438&top_left_y=406&top_left_x=316)  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  $$ \Varangle(J N, N A)=\Varangle(K A, A M)=\Varangle(K X, X M)=\Varangle(M K, K X)=\Varangle(J K, K T) . $$  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. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-66.jpg?height=1155&width=1087&top_left_y=1607&top_left_x=493)  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$.


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  $$ \frac{a b+3 b+8}{a^{2}+b+3}=n $$

Solution: As $b \equiv-a^{2}-3\left(\bmod a^{2}+b+3\right)$, the numerator of the given fraction satisfies  $$ a b+3 b+8 \equiv a\left(-a^{2}-3\right)+3\left(-a^{2}-3\right)+8 \equiv-(a+1)^{3} \quad\left(\bmod a^{2}+b+3\right) $$  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  $$ 0<(a+1)^{2}<2\left(a^{2}+b+3\right) $$  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.


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  $$ (a, b, c)=\left(2 k^{2}-4 k, \quad 2 k^{2}+1, \quad 2 k^{2}+4 k\right) $$  We need a value for $k$ such that  $$ n \leqslant 2 k^{2}-4 k, \quad \text { and } \quad 2 k^{2}+4 k \leqslant 2 n $$  A concrete $k$ is suitable for all $n$ with  $$ n \in\left[k^{2}+2 k, 2 k^{2}-4 k+1\right]=: I_{k} $$  For $k \geqslant 9$ the intervals $I_{k}$ and $I_{k+1}$ overlap because  $$ (k+1)^{2}+2(k+1) \leqslant 2 k^{2}-4 k+1 $$  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.


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.

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  $$ s_{i} \geqslant i \quad \text { and } \quad d_{i}=s_{i}^{2}-s_{i-1}^{2}=\left(s_{i}+s_{i-1}\right)\left(s_{i}-s_{i-1}\right) \geqslant s_{i}+s_{i-1} \geqslant 2 i-1 $$  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  $$ s_{2}+s_{1}=s_{2}+1=d_{j} \geqslant s_{j}+s_{j-1} $$  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}$ :  $$ d_{i+1}=s_{i+1}^{2}-s_{i}^{2}=s_{i+1}^{2}-i^{2}=\left(s_{i+1}-i\right)\left(s_{i+1}+i\right) $$  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  $$ s_{i+1}+s_{i}=s_{i+1}+i=d_{j} \geqslant s_{j}+s_{j-1} $$  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,  $$ \begin{gathered} s_{i+1}+i=d_{i+1}=s_{i+1}^{2}-s_{i}^{2}=s_{i+1}^{2}-i^{2} \\ s_{i+1}^{2}-s_{i+1}=i(i+1) \end{gathered} $$  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


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.

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  $$ \begin{aligned} \text { either } \quad\left(d_{0}-d_{1}\right)+\left(d_{2}-d_{3}\right)+\cdots+\left(d_{2 t-2}-d_{2 t-1}\right) & =1+\sum_{i=1}^{t-1} r^{\alpha_{2 i}}-\sum_{i=1}^{t} r^{\alpha_{2 i-1}}, \\ \text { or } \quad\left(d_{1}-d_{2}\right)+\left(d_{3}-d_{4}\right)+\cdots+\left(d_{2 t-1}-d_{2 t}\right) & =\sum_{i=1}^{t} r^{\alpha_{2 i-1}}-\sum_{i=1}^{t} r^{\alpha_{2 i}}, \end{aligned} $$  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  $$ \sum_{i=1}^{n} r^{\beta_{i}}=\sum_{i=1}^{n-1} r^{\gamma_{i}}, \quad \beta_{i}, \gamma_{i} \in \mathbb{Z} $$  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  $$ \sum_{i=1}^{2 n-1}(-1)^{i} a^{\mu_{i}} b^{N-\mu_{i}}=0, \quad \mu_{i} \in\{0,1, \ldots, N\} $$  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  $$ 0=\sum_{i=1}^{2 n-1}(-1)^{i} a^{\mu_{i}} b^{N-\mu_{i}} \equiv \sum_{i=1}^{2 n-1}(-1)^{i} b^{\mu_{i}} b^{N-\mu_{i}}=-b^{N} \quad \bmod (a-b) $$  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  $$ 0=\sum_{i=1}^{2 n-1}(-1)^{i} a^{\mu_{i}} b^{N-\mu_{i}} \equiv \sum_{i=1}^{2 n-1}(-1)^{i}(-1)^{\mu_{i}} b^{\mu_{i}} b^{N-\mu_{i}}=S b^{N} \quad \bmod (a+b) $$  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  $$ L(x)=\sum_{i=1}^{n} x^{\beta_{i}}-\sum_{i=1}^{n-1} x^{\gamma_{i}} . $$  We can pick a sufficiently large integer $d$ so that $P(x)=x^{d} L(x)$ is a polynomial in $\mathbb{Z}[x]$. Then  $$ P(1)=1, $$  and  $$ 1 \leqslant|P(-1)| \leqslant 2021 $$  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,  $$ (p-q x) \mid P(x) $$  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$.


Prove that there are only finitely many quadruples $(a, b, c, n)$ of positive integers such that  $$ n!=a^{n-1}+b^{n-1}+c^{n-1} . $$

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,  $$ \begin{aligned} n! & =2 n(n-1)(n-2)(n-3) \cdot(3 \cdot 4 \cdots(n-4)) \\ & \leqslant 2(n-1)^{4}\left(\frac{3+\cdots+(n-4)}{n-6}\right)^{n-6}=2(n-1)^{4}\left(\frac{n-1}{2}\right)^{n-6}<\left(\frac{n-1}{2}\right)^{n-1} \end{aligned} $$  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  $$ \nu_{p}(n!)=\sum_{s=1}^{\infty}\left\lfloor\frac{n}{p^{s}}\right\rfloor $$  and a well-know corollary of this formula is that  $$ \nu_{p}(n!)<\sum_{s=1}^{\infty} \frac{n}{p^{s}}=\frac{n}{p-1} $$  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  $$ \nu_{p}(1)+\nu_{p}(2)+\cdots+\nu_{p}(n)=\nu_{p}(n!)=\nu_{p}\left(n!-c^{n-1}\right)=\nu_{p}\left(a^{n-1}+b^{n-1}\right)=\nu_{p}(a+b)+\nu_{p}(n-1) $$  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,  $$ (a, b, c, n)=(1,1,2,3),(1,2,1,3),(2,1,1,3),(2,2,2,4) $$  Comment 3. For sufficiently large $n$, the inequality $a, b, c<(n-1) / 2$ also follows from Stirling's formula.


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}$.

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  $$ 1 \cdot a_{1}+2 \cdot a_{2}+\cdots+n \cdot a_{n} \equiv 1+\cdots+n \equiv 2^{k-1} a\left(2^{k} a+1\right) \not \equiv 0 \quad\left(\bmod 2^{k}\right) $$  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  $$ \sum_{i=1}^{n} i b_{i}=\sum_{i=1}^{n} i a_{i+x} \equiv \sum_{i=1}^{n}(i-x) a_{i} \equiv r-s x \quad(\bmod n) $$  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  $$ \sum_{i=1}^{k} i b_{i} \equiv b_{1} \frac{k(k+1)}{2} \equiv 0 \quad(\bmod k) $$  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,  $$ \sum_{i=1}^{k} i a_{i} \equiv a_{1} \frac{k(k+1)}{2} \equiv 0\left(\bmod \frac{k}{2}\right) $$  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$ :  $$ \sum_{i=1}^{k}(2 i-1) a_{i} \equiv \sum_{i=1}^{k} 2 i a_{i} \equiv 2 \sum_{i=1}^{k} i a_{i} \equiv 0 \quad(\bmod 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.


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  $$ a_{n-s}+a_{n-2 s}=k $$  In particular,  $$ a_{n}=a_{n-1}+a_{n-2}=a_{n-2}+a_{n-4}=a_{n-4}+a_{n-8} $$  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).


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$.

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$,  $$ f_{m, a b}=f_{m, a} f_{m, b} $$  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$  $$ f_{m, a}>f_{m+1, a} \quad \text { or } \quad f_{m, a}=1, \quad f_{m, b}>f_{m+1, b} \quad \text { or } \quad f_{m, b}=1 . $$  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  $$ a:=\left|P^{m}\left(\mathbb{Z}_{p^{k}}\right) \backslash P^{m}\left(S_{r}\right)\right| \leqslant\left|P^{m-1}\left(\mathbb{Z}_{p^{k}}\right) \backslash P^{m-1}\left(S_{r}\right)\right|, $$  thus  $$ a+p^{k-1} \leqslant f_{m-1, p^{k}} \leqslant 2 f_{m, p^{k}} \leqslant 2 p^{k-2}+2 a, $$  so  $$ (p-2) p^{k-2} \leqslant a $$  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  $$ \left|\left\{s \in \mathbb{Z}_{p} \mid P^{m-1}(s) \equiv t \quad(\bmod p)\right\}\right|=p \quad \text { or } \quad\left|\left\{s \in \mathbb{Z}_{p} \mid P^{m-1}(s) \equiv t \quad(\bmod p)\right\}\right| \geqslant m $$  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  $$ \left|P^{m}(Y)\right| \leqslant\left|P\left(S_{t}\right)\right| \leqslant p^{k-2} \quad \text { and } \quad\left|P^{m}(Z)\right| \leqslant\left|\mathbb{Z}_{p} \backslash X\right| \cdot p^{k-2} \leqslant(p-m) p^{k-2} $$  Hence,  $$ (p-2) p^{k-2} \leqslant a<\left|P^{m}\left(\mathbb{Z}_{p^{k}}\right)\right| \leqslant\left|P^{m}(Y)\right|+\left|P^{m}(Z)\right| \leqslant(p-m+1) p^{k-2} $$  and $m<3$. Then $\left|P^{2}\left(S_{q}\right)\right| \leqslant p^{k-2}$ for all $q \in \mathbb{Z}_{p}$, so  $$ p^{k} / 4 \leqslant\left|P^{2}\left(\mathbb{Z}_{p^{k}}\right)\right| \leqslant p^{k-1} $$  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  $$ f(x)=\operatorname{rev}\left(\left\lfloor\frac{\operatorname{rev}(x)}{2}\right\rfloor\right) $$  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  $$ \left\lfloor\lfloor x / 2\rfloor / p^{m-k}\right\rfloor=\left\lfloor\left\lfloor x / p^{m-k}\right\rfloor / 2\right\rfloor=\left\lfloor\left\lfloor y / p^{m-k}\right\rfloor / 2\right\rfloor=\left\lfloor\lfloor y / 2\rfloor / p^{m-k}\right\rfloor . $$  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:  $$ \begin{aligned} & g(b) \equiv g\left(c_{q}\right) \quad\left(\bmod q^{\alpha_{q}}\right) \quad \text { for } q \neq p, \quad \text { and } \\ & g(b) \equiv g\left(c_{p}\right) \quad\left(\bmod q^{\alpha_{p}}\right) \quad \text { if } \quad \alpha_{p} \geqslant k, \quad g(b) \equiv f(b) \quad\left(\bmod p^{k}\right) \quad \text { if } \quad \alpha_{p}<k . \end{aligned} $$  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.


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: First, observe that every pair $x, y$ of real numbers for which the sum $x+y$ is integer satisfies  $$ \lfloor x\rfloor+\lfloor y\rfloor \geqslant x+y-1 $$  The inequality is strict if $x$ and $y$ are integers, and it holds with equality otherwise. We estimate the sum $S$ as follows.  $$ \begin{aligned} 2 S=\sum_{1 \leqslant i, j \leqslant n}\left(\left\lfloor\frac{i j}{n+1}\right\rfloor+\left\lfloor\frac{i j}{n+1}\right\rfloor\right)= & \sum_{1 \leqslant i, j \leqslant n}\left(\left\lfloor\frac{i j}{n+1}\right\rfloor+\left\lfloor\frac{(n+1-i) j}{n+1}\right\rfloor\right) \\ & \geqslant \sum_{1 \leqslant i, j \leqslant n}(j-1)=\frac{(n-1) n^{2}}{2} . \end{aligned} $$  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: 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  $$ (g-1) k \leqslant j \leqslant g k-1 $$  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  $$ \sum_{j=0}^{n} r_{j}=\sum_{g=1}^{d} \sum_{\ell=0}^{(n+1) / d-1} \ell d=d^{2} \cdot \frac{1}{2}\left(\frac{n+1}{d}-1\right) \frac{n+1}{d}=\frac{(n+1-d)(n+1)}{2} $$  By using (3), compute the sum $S_{i}$ of row $i$ as follows:  $$ \begin{aligned} S_{i}=\sum_{j=0}^{n}\left\lfloor\frac{i j}{n+1}\right\rfloor= & \sum_{j=0}^{n} \frac{i j-r_{j}}{n+1}=\frac{i}{n+1} \sum_{j=0}^{n} j-\frac{1}{n+1} \sum_{j=0}^{n} r_{j} \\ & =\frac{i}{n+1} \cdot \frac{n(n+1)}{2}-\frac{1}{n+1} \cdot \frac{(n+1-d)(n+1)}{2}=\frac{(i n-n-1+d)}{2} . \end{aligned} $$  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$ :  $$ S_{i} \geqslant \frac{(i n-n-1+1)}{2}=\frac{n(i-1)}{2} $$  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  $$ \sum_{i=1}^{n} S_{i} \geqslant \sum_{i=1}^{n} \frac{n}{2}(i-1)=\frac{n^{2}(n-1)}{4} $$  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.


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: 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  $$ \begin{gathered} \left(a_{1}\right)=(1), \quad\left(a_{2}, a_{3}\right)=(3,2), \quad\left(a_{4}, a_{5}, a_{6}, a_{7}\right)=(7,4,5,6) \\ \left(a_{2^{k-1}}, \ldots, a_{2^{k}-1}\right)=\left(2^{k}-1,2^{k-1}, 2^{k-1}+1, \ldots, 2^{k}-2\right) \\ \left(a_{2^{k}}, \ldots, a_{n}\right)=\left(n, 2^{k}, 2^{k}+1, \ldots, n-1\right) \end{gathered} $$  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  $$ \sum_{i=p}^{q}\left\lfloor\frac{a_{i}}{i}\right\rfloor=\left\lfloor\frac{q}{p}\right\rfloor+\sum_{i=p+1}^{q}\left\lfloor\frac{i-1}{i}\right\rfloor=1 ; $$  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  $$ \sum_{i=1}^{2^{k}}\left\lfloor\frac{b_{i}}{i}\right\rfloor \geqslant k+1 $$  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  $$ \sum_{i=1}^{2^{k+1}}\left\lfloor\frac{b_{i}}{i}\right\rfloor \geqslant \sum_{i=1}^{2^{k}}\left\lfloor\frac{b_{i}}{i}\right\rfloor+\left\lfloor\frac{b_{j}}{j}\right\rfloor \geqslant(k+1)+1 $$  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  $$ c_{1}=b_{1}, \ldots, c_{m-1}=b_{m-1}, \quad c_{m}=b_{2^{k}+1}, \quad c_{m+1}=b_{m+1}, \ldots, c_{2^{k}}=b_{2^{k}} $$  so take the first $2^{k}$ numbers but replace $b_{m}$ with $b_{2^{k}+1}$. Notice that  $$ \left\lfloor\frac{b_{m}}{m}\right\rfloor \geqslant\left\lfloor\frac{2^{k+1}}{m}\right\rfloor=\left\lfloor\frac{2^{k}+2^{k}}{m}\right\rfloor \geqslant\left\lfloor\frac{b_{2^{k}+1}+m}{m}\right\rfloor=\left\lfloor\frac{c_{m}}{m}\right\rfloor+1 $$  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  $$ \sum_{i=1}^{2^{k+1}}\left\lfloor\frac{b_{i}}{i}\right\rfloor=\sum_{i=1}^{2^{k}}\left\lfloor\frac{b_{i}}{i}\right\rfloor \geqslant \sum_{i=1}^{2^{k}}\left\lfloor\frac{c_{i}}{i}\right\rfloor+1 \geqslant(k+1)+1 $$  That proves the Claim and hence completes the solution.


Solution: 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  $$ \sum_{i=1}^{n}\left\lfloor\frac{a_{i}}{i}\right\rfloor=\sum_{i \text { is good }}^{n}\left\lfloor\frac{a_{i}}{i}\right\rfloor \geqslant \sum_{i \text { is good }}^{n}\left|\left[i, a_{i}\right] \cap P\right| \geqslant|P|=k+1 $$


Solution: We show yet another proof for the lower bound, based on the following inequality.


Determine all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfy  $$ (f(a)-f(b))(f(b)-f(c))(f(c)-f(a))=f\left(a b^{2}+b c^{2}+c a^{2}\right)-f\left(a^{2} b+b^{2} c+c^{2} a\right) $$  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  $$ H_{a, b}(x):=\left(a b^{2}+b x^{2}+x a^{2}, a^{2} b+b^{2} x+x^{2} a\right) \in \Theta $$  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  $$ g_{-}(x):=\left(a b^{2}+b x^{2}+x a^{2}\right)-\left(a^{2} b+b^{2} x+x^{2} a\right)=(a-b)(b-x)(x-a) $$  and  $$ g_{+}(x):=\left(a b^{2}+b x^{2}+x a^{2}\right)+\left(a^{2} b+b^{2} x+x^{2} a\right)=\left(x^{2}+a b\right)(a+b)+x\left(a^{2}+b^{2}\right) . $$  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  $$ f(a) f(b)(f(a)-f(b))=f\left(a^{2} b\right)-f\left(a b^{2}\right) . $$  Let $\kappa:=f(1)$ and note that $\kappa=f(1) \neq f(0)=0$ by injectivity. Putting $b=1$ in ( $\Omega$ ) we get  $$ \kappa f(a)(f(a)-\kappa)=f\left(a^{2}\right)-f(a) . $$  Subtracting the same equality for $-a$ we get  $$ \kappa(f(a)-f(-a))(f(a)+f(-a)-\kappa)=f(-a)-f(a) . $$  Now, if $a \neq 0$, by injectivity we get $f(a)-f(-a) \neq 0$ and thus  $$ f(a)+f(-a)=\kappa-\kappa^{-1}=: \lambda . $$  It follows that  $$ f(a)-f(b)=f(-b)-f(-a) $$  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  $$ (f(a)-f(b))(f(a) f(b)-f(-a) f(-b))=0 $$  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  $$ f\left(b^{2}+b x^{2}+x\right)=f\left(x^{2}+x b^{2}+b\right)+(f(b)-1)(f(x)-f(b))(f(x)-1) \geqslant 0-\left((f(b)-1)^{3} / 4\right. $$  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\}$.


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]$.


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.


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$. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-35.jpg?height=480&width=778&top_left_y=1459&top_left_x=642)  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 (a) ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-36.jpg?height=392&width=392&top_left_y=204&top_left_x=1095)  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). ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-36.jpg?height=175&width=260&top_left_y=1123&top_left_x=344)  Figure 3 ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-36.jpg?height=141&width=447&top_left_y=1157&top_left_x=716)  Figure 4 ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-36.jpg?height=161&width=453&top_left_y=1139&top_left_x=1264)  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. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-36.jpg?height=227&width=1001&top_left_y=1874&top_left_x=533)  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. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-37.jpg?height=158&width=275&top_left_y=321&top_left_x=636)  Figure 8 (a) ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-37.jpg?height=270&width=398&top_left_y=205&top_left_x=1032)  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).) ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-37.jpg?height=141&width=258&top_left_y=1363&top_left_x=294)  Figure 9 ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-37.jpg?height=183&width=304&top_left_y=1322&top_left_x=679)  Figure 10 ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-37.jpg?height=241&width=323&top_left_y=1213&top_left_x=1112) (a) ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-37.jpg?height=230&width=324&top_left_y=1213&top_left_x=1454) (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  $$ 9 m^{2} \geqslant R+B+G \geqslant 3 G+D_{R}+D_{B}-2 . $$  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. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-38.jpg?height=529&width=532&top_left_y=295&top_left_x=768)  Figure 12


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: 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: We provide a bit different proof why the example from  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


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  $$ \angle C R A=180^{\circ}-\angle A R P=180^{\circ}-\angle A Q P=\angle D Q A=\angle D C A=\angle C B A, $$  so the points $A, B, C$, and $R$ lie on some circle $\gamma$.

Solution: 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  $$ \angle R Q X=180^{\circ}-\angle A Q R=\angle R P A=\angle R C X $$  (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  $$ \angle X R C=\angle X Q C=180^{\circ}-\angle C Q A=\angle A D C=\angle B A C=180^{\circ}-\angle C R B, $$  that proves the desired collinearity. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-42.jpg?height=690&width=1169&top_left_y=1454&top_left_x=446)


Solution: Let $\alpha$ denote the circle ( $A P R Q)$. Since  $$ \angle C A P=\angle A C D=\angle A Q D=180^{\circ}-\angle A Q P $$  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  $$ \angle A R Y=\angle C A D=\angle A C B=\angle A R B, $$  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. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-43.jpg?height=1078&width=1175&top_left_y=335&top_left_x=446)


Solution: As in   Using the circle $\alpha$ and noticing that $C D$ is tangent to $\gamma$, we obtain  $$ \angle R Y A=\angle R P A=\angle R C X=\angle R B C . $$  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.


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$. ![](https://cdn.mathpix.com/cropped/2024_11_18_7107063274cfa469597ag-44.jpg?height=912&width=958&top_left_y=726&top_left_x=549)  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  $$ \begin{aligned} P_{A D T X}=X T+X A+A S+ & S D+D T=X T+X P+R T \\ & =Y Z+Y S+Q Z=Y Z+Y D+D R+R C+C Z=P_{C D Y Z} \end{aligned} $$  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  $$ X A+A D+D T=Y D+D C+C Z $$  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  $$ X B+D T=Y D+B Z . $$  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  $$ \frac{X B}{B C}=\frac{B Z}{A B}=\frac{X Z}{A C}=\lambda . $$  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  $$ \frac{D T}{A D}=\frac{D Y}{C D}=\frac{T Y}{A C}=\lambda $$  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$.


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  $$ \Sigma(\mathcal{F}) \leqslant \Sigma(\mathcal{G})=\Sigma(n) $$  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  $$ [P] \leqslant \frac{1}{2} \sum_{i=1}^{m} O A_{i}^{2} $$  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  $$ \left[O A_{i} A_{i+1}\right] \leqslant \frac{O A_{i} \cdot O A_{i+1}}{2} \leqslant \frac{O A_{i}^{2}+O A_{i+1}^{2}}{4} $$  Therefore,  $$ [P] \leqslant \sum_{i=1}^{m}\left[O A_{i} A_{i+1}\right] \leqslant \frac{1}{4} \sum_{i=1}^{m}\left(O A_{i}^{2}+O A_{i+1}^{2}\right)=\frac{1}{2} \sum_{i=1}^{m} O A_{i}^{2} $$  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  $$ \Sigma(\mathcal{F}) \leqslant \frac{1}{2} \sum_{A \in \mathrm{~S}} O A^{2}=\Sigma(\mathcal{G}) $$  which establishes the left inequality in (1).  It remains to compute $\Sigma(\mathcal{G})$. We have  $$ \begin{aligned} \Sigma(\mathcal{G})=\frac{1}{2} & \sum_{A \in S} O A^{2}=\frac{1}{2} \sum_{i=0}^{2 n-1} \sum_{j=0}^{2 n-1}\left(\left(n-\frac{1}{2}-i\right)^{2}+\left(n-\frac{1}{2}-j\right)^{2}\right) \\ & =\frac{1}{8} \cdot 4 \cdot 2 n \sum_{i=0}^{n-1}(2 n-2 i-1)^{2}=n \sum_{j=0}^{n-1}(2 j+1)^{2}=n\left(\sum_{j=1}^{2 n} j^{2}-\sum_{j=1}^{n}(2 j)^{2}\right) \\ & =n\left(\frac{2 n(2 n+1)(4 n+1)}{6}-4 \cdot \frac{n(n+1)(2 n+1)}{6}\right)=\frac{n^{2}(2 n+1)(2 n-1)}{3}=\Sigma(n) . \end{aligned} $$  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  $$ \Sigma(\mathcal{F}) \leqslant \frac{1}{2} \sum_{i=1}^{4 n^{2}} O K_{i} \cdot O L_{i} $$  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  $$ [A B C D]=\frac{A C \cdot B D}{2} \sin \phi \leqslant \frac{A C^{2}+B D^{2}}{4} $$  where $\phi$ is the angle between $A C$ and $B D$. Applying this estimate to all members in $\mathcal{F}$ we obtain  $$ \Sigma(\mathcal{F}) \leqslant \frac{1}{4} \sum_{i=1}^{2 n^{2}} A_{i} B_{i}^{2} $$  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  $$ f\left(\left(A_{i}\right),\left(B_{i}\right)\right):=\sum_{i=1}^{2 n^{2}} A_{i} B_{i}^{2} $$  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  $$ f\left(\left(A_{i}\right),\left(B_{i}\right)\right)=\sum_{i=1}^{2 n^{2}}\left(p_{i}-r_{i}\right)^{2}+\sum_{i=1}^{2 n^{2}}\left(q_{i}-s_{i}\right)^{2} $$  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:  $$ \begin{aligned} \sum_{i=1}^{2 n^{2}}\left(p_{i}-r_{i}\right)^{2}=\sum_{i=1}^{2 n^{2}}\left(2 p_{i}^{2}\right. & \left.+2 r_{i}^{2}-\left(p_{i}+r_{i}\right)^{2}\right)=4 n \sum_{j=0}^{2 n-1} j^{2}-\sum_{i=1}^{2 n^{2}}\left(p_{i}+r_{i}\right)^{2} \\ \leqslant 4 n \sum_{j=0}^{2 n-1} j^{2} & -\frac{1}{2 n^{2}}\left(\sum_{i=1}^{2 n^{2}}\left(p_{i}+r_{i}\right)\right)^{2}=4 n \sum_{j=0}^{2 n-1} j^{2}-\frac{1}{2 n^{2}}\left(2 n \cdot \sum_{j=0}^{2 n-1} j\right)^{2} \\ & =4 n \cdot \frac{2 n(2 n-1)(4 n-1)}{6}-2 n^{2}(2 n-1)^{2}=\frac{2 n^{2}(2 n-1)(2 n+1)}{3} \end{aligned} $$  All the estimates are sharp if $p_{i}+r_{i}=2 n-1$ for all $i$. Thus,  $$ f\left(\left(A_{i}\right),\left(B_{i}\right)\right) \leqslant \frac{4 n^{2}\left(4 n^{2}-1\right)}{3} $$  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  $$ \Sigma(\mathcal{F}) \leqslant \frac{1}{4} \cdot \frac{4 n^{2}\left(4 n^{2}-1\right)}{3}=\frac{n^{2}(2 n-1)(2 n+1)}{3} . $$  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.