exam: BalticWay

problem:
Find all strictly increasing sequences $1=a_{1}<a_{2}<a_{3}<\cdots$ of positive integers satisfying

$$
3\left(a_{1}+a_{2}+\cdots+a_{n}\right)=a_{n+1}+a_{n+2}+\cdots+a_{2 n}
$$

for all positive integers $n$.

solution:
The strictly increasing sequence $\left(a_{n}\right)$ with $a_{n}=2 n-1$ for all $n \in \mathbb{Z}^{+}$ satisfies $a_{1}=1$ and solves the given equation, since $1+3+\cdots+(2 n-1)=n^{2}$ and $(2 n+1)+(2 n+3)+\cdots+(4 n-1)=(2 n)^{2}-n^{2}=3 n^{2}$ for all $n \in \mathbb{Z}^{+}$.

We claim that no other sequence is suitable. Let $\left(b_{n}\right)$ be a sequence that meets all requirements of the problem.

Let $k \in \mathbb{Z}^{+}$. Note that the given equation for $k$ and $k+1$ implies

$$
\begin{aligned}
& 3 \cdot \sum_{l=1}^{k} b_{\ell}=\sum_{l=k+1}^{2 k} b \ell \\
& 3 \cdot \sum_{l=1}^{k+1} b_{\ell}=\sum_{l=k+2}^{2 k+2} b_{\ell} ;
\end{aligned}
$$

the difference of the two equations yields $3 b_{k+1}=-b_{k+1}+b_{2 k+1}+b_{2 k+2}$. In other words, the equation

$$
4 b_{k+1}=b_{2 k+1}+b_{2 k+2}
$$

holds for all $k \in \mathbb{Z}^{+}$.

Equation $(*)$ implies that the numbers $b_{2 k+1}$ and $b_{2 k+2}$ have the same parity for every $k \in \mathbb{Z}^{+}$. Since $\left(b_{n}\right)$ is strictly increasing, we can deduce that $b_{2 k+2} \geq b_{2 k+1}+2$. Shifting indices we also obtain $4 b_{k+2}=b_{2 k+3}+b_{2 k+4}$ from equation $\left(^{*}\right)$. Note that $b_{2 k+3} \geq b_{2 k+2}+1 \geq b_{2 k+1}+3$. Similarly, since $b_{2 k+3}$ and $b_{2 k+4}$ must have the same parity, $b_{2 k+4} \geq b_{2 k+3}+2 \geq b_{2 k+2}+3$, so that

$$
\begin{aligned}
4 b_{k+2} & =b_{2 k+3}+b_{2 k+4} \\
& \geq\left(b_{2 k+1}+3\right)+\left(b_{2 k+2}+3\right) \\
& =4 b_{k+1}+6
\end{aligned}
$$

We can conclude that

$$
b_{k+2} \geq b_{k+1}+2 \text { for all } k \in \mathbb{Z}^{+}
$$

Now we are ready to show that $f(n)=2 n-1$ for all $n \in \mathbb{Z}^{+}$. More precisely, we use strong induction to show that $f(2 k-1)=4 k-3$ and $f(2 k)=4 k-1$ for all $k \in \mathbb{Z}^{+}$. The claim implies $f(n)=2 n-1$ for all $n \in \mathbb{Z}^{+}$.

For the start of the induction, note that we have $f(1)=1$ by definition; the given condition for $n=1$ implies $f(2)=3 f(1)=3$. Hence, the equations $f(2 k-1)=4 k-3$ and $f(2 k)=4 k-1$ are true for $k=1$.

For the induction step, let $k \geq 1$ and assume that $f(2 l-1)=4 l-3$ and $f(2 l)=4 l-1$ for all $l \in\{1, \ldots, k\}$. We want to show that $f(2 k+1)=4 k+1$ and $f(2 k+2)=$ $4 k+3$.

Since $k+1 \leq 2 k$ the induction hypothesis implies $f(k+1)=2 k+1$. Equation $(*)$ implies $f(2 k+1)+f(2 k+2)=8 k+4$. By induction hypothesis $f(2 k)=4 k-1$, so that by virtue of inequality $\left({ }^{* *}\right)$ we have $f(2 k+1) \geq 4 k+1$ and $f(2 k+2) \geq 4 k+3$. Since the sum of the two function values is $8 k+4$, we must have $f(2 k+1)=4 k+1$ and $f(2 k+2)=4 k+3$.

problem_match: Problem 1:

solution_match: Solution:


solution:
Let us prove that conversely, the condition

$$
a_{1}^{2023}+a_{2}^{2022}+\cdots+a_{2023} \leq 1+\frac{1}{2023}
$$

implies that

$$
S:=a_{1}+a_{2}^{2}+\cdots+a_{2023}^{2023}<2023 .
$$

This is trivial if all $a_{i}$ are less than 1 . So suppose that there is an $i$ with $a_{i} \geq 1$, clearly it is unique and $a_{i}<1+\frac{1}{2023}$. Then we have

$$
\begin{aligned}
a_{i}^{i} & <\left(1+\frac{1}{2023}\right)^{2023}=1+\sum_{k=1}^{2023} \frac{1}{k !} \cdot \frac{2023}{2023} \cdot \frac{2022}{2023} \ldots \cdot \frac{2023-k+1}{2023} \\
& <1+\sum_{k=1}^{2023} \frac{1}{k !} \leq 1+\sum_{k=0}^{2022} \frac{1}{2^{k}}<3, \\
\sum_{\substack{k=1, k \neq i}}^{1011} a_{k}^{k} & \leq 1011 \text { and } \sum_{\substack{k=1012, k \neq i}}^{2023} a_{k}^{k} \leq \sum_{\substack{k=1012, k \neq i}}^{2023} a_{k}^{2024-k}<\frac{1}{2023} .
\end{aligned}
$$

Hence we have

$$
S=a_{i}^{i}+\sum_{\substack{k=1, k \neq i}}^{1011} a_{k}^{k}+\sum_{\substack{k=1012, k \neq i}}^{2023} a_{k}^{k}<3+1011+\frac{1}{2023}<2023
$$

Remark: While the estimates might seem crude, the resulting bound is not so far away from the truth: If we replace 2023 by $n$ and the bound by $1+c_{n}$, then our argument shows that $c_{n} \geq \frac{1}{n}$, at least for large $n$, while the optimal bound has $c_{n} \asymp \frac{\log n}{n}$ (as in fact a slightly more careful version of our argument immediately shows!).

problem_match: Problem 2:


problem:
Denote a set of equations in the real numbers with variables $x_{1}, x_{2}, x_{3} \in \mathbb{R}$ Flensburgian if there exists an $i \in\{1,2,3\}$ such that every solution of the set of equations where all the variables are pairwise different, satisfies $x_{i}>x_{j}$ for all $j \neq i$.

Determine for which positive integers $n \geq 2$, the following set of two equations

$$
a^{n}+b=a \text { and } c^{n+1}+b^{2}=a b
$$

in the three real variables $a, b, c$ is Flensburgian.

solution:
The set of equations given in the problem statement is Flensburgian precisely when $n$ is even.

To see that it is not Flensburgian when $n \geq 3$ is odd, notice that if $(a, b, c)$ satisfies the set of equations then so does $(-a,-b,-c)$. Hence, if there exists a single solution to the set of equation where all the variables are different then the set of equations cannot be Flensburgian. This is in fact the case, e.g., consider $(a, b, c)=$ $\left(\frac{1}{2}, \frac{2^{n-1}-1}{2^{n}},\left(\frac{2^{n-1}-1}{2^{2 n}}\right)^{\frac{1}{n+1}}\right)$.

The rest of the solution is dedicated to prove that the set of equations is indeed Flensburgian when $n$ is even.

The first equation yields $b=a-a^{n} \leq a$, since $a^{n} \geq 0$ when $n$ is even. The inequality is strict whenever $a \neq 0$ and the case $a=0$ implies $b=0$, i.e. $a=b$, which we can disregard. Substituting the relation $b=a-a^{n}$ into the second equation yields

$$
\begin{aligned}
& 0=c^{n+1}+\left(a-a^{n}\right)^{2}-a\left(a-a^{n}\right)=c^{n+1}+a^{2 n}-a^{n+1}, \text { i.e. } \\
& c^{n+1}=a^{n+1}-a^{2 n}<a^{n+1}
\end{aligned}
$$

since we can disregard $a=0$ and $2 n$ is even. Since $n+1$ is odd, the polynomial $x^{n+1}$ is strictly increasing, implying that $c<a$. Hence, when $n$ is even, all solutions of the set of equations where $a, b, c$ are pairwise different satisfy $a>b$ and $a>c$.

problem_match: Problem 3:


problem:
Determine all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfy

$$
f(f(x)+y)+x f(y)=f(x y+y)+f(x)
$$

for all real numbers $x$ and $y$.

solution:
Let $P(x, y)$ denote the assertion of the given functional equation.

Claim 1: $f(0)=0$.

Proof. Note that $P(0, y)$ and $P(x, 0)$ gives us the following:

$$
\begin{aligned}
f(y+f(0)) & =f(y)+f(0) \\
f(f(x))+x f(0) & =f(0)+f(x) .
\end{aligned}
$$

Consider the first expression. Plugging $y=-f(0)$ in it yields

$$
f(-f(0)+f(0))=f(-f(0))+f(0) \text {, i.e. } f(-f(0))=0 \text {. }
$$

If we denote $-f(0)=a$, then we have $f(a)=0$. Plugging $x=a$ in the second expression gives us:

$$
f(f(a))+a f(0)=f(0)+f(a) \text {, i.e. } a f(0)=0 \text {. }
$$

This either means that $a=0$, i.e. $f(0)=0$ or $f(0)=0$. In both cases the claim is proved.

Since $f(0)=0$, the expression $P(x, 0)$ becomes

$$
f(f(x))=f(x) .
$$

Claim 2: $f(1)=1$ or $f(x)=0$ for all real numbers $x$.

Proof. Consider $P(x, 1)$ :

$$
f(f(x)+1)+x f(1)=f(x+1)+f(x) .
$$

Replacing $x$ by $f(x)$ and using $(*)$ leads to:

$$
\begin{aligned}
f(f(f(x))+1)+f(x) f(1) & =f(f(x)+1)+f(f(x)) \\
f(f(x)+1)+f(x) f(1) & =f(f(x)+1)+f(x) \\
f(x) f(1) & =f(x) .
\end{aligned}
$$

Suppose that there does not exist such $b$ that $f(b) \neq 0$, then $f(x)=0$ for all real numbers $x$. Otherwise $f(b) f(1)=f(b)$ implies $f(1)=1$ as desired.

Claim 3: If $f(1)=1$ and $f(a)=0$, then $a=0$.

Proof. Suppose $f(a)=0$ for some real number $a$. Then $P(a, 1)$ gives us

$$
\begin{aligned}
f(f(a)+1)+a f(1) & =f(a+1)+f(a) \\
f(1)+a=f(a+1) & =a+1
\end{aligned}
$$

On the other hand $P(1, a)$ leads us to the following:

$$
\begin{aligned}
f(f(1)+a)+f(a) & =f(2 a)+f(1) \\
f(a+1) & =f(2 a)+1 \\
a+1 & =f(2 a)+1 \\
f(2 a) & =a .
\end{aligned}
$$

Taking $f$ from both sides in the last relation and using $(*)$ leads to:

$$
0=f(a)=f(f(2 a))=f(2 a)=a .
$$

This proves the claim.

To finish the problem, consider $P(x, x-f(x))$ :

$$
x f(x-f(x))=f((x-f(x)) \cdot(x+1)) .
$$

Setting $x=-1$ gives us

$$
-f(-1-f(-1))=f((-1-f(-1)) \cdot 0)=f(0)=0 .
$$

From Claim 3 for $f \not \equiv 0$ we obtain that $-1-f(-1)=0$ implies $f(-1)=-1$. Now looking at $P(-1, y)$ and replacing $y$ by $y+1$, we get that

$$
f(y-1)=f(y)-1 \text { implies } f(y+1)=f(y)+1 \text {. }
$$

On the other hand, $P(x, 1)$, the previous relation and $\left(^{*}\right)$ give us the following:

$$
\begin{aligned}
f(f(x)+1)+x & =f(x+1)+f(x) \\
f(f(x))+1+x & =f(x)+1+f(x) \\
f(x)+x & =2 f(x) \\
f(x) & =x .
\end{aligned}
$$

Thus, the only possible functions that satisfy the given relation are $f(x)=x$ and $f(x)=0$. It is easy to check that they indeed solve the functional equation.

problem_match: Problem 4:


problem:
Find the smallest positive real number $\alpha$, such that

$$
\frac{x+y}{2} \geq \alpha \sqrt{x y}+(1-\alpha) \sqrt{\frac{x^{2}+y^{2}}{2}}
$$

for all positive real numbers $x$ and $y$.

solution:
Let us prove that $\alpha=\frac{1}{2}$ works. Then the following inequality should hold for all positive real numbers $x$ and $y$ :

$$
\begin{aligned}
& \frac{x+y}{2} \geq \frac{1}{2} \sqrt{x y}+\frac{1}{2} \sqrt{\frac{x^{2}+y^{2}}{2}} \\
\Longleftrightarrow & (x+y)^{2} \geq x y+\frac{x^{2}+y^{2}}{2}+2 \sqrt{x y \cdot \frac{x^{2}+y^{2}}{2}} \\
\Longleftrightarrow & (x+y)^{2} \geq 4 \sqrt{x y \cdot \frac{x^{2}+y^{2}}{2}} \\
\Longleftrightarrow & (x+y)^{4} \geq 8 x y\left(x^{2}+y^{2}\right) \\
\Longleftrightarrow & (x-y)^{4} \geq 0
\end{aligned}
$$

which is true, so we showed that $\alpha=\frac{1}{2}$ actually works.

Now it remains to show that $\alpha \geq \frac{1}{2}$. Let's consider $x=1+\varepsilon$ and $y=1-\varepsilon$ where $\varepsilon<1$. Then the inequality becomes

$$
1 \geq \alpha \sqrt{1-\varepsilon^{2}}+(1-\alpha) \sqrt{1+\varepsilon^{2}} \text {, i.e. } \alpha \geq \frac{\sqrt{1+\varepsilon^{2}}-1}{\sqrt{1+\varepsilon^{2}}-\sqrt{1-\varepsilon^{2}}} \text {. }
$$

Notice that

$$
\begin{aligned}
& \frac{\sqrt{1+\varepsilon^{2}}-1}{\sqrt{1+\varepsilon^{2}}-\sqrt{1-\varepsilon^{2}}} \\
= & \frac{\left(\sqrt{1+\varepsilon^{2}}-1\right)\left(\sqrt{1+\varepsilon^{2}}+1\right)\left(\sqrt{1+\varepsilon^{2}}+\sqrt{1-\varepsilon^{2}}\right)}{\left(\sqrt{1+\varepsilon^{2}}-\sqrt{1-\varepsilon^{2}}\right)\left(\sqrt{1+\varepsilon^{2}}+\sqrt{1-\varepsilon^{2}}\right)\left(\sqrt{1+\varepsilon^{2}}+1\right)} \\
= & \frac{\varepsilon^{2}\left(\sqrt{1+\varepsilon^{2}}+\sqrt{1-\varepsilon^{2}}\right)}{2 \varepsilon^{2}\left(\sqrt{1+\varepsilon^{2}}+1\right)}=\frac{\sqrt{1+\varepsilon^{2}}+1-1+\sqrt{1-\varepsilon^{2}}}{2\left(\sqrt{1+\varepsilon^{2}}+1\right)} \\
= & \frac{1}{2}-\frac{1-\sqrt{1-\varepsilon^{2}}}{2\left(\sqrt{1+\varepsilon^{2}}+1\right)}=\frac{1}{2}-\frac{\left(1-\sqrt{1-\varepsilon^{2}}\right)\left(1+\sqrt{1-\varepsilon^{2}}\right)}{2\left(\sqrt{1+\varepsilon^{2}}+1\right)\left(1+\sqrt{1-\varepsilon^{2}}\right)} \\
= & \frac{1}{2}-\frac{\varepsilon^{2}}{2\left(\sqrt{1+\varepsilon^{2}}+1\right)\left(1+\sqrt{1-\varepsilon^{2}}\right)}>\frac{1}{2}-\frac{\varepsilon^{2}}{4 \cdot(1+\sqrt{2})} .
\end{aligned}
$$

As $\varepsilon$ can be arbitrarily small this expression can get arbitrarily close to $\frac{1}{2}$. This means that $\alpha<\frac{1}{2}$ cannot hold, as desired.

problem_match: Problem 5:


problem: Let $n$ be a positive integer. Each cell of an $n \times n$ table is coloured in one of $k$ colours where every colour is used at least once. Two different colours $A$ and $B$ are said to touch each other, if there exists a cell coloured in $A$ sharing a side with a cell coloured in $B$. The table is coloured in such a way that each colour touches at most 2 other colours. What is the maximal value of $k$ in terms of $n$ ?

solution:
$k=2 n-1$ when $n \neq 2$ and $k=4$ when $n=2$.

$k=2 n-1$ is possible by colouring diagonally as shown in the figure below and when $n=2, k=4$ is possible by colouring each cell in a unique colour.

![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-09.jpg?height=214&width=217&top_left_y=1024&top_left_x=925)

We consider the graph, where each node represents a colour and two nodes are linked, if the colours they represent touch. This graph is connected and since each colour touches at most 2 colours every node has at most degree 2 . This means that the graph is either one long chain or one big cycle.

![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-09.jpg?height=146&width=534&top_left_y=1486&top_left_x=767)

We now look at the case when $n$ is odd. Consider the cell in the center of the table. From this cell we can get to any other cell by passing through at most $n-1$ cells. Therefore from the node representing this cell, we can get to any node through at most $n-1$ edges. But if the graph has $2 n$ or more nodes, then for every node there is a node which is more than $n-1$ edges away. So we must have $k \leq 2 n-1$ for all odd $n$.

When $n$ is even we consider the 4 center cells. If they all have a different colour, then they form a 4-cycle in the graph, meaning the graph has only 4 nodes. If two of the center cells have the same colour, then from this colour you will be able to get to all other cells passing thorugh at most $n-1$ cells. By same the arguments as in the odd case, we get $k \leq \max (2 n-1,4)$ for even $n$.

So overall we have $k \leq 2 n-1$ for $n \neq 2$ and $k \leq 4$ for $n=2$ as desired.

problem_match: Problem 6:


problem: A robot moves in the plane in a straight line, but every one meter it turns $90^{\circ}$ to the right or to the left. At some point it reaches its starting point without having visited any other point more than once, and stops immediately. What are the possible path lengths of the robot?

solution:
Let us define the coordinates system with unit length of one meter, point of origin in the starting point and vertical-horizontal axes. W.l.o.g. assume that the first move was east and the path had length of $n$. Then each odd move changed $x$ coordinate of the robot by 1 and each even move changed $y$ coordinate by 1 .

At the end of the day both coordinates were equal to zero again, so there had to be even number of odd and even number of even moves. That implies that only $n$ divisible by 4 can fulfill the conditions.

For $n=4$ we have a square path. For $n=8$ we had 4 changes of $x$ coordinate and 4 changes of $y$, so the whole path was inside some $2 \times 2$ square. Unfortunately that's not possible without reaching some point twice.

Now, we will prove that all $n>8$ divisible by 4 are good. For $n=12$ there is a path in shape of "+" with first 4 moves like $(\rightarrow, \uparrow, \rightarrow, \uparrow)$. Now we can change the middle $(\uparrow, \rightarrow)$ sequence by $(\downarrow, \rightarrow, \uparrow, \rightarrow, \uparrow, \leftarrow)$. Thanks to this change the robot explored new territory south-east from the one before explored. We got +4 of length of the path. There we can do it again and again, reaching any length of $4 k+8$ for all $k \in \mathbb{Z}^{+}$.

problem_match: Problem 7:


problem:
In the city of Flensburg there is a single, infinitely long, street with houses numbered 2, 3, .. The police in Flensburg is trying to catch a thief who every night moves from the house where she is currently hiding to one of its neighbouring houses.

To taunt the local law enforcement the thief reveals every morning the highest prime divisor of the number of the house she has moved to.

Every Sunday afternoon the police searches a single house, and they catch the thief if they search the house she is currently occupying. Does the police have a strategy to catch the thief in finite time?

solution:
We will prove that the police are always able to catch the thief in finite time.

Let $h_{i}$ denote the house the thief stays at the $i$-th night and $p_{i}$ denote the greatest prime divisor of $h_{i}$.

The police knows that she stays at different neighbouring houses every night, so $h_{i+1}-h_{i}=1$ for all non-negative integers $i$. Let us assume that the police are given the address of the thief's first two hiding spots, then we will prove by induction that the police can determine $h_{i}$ precisely except being unable to distinguish between houses numbered 2 and 4.

Assume the police knows $h_{i-2}$ and $h_{i-1}$, then they known that $h_{i}=h_{i-2}$ or $h_{i}=$ $2 h_{i-1}-h_{i-2}$. In the first case they will receive $p_{i}=p_{i-2}$ and in the latter case they will receive $p_{i}$ as the biggest prime divisor of $2 h_{i-1}-h_{i-2}$. Assume that they are unable to distinguish between these two cases, i.e., that $p_{i}=p_{i-2}$, which implies

$$
p_{i-2} \mid 2 h_{i-1}-h_{i-2} \text {, i.e. } p_{i-2} \mid 2 h_{i-1} \text {, i.e. } p_{i-2} \mid 2 \text {, i.e. } p_{i-2}=2
$$

since $h_{i-1}-h_{i-2}=1$ implies $\operatorname{gcd}\left(h_{i-1}, h_{i-1}\right)=1$. Moreover, since $p_{i}=p_{i-2}=2$ are the biggest prime divisors of $h_{i}=2 h_{i-1}-h_{i-2}$ and $h_{i-2}$ they must both be powers of 2 . However, the only powers of two with a difference of exactly 2 are 2 and 4 . Hence $\left\{h_{i-2}, 2 h_{i-1}-h_{i-2}\right\}=\{2,4\}$, i.e. $h_{i-1}=\frac{2+4}{2}=3$.

Thus, either the police will with certainty be able to determine $h_{i}$ or $h_{i-1}=3$, in which case $h_{i}$ may equal either 2 or 4 . To complete the inductive step we observe that the police are always able to determine the parity of $h_{j}$, since it changes every day. Thus, in the future if the police know that $h_{j} \in[2,4]$, then they can either determine $h_{j}=3$ or $h_{j} \in\{2,4\}$. However, the only way for the thief to leave the interval $[2,4]$ is to go to house number 5 , in which case the police will be alerted by receiving $p_{j}=5$, and they can again with certainty determine $h_{j}=5$ and $h_{j-1}=4$ preserving our inductive hypothesis.

To summarize, if the police knows both $h_{0}$ and $h_{1}$, then they can always determine $h_{i}$ with certainty until $h_{i-1}=3$. After this point they will with known the two last hiding places of the thief if she leaves the interval $[2,4]$, restoring the inductive hypothesis, or otherwise, if she never leaves $[2,4]$ be able to determine his position, up to confusion about 2 and 4 using the parity of the day.

Now, to catch the thief in finite time, they may methodically try to guess all viable pairs of $\left(h_{0}, h_{1}\right)$, i.e $h_{0}, h_{1} \in \mathbb{N}_{\geq 2}$ and $h_{0}-h_{1}=1$, of which there are countably many.

For each viable starting position, let us consider either the immediate Sunday or the one after that, since each week has an odd amount of days, we are certain that exactly one of these days gives us that the thief is hiding in an odd house (given our assumption on his starting position). Thus, due to our inductive hypothesis, we can precisely determine where the thief will be, and search this house.

If the thief is hiding in that house, the police wins, and if not, they will with certainty know that their guess of starting positions was incorrect, and move onto the next guess. By the above argument, each guess of initial starting positions requires at most two weeks, meaning that the police will catch the thief in finite time.

Remark: Note that if a week contained an even number of days then the police would not be able to guarantee that they would be able to catch the thief, if the thief moves between houses number 3 and $\{2,4\}$.

problem_match: Problem 8:


problem: Determine if there exists a triangle that can be cut into 101 congruent triangles.

solution:
Answer: Yes, there is.

Choose an arbitrary positive integer $m$ and draw a height in the right triangle with ratio of legs $1: m$. This height cuts the triangle in two similar triangles with similarity coefficient $m$. The largest of them can further be cut into $m^{2}$ smaller equal triangles by splitting all sides in $m$ equal parts and connecting corresponding points with parallel lines. Thus a triangle can be split into $m^{2}+1$ equal triangles.

The figure shows this for $m=4$, but in our problem we must take $m=10$.

![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-13.jpg?height=215&width=866&top_left_y=1089&top_left_x=595)

problem_match: Problem 9:


problem: On a circle, $n \geq 3$ points are marked. Each marked point is coloured red, green or blue. In one step, one can erase two neighbouring marked points of different colours and mark a new point between the locations of the erased points with the third colour. In a final state, all marked points have the same colour which is called the colour of the final state. Find all $n$ for which there exists an initial state of $n$ marked points with one missing colour, from which one can reach a final state of any of the three colours by applying a suitable sequence of steps.

solution:
Answer: All even numbers $n$ greater than 2 .

We show first that required initial states are impossible for odd $n$. Note that if one colour is missing then the numbers of marked points of existing two colours have different parities, i.e., the difference of these numbers is odd. Each step keeps the parity of the difference of the numbers of marked points of these two colours unchanged. Hence in every intermediate state and also in the final state, one of these two colours is represented. Consequently, a final state of the third colour is impossible.

For every even number $n>2$, an initial state with 2 consecutive points marked with one colour and $n-2$ points marked with another colour satisfies the conditions of the problem. Indeed, if $n>4$ then with two symmetric steps, one can reach a similar state where the number of points marked with the more popular colour is 2 less. Hence it suffices to solve the case $n=4$. In this case, making one step leads to a state with 3 marked points, all with different colours. In order to obtain a final state of any given colour, one can replace points of the other two colours with a new point of the given colour. This completes the solution.

## 2nd Solution:

Definition: Call a configuration colourful, if the final state may have any of the three colours.

The case of $n$ being odd is excluded as in the first solution, so let $n>2$ be even. To construct colourful configurations, we consider linear configurations, i.e. one where the points are placed on a line instead of a circle. There is only difference to the circular situaton: We may not choose the two end points for the replacement step. So it suffices to construct linear colourful configurations.

We start by providing explicit examples for $n=4$ and $n=6$ (with the bold letters being replaced):

$$
\begin{aligned}
& \mathbf{R G} R G \rightarrow B \mathbf{R G} \rightarrow B B \\
& R \mathbf{G R} G \rightarrow R \mathbf{B G} \rightarrow R R \\
& R \mathbf{G R} G \rightarrow \mathbf{R B} G \rightarrow G G \\
& \mathbf{R G} R R G R \rightarrow B R R \mathbf{G R} \rightarrow B R \mathbf{R B} \rightarrow B \mathbf{R G} \rightarrow B B \\
& R \mathbf{G R} R G R \rightarrow R B \mathbf{R G} R \rightarrow \mathbf{R B} B R \rightarrow \mathbf{G B} R \rightarrow R R \\
& R \mathbf{G R} R G R \rightarrow R B \mathbf{R G} R \rightarrow \mathbf{R B} B R \rightarrow G \mathbf{B R} \rightarrow G G .
\end{aligned}
$$

Next observe that the concatenation of several linear colourful configurations is again colourful: Indeed, each part can be transformed into the desired colour independently. So the building blocks for $n=4$ and $n=6$ can produce colourful configurations of any even length.

Actually one can prove a lot more about colourful configurations:

Proposition: Denote the number of red resp. green resp. blue points in the initial state by $R$ resp. $G$ resp. $B$. A circular configuration is colourful if and only if

$$
R \equiv G \equiv B \quad(\bmod 2)
$$

and it contains at least two colours.

Proof. We have already seen in the solution above that $R-G \bmod 2, G-B \bmod 2$ and $B-R$ mod 2 are invariants. Moreover it is obvious that we need at least two colours to be able to do anything. So the conditions are necessary.

We prove that they are sufficient: For $n=3$ the conditions require $R=G=B=1$ and the configuration indeed colourful. We continue by induction for $n>3$ : As $n>3$, there is at least one colour with more than one point, so assume wlog. $R>1$. Having at least two colours, we can find a pair of two different colours, one of which is red. Assume w.l.o.g. that the other is green. As a first step replace these two points. The resulting configuration has $R-1$ red, $G-1$ green and $B+1$ blue points, so it satisfies $R-1=G-1=B+1 \bmod 2$. Moreover due to $R>1$ is has at least one red and one blue point. So by induction the configuration is colourful, and hence so was our original state.

This classification of colourful configuration, has some nice consequences:

Proposition: If a circular configuration is colourful, then so is any permutation of its points.

Proof. Immediate.

problem_match: Problem 10:


problem:
$\quad$ Let $A B C$ be a triangle and let $J$ be the centre of the $A$-excircle. The reflection of $J$ in $B C$ is $K$. The points $E$ and $F$ are on $B J$ and $C J$, respectively, such that $\angle E A B=\angle C A F=90^{\circ}$. Prove that $\angle F K E+\angle F J E=$ $180^{\circ}$.

Remark: The $A$-excircle is the circle that touches the side $B C$ and the extensions of $A C$ and $A B$.

solution:
![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-16.jpg?height=552&width=1222&top_left_y=888&top_left_x=313)

Let $J K$ intersect $B C$ at $X$. We will prove a key claim:

Claim: $B E K$ is similar to $B A X$.

Proof. Note that $\angle E A B=90^{\circ}=\angle K X B$. Also, since $B J$ bisects $\angle C B A$, we get $\angle A B E=\angle J B X=\angle X B K$. Hence $E B A \sim K B X$. From that, we see that the spiral similarity that sends the line segment $E A$ to $K X$ has centre $B$. So the spiral similarity that sends the line segment $E K$ to $A X$ has centre $B$. Thus $B E K \sim B A X$.

In a similar manner, we get $C F K$ is similar to $C A X$.

Now, using the similar triangles and the fact that $K$ and $J$ are symmetric in $B C$, we have

$$
\begin{aligned}
\angle F K E+\angle F J E & =\angle F K E+\angle B K C \\
& =360^{\circ}-\angle E K B-\angle C K F \\
& =360^{\circ}-\angle A X B-\angle C X A \\
& =360^{\circ}-180^{\circ} \\
& =180^{\circ}
\end{aligned}
$$

as desired.

problem_match: Problem 11:


problem: Let $A B C$ be an acute triangle with $A B>A C$. The internal angle bisector of $\angle B A C$ intersects $B C$ at $D$. Let $O$ be the circumcentre of $A B C$. Let $A O$ intersect the segment $B C$ at $E$. Let $J$ be the incentre of $A E D$. Prove that if $\angle A D O=45^{\circ}$ then $O J=J D$.

solution:
Let $\alpha=\angle B A C, \beta=\angle C B A, \gamma=\angle A C B$. We have

$$
\begin{aligned}
\angle D J A & =90^{\circ}+\frac{1}{2} \angle D E A=90^{\circ}+\frac{1}{2}(\angle E B A+\angle B A E) \\
& =90^{\circ}+\frac{1}{2}\left(\beta+90^{\circ}-\gamma\right)=135^{\circ}+\frac{\beta}{2}-\frac{\gamma}{2}
\end{aligned}
$$

and

$$
\begin{aligned}
\angle D O A & =180^{\circ}-\angle O A D-\angle A D O=180^{\circ}-(\angle O A C-\angle D A C)-45^{\circ} \\
& =135^{\circ}-\left(90^{\circ}-\beta-\frac{\alpha}{2}\right)=135^{\circ}-\left(\frac{1}{2}(\alpha+\beta+\gamma)-\beta-\frac{\alpha}{2}\right) \\
& =135^{\circ}+\frac{\beta}{2}-\frac{\gamma}{2} .
\end{aligned}
$$

Therefore, $\angle D J A=\angle D O A$, hence quadrilateral $A D J O$ is cyclic. Since $A J$ is the bisector of $\angle O A D$, the $\operatorname{arcs} O J$ and $J D$ are equal. Hence $O J=J D$.

![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-17.jpg?height=416&width=531&top_left_y=1551&top_left_x=771)

## B ALTIC

problem_match: Problem 12:


problem: Let $A B C$ be an acute triangle with $A B<A C$ and incentre $I$. Let $D$ be the projection of $I$ onto $B C$. Let $H$ be the orthocentre of $A B C$. Given $\angle I D H=\angle C B A-\angle A C B$, prove that $A H=2 \cdot I D$.

solution:
Let $H^{\prime}$ be the reflection of $H$ in $B C$. It is well-known (and easy to prove) that $H^{\prime}$ lies on the circumcircle of $A B C$. Let $O$ be the circumcentre of $A B C$. We have

$$
\begin{aligned}
\angle O H^{\prime} A & =\angle H A O=\angle B A C-\angle B A H-\angle O A C \\
& =\angle B A C-2\left(90^{\circ}-\angle C B A\right)=\angle C B A-\angle A C B \\
& =\angle I D H=\angle H^{\prime} H D=\angle D H^{\prime} A,
\end{aligned}
$$

hence $O, D, H^{\prime}$ are collinear. Also note that $\angle H A O=\angle H^{\prime} H D$ implies that $A O \| H D$.

Let $M$ be the midpoint of $B C$. Let $E$ be the reflection of $D$ in $M$. We have

$$
\angle M O E=\angle D O M=\angle O H^{\prime} A=\angle H A O \text {. }
$$

Since $O M \| A H$, the above equality gives that $A, O, E$ are collinear.

Let $D^{\prime}$ be the reflection of $D$ in $I$. It is well-known (and easy to prove) that $D^{\prime}$ lies on $A E$. Since $A H \| O M$ and $A D^{\prime} \| H D$, quadrilateral $A H D D^{\prime}$ is a parallelogram. Therefore $A H=D D^{\prime}=2 \cdot I D$.

![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-18.jpg?height=591&width=580&top_left_y=1646&top_left_x=744)

problem_match: Problem 13:


problem: Let $A B C$ be a triangle with centroid $G$. Let $D, E$ and $F$ be the circumcentres of $B C G, C A G$ and $A B G$, respectively. Let $X$ be the intersection of the perpendiculars from $E$ to $A B$ and from $F$ to $A C$. Prove that $D X$ bisects the segment $E F$.

solution:
![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-19.jpg?height=591&width=511&top_left_y=755&top_left_x=356)

In all three solutions we will prove that the $D$ median coincides with the perpendicular bisector of the segment $B C$. Thus the solutions con- sist of two parts, proving that $X$ lies on the perpendicular bisector of $\mathrm{BC}$ and proving that the midpoint of $E F$ lies on the perpendicular bisector of $B C$.

The two parts may be completed independently, and in the three solutions below we demonstrate different approaches to both parts, though one can create valid solutions combining either first part with either second part.

Let $\omega_{B}, \omega_{C}$ denote the circumcircles of triangles $A B G$ and $A C G$ respectively, and the points $Y$ and $Z$ the second intersection of the line through $B$ parallel to $A C$ and $\omega_{B}$ and the second intersection of the line through $C$ parallel to $A B$ and $\omega_{C}$.

The lines $B Y$ and $C Z$ thus intersects at $A^{\prime}$, the reflection of $A$ across the midpoint of $B C$, and in particular on the $A$-median. Using Power of a Point from $A^{\prime}$ with respect to the circles $\omega_{B}$ and $\omega_{C}$ we obtain $A^{\prime} B \cdot A^{\prime} Y=A^{\prime} A \cdot A^{\prime} G=A^{\prime} C \cdot A^{\prime} E$ implying from the converse of Power of a Point that the quadrilateral $Y B C Z$ is cyclic. The perpendicular bisector of $B Y$ is orthogonal to $B Y \| A C$ and passes through $F$ and thus $X$ as well. Similarly, the perpendicular bisector of $C Z$ passes through $Z$. Hence $X$ is the centre of circle $(Y B C Z)$ and thus on the perpendicular bisector of the line $B C$.

Let $M$ and $N$ denote the midpoints of $B C$ and $E F$, respectively. To prove that $N$ lies on the perpendicular bisector of $B C$, let $V$ and $W$ denote the second intersections of $\omega_{B}$ and $\omega_{C}$ with the line $B C$, respectively.

From Power of a Point from $M$ with respect to $\omega_{B}$ and $\omega_{C}$ we obtain $M V \cdot M B=$ $M G \cdot M A=W M \cdot C M$, i.e. $M V=W M$, so $M$ is the midpoint of the segment $V W$. Let $E^{\prime}, N^{\prime}, F^{\prime}$ denote the projections of $E, N$ and $F$ onto $B C$ respectively. Since $N$ is the midpoint of $E F, N^{\prime}$ will be the midpoint of $E^{\prime} F^{\prime}$.

Moreover, from the fact that $E$ and $F$ are the centres of $\omega_{B}$ and $\omega_{C}$ we get that $E^{\prime}$ and $F^{\prime}$ are the midpoints of $B V$ and $W C$, and hence $M$ is the midpoint $E^{\prime} F^{\prime}$ as well, implying $N^{\prime}=M$ and that $N$ is on the perpendicular bisector of $B C$.
2nd Solution: Let $G^{\prime}$ denote the reflection of $G$ across the midpoint of $B C$. We begin by proving that triangles $A B C$ and $D F E$ are orthological, with orthology centres $G^{\prime}$ and $X$.

Observe that $G^{\prime}$ is on the $A$-median and thus $A G^{\prime} \perp E F$. Furthermore, quadrilateral $B G C G^{\prime}$ is a parellelogram and hence $B G^{\prime} \| C G \perp D E$ and $C G^{\prime} \| B G \perp D F$. Hence, $G^{\prime}$ is the first orthology centre of $A B C$ and $D F E$.

Thus, by the property of orthologoical triangle, the second orthology centre must exists, which is defined as the common intersection of the normal from $D$ to $B C$, $E$ to $A B$ and $F$ to $A C$, i.e. the point $X$. Since $D$ is on the perpendicular bisector of $B C$, by virtue of being the circumcentre of triangle $B G C$, and $X D \perp B C$ so must point $X$.

Moreover, let $O$ denote the circumcentre of triangle $A B C$. Then $E O \perp A C \perp$ $F X$ implies $E O \| F X$ and $F O \perp A B \perp E X$ implies $F O \| E X$, meaning that quadrilateral $F O E X$ is a parallelogram. Hence, the midpoint of $E F$ lies on the line $\overline{X O D}$ i.e. the perpendicular bisector of segment $B C$.

3rd Solution: Let $M$ be the midpoint of $B C$. Let $N$ be the intersection of $E F$ and $D M$. We claim that $N$ is the midpoint of $E F$.

Namely, we have $D E N \sim C G M$ because corresponding pairs of sides are orthogonal. Similarly, $D F N \sim B G M$. Hence

$$
\frac{E N}{N D}=\frac{G M}{M C}=\frac{G M}{M B}=\frac{F N}{N D}
$$

proving that $E N=F N$, as desired.

Next, let $X^{\prime}$ resp. $X^{\prime \prime}$ denote the intersection of $D N$ with the perpendicular from $E$ to $A B$ resp. the perpendicular from $F$ to $A C$. Just as above we have $E N X^{\prime} \sim A M B$ and $F N X^{\prime \prime} \sim A M C$, thus

$$
\frac{X^{\prime} N}{N E}=\frac{B M}{M A}=\frac{C M}{M A}=\frac{X^{\prime \prime} N}{N F}
$$

Since $N$ is the midpoint of $E F$, we get $X^{\prime} N=X^{\prime \prime} N$, hence $X^{\prime}=X^{\prime \prime}$ for orientation reasons (note that by the above similarities, $X^{\prime}$ and $X^{\prime \prime}$ must lie on the same side of $E F$ ).

This shows that $X=X^{\prime}=X^{\prime \prime}$ lies on $D N$.

Remark: That the medians of triangle $D E F$ coincide with the perpendicular bisectors of triangle $A B C$ implies that the centroid of $D E F$ coincides with the circumcentre of $A B C$. It is possible to ask for this in the problem instead, but then the problem becomes significantly easier, only requiring the second part of the first solution.

problem_match: Problem 14:

solution_match: # Solution:


problem: Let $\omega_{1}$ and $\omega_{2}$ be circles with no common points, such that neither circle lies inside the other. Points $M$ and $N$ are chosen on the circles $\omega_{1}$ and $\omega_{2}$, respectively, such that the tangent to the circle $\omega_{1}$ at $M$ and the tangent to the circle $\omega_{2}$ at $N$ intersect at $P$ and such that $P M N$ is an isosceles triangle with $P M=P N$. The circles $\omega_{1}$ and $\omega_{2}$ meet the segment $M N$ again at $A$ and $B$, respectively. The line $P A$ meets the circle $\omega_{1}$ again at $C$ and the line $P B$ meets the circle $\omega_{2}$ again at $D$. Prove that $\angle B C N=\angle A D M$.

solution:
![](https://cdn.mathpix.com/cropped/2024_04_17_4ead9738494cc20c28d3g-21.jpg?height=517&width=628&top_left_y=921&top_left_x=317)

Since $M P N$ is an isosceles triangle, we have $\angle P M A=\angle P M N=\angle M N P=\angle B N P$. By tangent and chord theorem, $\angle M C A=$ $\angle P M A=\angle B N P=\angle B D N$.

Since $\angle M C P=\angle M N P$, the quadrilateral $C M P N$ is cyclic. Analogously, from $\angle P D N=\angle P M N$, we get that $N D M P$ is cyclic. Since $C$ and $D$ both lie on the circumcircle of $N P M$, points $P, N, M, C$ and $D$ are concyclic.

From inscribed angles subtending arcs with the same length, we get that $\angle M D P=$ $\angle M C P=\angle M N P=\angle P D N=\angle P M N=\angle P C N$.

The power of $P$ with respect to $\omega_{1}$ gives us that $P M^{2}=P A \cdot P C$. The power of $P$ with respect to $\omega_{2}$ gives us that $P N^{2}=P B \cdot P D$. Since $P M=P N$, the powers of $P$ with respect to $\omega_{1}$ and $\omega_{2}$ are equal ( $P$ lies on the radical axis). Hence, $P A \cdot P C=P B \cdot P D$, which implies that $A B D C$ is cyclic. From inscribed angles subtending the $\operatorname{arc} A B$, we get that $\angle A C B=\angle A D B$.

Hence, $\angle B C N=\angle A C N-\angle A C B=\angle M D B-\angle A D B=\angle M D A$.

2nd Solution: Since $M P N$ is an isosceles triangle, we have $\angle P M A=\angle P M N=$ $\angle M N P=\angle B N P$. By tangent and chord theorem, $\angle M C A=\angle P M A=\angle B N P=$ $\angle B D N$.

Since $\angle M C P=\angle M N P$, the quadrilateral $M P N C$ is cyclic, which means that $P$ lies on the circumcircle of $M N C$. Since $M P N$ is isosceles, the perpendicular bisector of $M N$ passes through $P$. Since the intersection point of the angle bisector and the perpendicular bisector of the opposite side of the triangle lies on the circumcircle, it follows that $C P$ bisects angle $\angle M C N$. Hence, $\angle M C P=\angle P C N$. Analogously, since $\angle P D N=\angle P M N$, it follows that $N D M P$ is cyclic and the circumcircle of $M N D$, the perpendicular bisector of $M N$ and the angle bisector of $\angle M D N$ meet at $P$. Hence, $\angle M D P=\angle P D N=\angle M C P=\angle P C N$.

Now we continue as in the previous solution.

## BALTIC

problem_match: Problem 15:


problem: Prove that there exist nonconstant polynomials $f$ and $g$ with integer coefficients such that, for infinitely many primes $p$, there are no integers $x$ and $y$ with $p \mid f(x)-g(y)$.

solution:
We take $f(x)=\left(x^{2}+1\right)^{2}$ and $g(y)=-\left(y^{2}+1\right)^{2}$ and prove for all $p \equiv 3(\bmod 4)$ that $f(x) \equiv g(y)(\bmod p)$ has no solution. Famously, there are infinitely many primes congruent to 3 modulo 4 .

Recall the fact that if $p \equiv 3(\bmod 4)$ then the only solution to $a^{2}+b^{2} \equiv 0(\bmod p)$ is $a \equiv b \equiv 0(\bmod p)$. Hence, for $f(x) \equiv g(y)(\bmod p)$ to hold, we need

$$
\left(x^{2}+1\right)^{2}+\left(y^{2}+1\right)^{2} \equiv 0 \quad(\bmod p)
$$

and thus

$$
x^{2}+1 \equiv y^{2}+1 \equiv 0 \quad(\bmod p)
$$

which is impossible for $p \equiv 3(\bmod 4)$.

problem_match: Problem 16:


problem: Let $S(m)$ be the sum of the digits of the positive integer $m$. Find all pairs $(a, b)$ of positive integers such that $S\left(a^{b+1}\right)=a^{b}$.

solution:
Answer: $(a, b) \in\left\{(1, b) \mid b \in \mathbb{Z}^{+}\right\} \cup\{(3,2),(9,1)\}$.

Let $k$ denote the number of digits of $a$. Then $10^{k-1} \leq a<10^{k}$ and, therefore, $10^{(k-1) b} \leq a^{b}$ and $a^{b+1}<10^{k(b+1)}$. Of course, the digits are at most 9, so $S\left(a^{b+1}\right) \leq 9 \cdot k(b+1)$. We get

$$
10^{(k-1) b} \leq a^{b}=S\left(a^{b+1}\right) \leq 9 \cdot k(b+1) \text {, i.e. } 10^{(k-1) b} \leq 9 \cdot k(b+1)
$$

Let us consider the case where $k \geq 2$. Then $k \leq 2(k-1)$ and note that $b+1 \leq 2 b$ as $b \geq 1$. Put $(k-1) b=: x$, then $k(b+1) \leq 4(k-1) b=4 x$. So $10^{x} \leq 36 x$. It is obvious that the only solutions in nonnegative integers to this inequality are $x=0$ and $x=1$. Indeed, for $x \geq 2$, the left hand side grows faster. Therefore, either $k=1$ or $k=2$ and $b=1$.

Now we have only two cases left.

Case 1: $b=1$ and $k=2$. We are left with the equation $S\left(a^{2}\right)=a$, for $10 \leq a<100$. Then $a^{2}<10^{4}$, so $a=S\left(a^{2}\right) \leq 9 \cdot 4=36$.

Moreover, taking into account the fact that the sum of digits does not change the number modulo $9, a^{2} \equiv a(\bmod 9)$, i.e., $a(a-1) \equiv 0(\bmod 9)$, therefore $a \equiv 0(\bmod 9)$ or $a \equiv 1(\bmod 9)$. So now we are left only with numbers $a \in$ $\{10,18,19,27,28,36\}$, which we can easily check by substitution and see that there are no solutions.

Case 2: $k=1$. In the same way, looking modulo 9, we get that $a^{b+1} \equiv a^{b}(\bmod 9)$ implies $a^{b}(a-1) \equiv 0(\bmod 9)$. Therefore either $a=1$ or $a$ is divisible by 3 . $a=1$ is an obvious solution with all $b \in \mathbb{Z}^{+}$.

Otherwise, $a \in\{3,6,9\}$. But then $a^{b+1}<10^{b+1}$ and $S\left(a^{b+1}\right) \leq 9(b+1)$. Therefore, $3^{b} \leq a^{b}=S\left(a^{b+1}\right) \leq 9(b+1)$. But from $3^{b} \leq 9(b+1)$, we can conclude $b \leq 3$. Indeed, for $b \geq 4$, the left hand side increases faster. So we are left with $a \in\{3,6,9\}$ and $b \leq 3$. We check all these cases to determine that only $(a, b)=(3,2)$ or $(a, b)=(9,1)$ are solutions.

problem_match: Problem 17:


problem:
Let $p>7$ be a prime number and let $A$ be a subset of $\{0,1, \ldots, p-1\}$ consisting of at least $\frac{p-1}{2}$ elements. Show that for each integer $r$, there exist (not necessarily distinct) numbers $a, b, c, d \in A$ such that

$$
a b-c d \equiv r \quad(\bmod p)
$$

solution:
Let $P$ be the set of residues modulo of possible products $a b$, for $a, b \in A$. Clearly, we have $|P| \geq \frac{p-1}{2}$, since we get $|A|$ different products by fixing an arbitrary $0 \neq a \in A$ and let run $b$ through $A$. If $|P| \geq \frac{p+1}{2}$, then $|r+P| \geq \frac{p+1}{2}$, too. Hence, $|P|+|r+P| \geq p+1>p$, so, by the Pigeonhole Principle, $P$ and $r+P$ must have an element in common. In other words, there are $p_{1}, p_{2}$ with $p_{1} \equiv r+p_{2}(\bmod p)$ and hence $p_{1}-p_{2} \equiv r(\bmod p)$, which gives a solution of the desired shape from the definition of $P$. So the only remaining case is that of $|P|=|A|=\frac{p-1}{2}$.

Multiplying all elements of $A$ with the same constant and reducing modulo $p$, if necessary, we may assume w.l.o.g. that $1 \in A$. Then $A \subseteq P$ and hence $A=P$. This means that the product of each two non-zero elements of $A$ is an element of $A$, too. Furthermore, for a fixed $0 \neq a \in A$ the products $a b$ all differ modulolo $p$. (It follows, that for every $0 \neq a \in A$ there is a $b \in A$ with $a b \equiv 1(\bmod p)$. Hence, the non-zero elements of $A$ form a group.) Thus, if we denote $A^{\star}:=A \backslash\{0\}$, for a fixed non-zero $a \in A$ we have

$$
\prod_{b \in A^{\star}} b \equiv \prod_{b \in A^{\star}}(a b)=a^{\left|A^{\star}\right|} \cdot \prod_{b \in A^{\star}} b(\bmod p) .
$$

Hence $a^{\left|A^{\star}\right|} \equiv 1(\bmod p)$.

If $0 \in A$ we have $\left|A^{\star}\right|=\frac{p-3}{2}$. So $a^{p-3}=a^{2 \mid A^{\star}} \equiv 1(\bmod p)$. But from Fermat's little theorem we know $a^{p-1} \equiv 1(\bmod p)$, hence $a^{2} \equiv 1(\bmod p)$ and $a \equiv \pm 1(\bmod p)$. We get $\frac{p-3}{2}=\left|A^{\star}\right| \leq 2$. This is impossible for $p>7$.

Consequently, $0 \notin A$ and we have $A^{\star}=A$.

We now use the well-known fact that for every prime $p$ there exists a primitive root, that is an integer $0<q<p$ where the residues modulo $p$ of the powers $q^{1}, q^{2}$, $\ldots, q^{p-1}$ are (in some order) $1,2, \ldots, p-1$. That is, we can write every non-zero element $a \in A$ as $q^{i}$ with some $1 \leq i \leq p-1$.

If $A$ is not the set of quadratic residues modulo $p$, that is the set of residues of $q^{2 \cdot 1}$, $q^{2 \cdot 2}, \ldots, q^{2 \cdot \frac{p-1}{2}}$, then it would contain two elements with consequtive exponents, say $q^{i}$ and $q^{i+1}$. But then we have $q^{(i+1)-i}=q \in A$ and, therefore, all powers of $q$. This contradicts $|A|=\frac{p-1}{2}<p-1$. Hence $A$ exactly the set of the quadratic residues modulo $p$.

Replacing $r$ by $r+p$, if necessary, one may assume $r$ to be odd. Then we can put $b:=d:=1 \in A$, as well as

$$
a \equiv\left(\frac{r+1}{2}\right)^{2} \quad(\bmod p) \quad \text { and } \quad c \equiv\left(\frac{r-1}{2}\right)^{2} \quad(\bmod p) \text {. }
$$

Then $a, c \in A$, too. This yields

$$
a d-b c \equiv a-c \equiv\left(\frac{r+1}{2}\right)^{2}-\left(\frac{r-1}{2}\right)^{2} \equiv r \quad(\bmod p)
$$

as required.

Remark: This solution avoids using knowledge from basic group theory. But clearly, with this, it could be stated in a shorter way.

Probably the result is also very far from being sharp and the $\frac{p-1}{2}$ can be replaced by something even smaller. Determining the sharp bound (or even its order of magnitude) here is most likely a very difficult problem.

problem_match: Problem 18:


problem: Show that the sum of the digits of $2^{2^{2 \cdot 2023}}$ is greater than 2023 .

solution:
We will prove the more general statement that, for every positive integer $n$, the sum of decimal digits of $2^{2^{2 n}}$ is greater than $n$.

Let $m=2^{2 n}=4^{n}$, so that we need to consider the digits of $2^{m}$. It will suffice to prove that at least $n$ of these digits are different from 0 , since the last digit is at least 2 .

Let $0=e_{0}<e_{1}<\cdots<e_{k}$ be the positions of non-zero digits, so that $2^{m}=\sum_{i=0}^{k} d_{i} \cdot 10^{e_{i}}$ with $1 \leq d_{i} \leq 9$. Considering this number modulo $10^{e_{j}}$, for some $0<j \leq k$, the residue $\sum_{i=0}^{j-1} d_{i} \cdot 10^{e_{i}}$ is a multiple of $2^{e_{j}}$, hence at least $2^{e_{j}}$, but on the other hand it is bounded by $10^{e_{j-1}+1}$.

It follows that $2^{e_{j}}<10^{e_{j-1}+1}<16^{e_{j-1}+1}$, and hence $e_{j}<4\left(e_{j-1}+1\right)$. With $e_{0}=4^{0}-1$ and $e_{j} \leq 4\left(e_{j-1}+1\right)-1$, it follows that $e_{j} \leq 4^{j}-1$, for all $0 \leq j \leq k$. In particular, $e_{k} \leq 4^{k}-1$ and hence

$$
2^{m}=\sum_{i=0}^{k} d_{i} \cdot 10^{e_{i}}<10^{4^{k}}<16^{4^{k}}=2^{4 \cdot 4^{k}}=2^{4^{k+1}}
$$

which yields $4^{n}=m<4^{k+1}$, i.e., $n-1<k$. In other words, $2^{m}$ has $k \geq n$ non-zero decimal digits, as claimed.

problem_match: Problem 19:


problem:
Let $n$ be a positive integer. A German set in an $n \times n$ square grid is a set of $n$ cells which contains exactly one cell in each row and column. Given a labelling of the cells with the integers from 1 to $n^{2}$ using each integer exactly once, we say that an integer is a German product if it is the product of the labels of the cells in a German set.

(a) Let $n=8$. Determine whether there exists a labelling of an $8 \times 8$ grid such that the following condition is fulfilled: The difference of any two German products is always divisible by 65 .

(b) Let $n=10$. Determine whether there exists a labelling of a $10 \times 10$ grid such that the following condition is fulfilled: The difference of any two German products is always divisible by 101.

solution:
(a) No, there is no such labelling.

On the contrary, we show that for every labelling there exist two German products whose difference is not divisible by 65 . Suppose that an $8 \times 8$ square grid is labelled with the numbers $1,2, \ldots, 64$ such that no number is used twice.

We can construct a German product that is divisible by 13 by choosing a German set that includes the cell with the label 13 and seven others in different rows and columns, but otherwise arbitrarily.

We can construct a German product that is not divisible by 13 as follows. Notice that only four labels are divisible by 13, namely $13,26,39$, and 52 . These four labels are located in at most four rows; we denote the index set of these rows $R \subseteq[1,8]$. Similarly, there are at least four columns that do not contain any of these four labels; we denote the index set of these columns $C \subseteq[1,8]$. Since $R \leq C$ it is possible to choose cells of a German set from rows $R$ using only columns from $C$. The remaining cells are chosen from the remaining rows accordingly to the definition, but otherwise arbitrarily. The resulting German product is not divisible by 13 since the German set avoids the cells whose labels are divisible by 13 .

The difference of the two German products is not divisible by 13, since one German product is divisible by 13 whereas the other one is not. Hence the difference is not divisible by 65 .
(b) Yes, there is such a labelling.

For $k \in[0,99]$ we define $a_{k}=2^{k}(\bmod 101)$; in other words, $a_{k}$ is the remainder of $2^{k}$ when divided by 101. Note that $a_{k} \neq 0$ since no power of 2 is divisible by 101 . Hence $1 \leq a_{k} \leq 100$ for all $k \in[0,99]$.

We label the cells of the square grid with the numbers $a_{k}$ as follows:

| $a_{0}$ | $a_{1}$ | $a_{2}$ | $\cdots$ | $a_{9}$ |
| :---: | :---: | :---: | :---: | :---: |
| $a_{10}$ | $a_{11}$ | $a_{12}$ | $\cdots$ | $a_{19}$ |
| $a_{20}$ | $a_{21}$ | $a_{22}$ | $\cdots$ | $a_{29}$ |
| $\vdots$ | $\vdots$ | $\vdots$ | $\ddots$ | $\vdots$ |
| $a_{90}$ | $a_{91}$ | $a_{92}$ | $\cdots$ | $a_{99}$ |

More precisely, if we label the rows and columns of the chessboard by $\{0,1,2, \ldots, 9\}$, then the cell with coordinates $(i, j)$ gets the label $a_{10 i+j}$.

Note that $a_{10 i+j} \equiv 2^{10 i+j}(\bmod 101)$ and that $2^{10 i+j}=\left(2^{10}\right)^{i} \cdot 2^{j}$. Hence for this labelling any rook product is congruent to

$$
\left(2^{10}\right)^{0+1+2+\ldots+9} \cdot 2^{0+1+2+\ldots+9}
$$

modulo 101. Hence the difference of any two German products is divisible by 101 for this labelling.

It remains to show that the $a_{k}$ are pairwise different. (In more elaborate language, we would say that 2 is a primitive root modulo 101.) To do this, we denote by $s$ the smallest positive integer such that $2^{s} \equiv 1(\bmod 101)$. Using long division, we may write $100=q s+r$ with non-negative integers $q$ and $r$ such that $0 \leq r \leq s-1$. By virtue of Fermat's little theorem we have

$$
1 \equiv 2^{100} \equiv 2^{q s+r} \equiv\left(2^{s}\right)^{q} \cdot 2^{r} \equiv 1^{q} \cdot 2^{r} \equiv 2^{r} \quad(\bmod 101) .
$$

Since $r<s$ and $s$ is the smallest positive integer with $2^{s} \equiv 1(\bmod 101)$, we must have $r=0$. In other words, 100 is divisible by $s$; in other words, $s$ is a divisor of 100 .

We claim that $s=100$. If this was not the case, we would have $s \mid 20$ or $s \mid 50$, which implies that $2^{20} \equiv 1(\bmod 101)$ or $2^{50} \equiv 1(\bmod 101)$. However $2^{10}=1024 \equiv 14(\bmod 101)$, so that $2^{20} \equiv 14^{2} \equiv 196 \equiv-6 \not \equiv 1(\bmod 101)$ and $2^{50} \equiv\left(2^{20}\right)^{2} \cdot 2^{10} \equiv(-6)^{2} \cdot 14 \equiv 504 \equiv-1$ 丰 $1(\bmod 101)$.

Now assume that $k, \ell \in[0,99]$ are positive integers with $k>\ell$ and $a_{k}=a_{\ell}$. Then we have $2^{k} \equiv 2^{\ell}(\bmod 101)$ and $0 \equiv 2^{k}-2^{\ell} \equiv 2^{\ell} \cdot\left(2^{k-\ell}-1\right)(\bmod 101)$. Since $2^{\ell}$ and 101 are coprime, it follows that $2^{k-\ell}-1 \equiv 0(\bmod 101)$ and $2^{k-\ell} \equiv 1(\bmod 101)$. This cannot be true, since $k-\ell \in[1,99]$, but $s=100$ is the smallest positive integer with $2^{s} \equiv 1(\bmod 101)$. Hence $a_{k} \neq a_{\ell}$.

We conclude that the numbers $a_{k}$ with $k \in[0,99]$ are a hundred pairwise different numbers from the set $[1,100]$, hence they are a permutation of the set $[1,100]$ as it was required.
2nd Solution:

Definition: Let $p$ be a prime. Consider an $n \times n$ square grid of elements $a_{i, j} \in \mathbb{F}_{p}^{*}$ (for $i, j=1, \ldots, n$ ), which are not necessarily distinct. We call it rooky, if all its German products are equal as elements in $\mathbb{F}_{p}^{*}$.

We will provide a classification of all rooky square grids. Of course, most of this is not necessary when writing down a solution to the given problem, but it may still be interesting...

Lemma: A square grid is rooky if and only if for all $i, j, k, \ell$ :

$$
a_{i, j} \cdot a_{k, \ell}=a_{i, \ell} \cdot a_{k, j}
$$

Proof. If we swap the rows of two cells in a German set and keep their columns, it turns one valid German set into another. When comparing their German products, we can ignore all $n-2$ labels of cells that were not moved. The remaining values are $a_{i, j} \cdot a_{k, \ell}$ resp. $a_{i, \ell} \cdot a_{k, j}$ for certain $i, j, k, \ell$. This gives equality (1) for rooky square grids.

Conversely assume that (1) holds. Then we have to compare two arbitrary German products. But they can transformed into each other by a sequence of several swaps of two cells. Due to (1) the German product does not change at any of these steps, so the rook products of the original configurations are the same as well.

Lemma: A rooky square grid is uniquely determined by the elements of its first row and first column.

Proof. Indeed the previous lemma implies that

$$
a_{i, j} \cdot a_{1,1}=a_{i, 1} \cdot a_{1, j}
$$

which determines $a_{i, j}$ uniquely because $a_{1,1}$ is a unit.

One can actually prove directly that the square grid obtained that way is rooky, but it is simpler to continue directly to

Proposition: Let $\lambda_{i} \in \mathbb{F}_{p}^{*}(i=1, \ldots, n)$ and $\mu_{j} \in \mathbb{F}_{p}^{*}(j=1, \ldots, n)$ arbitrary elements. Then the square grid with

$$
a_{i, j}=\lambda_{i} \cdot \mu_{j}
$$

is rooky. Moreover any rooky square grid can be obtained this way.

Proof. The square grid with $a_{i, j}=\lambda_{i} \cdot \mu_{j}$ is rooky, because any German product has the value

$$
\prod_{i} \lambda_{i} \cdot \prod_{j} \mu_{j} .
$$

## B ALTIC
 Way
 FLENSBURG 2023

Let us prove the converse: By the previous lemma, it suffices to find $\lambda_{i} \mathrm{~s}$ and $\mu_{j} \mathrm{~s}$ that recreate the values of the first row and column. For this simply set $\lambda_{i}=a_{i, 1}$ and $\mu_{j}=\frac{a_{1, j}}{a_{1,1}}$.

Proposition: For any prime $p>n^{2}$, there exists a rooky square grid with only distinct elements.

Proof. Choose any primitive root $\alpha \in \mathbb{F}_{p}^{*}$. Then set $\lambda_{i}=\alpha^{i-1}, \mu_{j}=\alpha^{n \cdot(j-1)}$ and $a_{i, j}=\lambda_{i} \cdot \mu_{j}=\alpha^{i-1+n \cdot(j-1)}$. This provides indeed a rooky square grid. The values in the square are $\alpha^{0}, \alpha^{1}, \ldots, \alpha^{n^{2}-1}$. As we have chosen a primitive root, these are all distinct.

For $n=10, p=101$ and $\alpha=2$, this reproduces exactly the construction given in the previous solution.

problem_match: Problem 20: