20 21 15th Middle European Mathematical Olympiad Croatia # Problems and Solutions ## The Problem Selection Committee The Jury and the Problem Selection Committee selected 12 problems proposed by the following countries: Problem I-1 Czech Republic Problem I-2 Slovakia Problem I-3 Slovakia Problem I-4 Czech Republic Problem T-1 Austria Problem T-2 Croatia Problem T-3 Czech Republic Problem T-4 Hungary Problem T-5 Austria Problem T-6 Poland Problem T-7 Croatia Problem T-8 Slovakia ## Contents I Individual Competition ..... 1 Problem I-1 ..... 2 First Solution ..... 2 Second Solution ..... 2 Third Solution ..... 2 Problem I-2 ..... 4 First Solution ..... 4 Second Solution ..... 4 Problem I-3 ..... 6 First solution ..... 6 Second solution ..... 7 Third Solution ..... 7 Problem I-4 ..... 9 Solution ..... 9 II Team Competition ..... 10 Problem T-1 ..... 11 Solution ..... 11 Problem T-2 ..... 12 Solution ..... 12 Problem T-3 ..... 14 Solution ..... 14 Problem T-4 ..... 15 Solution ..... 15 Problem T-5 ..... 17 Solution ..... 17 Problem T-6 ..... 19 First Solution ..... 19 Second Solution ..... 20 Third Solution ..... 20 Problem T-7 ..... 21 Solution ..... 21 Problem T-8 ..... 22 Solution ..... 22 ## Part I ## Individual Competition
August 25, 2021 ## Problem I-1 Determine all real numbers $A$ such that every sequence of non-zero real numbers $x_{1}, x_{2}, \ldots$ satisfying $$ x_{n+1}=A-\frac{1}{x_{n}} $$ for every integer $n \geqslant 1$, has only finitely many negative terms. Answer. All $A \geq 2$ satisfy the given property. ## First Solution Let us assume that $A \geqslant 2$ holds and there is some $n \geqslant 1$ with $x_{n}<0$. Then $x_{n+1}>A \geqslant 2$. We claim that $x_{n+k}>1$ for all $k \geq 1$. This is easily proven by induction: we already did this for $k=1$, and the induction step follows from $$ x_{n+k+1}=A-\frac{1}{x_{n+k}}>A-1 \geqslant 1 $$ Hence, there is at most one negative term if $A \geqslant 2$. Let us assume that $A<2$ holds and there is a sequence $\left(x_{n}\right)$ such that $x_{n}>0$ for all $n \geqslant N$. We write $$ x_{n+2}+2 \leqslant x_{n+2}+x_{n+1}+\frac{1}{x_{n+1}}=x_{n+1}+A $$ hence $x_{n+2} \leqslant x_{n+1}+(A-2)$ and thus $x_{n+k}<0$ for large enough $k$, contradiction. ## Second Solution The case $A \geqslant 2$ is handled as in the above solution. In the case $A<2$ assume that only finitely many members of the sequence are positive. Without loss of generality we can assume all members are positive. We have that $$ x_{n+1}=A-\frac{1}{x_{n}}0$. As we have that the sequence is bounded below by 0 and bounded above, we have that it has a limit, denote it $L>0$. Taking the limit of the recursive relation we obtain $$ L=A-\frac{1}{L} \Longrightarrow A=L+\frac{1}{L} \geqslant 2 $$ which is a contradiction. ## Third Solution The case $A \geqslant 2$ is handled as in the above solution. Let us assume that there is a sequence $\left(x_{n}\right)$ such that $x_{n}>0$ for all $n \geqslant N$. Without loss of generality, we may assume that $x_{n}>0$ for all $n \geqslant 0$. Summing the first $n$ equalities we obtain $$ x_{2}+\ldots+x_{n+1}+\frac{1}{x_{1}}+\ldots+\frac{1}{x_{n}}=n A $$ Since $x_{k}+\frac{1}{x_{k}} \geqslant 2$ for $k=2, \ldots, n$, we get $$ 0 \leqslant x_{n+1}+\frac{1}{x_{1}} \leqslant n A-2(n-1)=2-n(2-A) $$ For large enough $n$ this expression is negative so we get a contradiction. ## Problem I-2 Let $m$ and $n$ be positive integers. Some squares of an $m \times n$ board are coloured red. A sequence $a_{1}, a_{2}, \ldots, a_{2 r}$ of $2 r \geqslant 4$ pairwise distinct red squares is called a bishop circuit if for every $k \in\{1, \ldots, 2 r\}$, the squares $a_{k}$ and $a_{k+1}$ lie on a diagonal, but the squares $a_{k}$ and $a_{k+2}$ do not lie on a diagonal (here $a_{2 r+1}=a_{1}$ and $a_{2 r+2}=a_{2}$ ). In terms of $m$ and $n$, determine the maximum possible number of red squares on an $m \times n$ board without a bishop circuit. (Remark. Two squares lie on a diagonal if the line passing through their centres intersects the sides of the board at an angle of $45^{\circ}$.) ## First Solution Obviously, for the tables $1 \times n$ and $n \times 1$, the largest number of black cells is $n$. Therefore, we assume that $m \geq 2$ a $n \geq 2$ for the rest of the solution. In the table $m \times n$, we can color the first two rows, the first column and the last column, which is $2 m+2 n-4$ black cells in total. It is easy to see that such a table contains no bishop circuit. Now we show that if there is no bishop circuit, there are at most $2 m+2 n-4$ black cells in the table $m \times n$. We denote the cell in $i$-th row and $j$-th column by $(i, j)$. The $k$-th positive diagonal is a set of cells $(i, j)$, such that $i+j-1=k$. Similarly, the $k$-th negative diagonal is a set of cells $(i, j)$, such that $n+i-j=k$. Consider a bipartite graph $G$ with partitions $$ A=\left\{a_{1}, a_{2}, \ldots, a_{m+n-1}\right\} \quad \text { and } \quad B=\left\{b_{1}, b_{2}, \ldots, b_{m+n-1}\right\} $$ where the vertices $a_{i}$ and $b_{j}$ are connected by an edge if and only if the cell in the intersection of the $i$-th positive diagonal and the $j$-th negative diagonal is black. Notice that a bishop circuit corresponds to a circuit in $G$ and vice versa. The graph $G$ has at least two components: If we color the cells of the table alternately green and red like in chess, then the edges of $G$ corresponding to green cells lie in a different component that the edges of $G$ corresponding to red cells - it is not possible to move a bishop between a green and a red cell. Furthermore, $G$ has $2 n+2 m-2$ vertices. If $G$ is acyclic, then $G$ is a forest consisting of at least two trees. Therefore, $G$ contains at most $2 n+2 m-2-2=2 n+2 m-4$ edges and that is the upper bound on the number of black cells we wanted to prove. ## Second Solution Denote by $S$ the coloring configuration from the first proof consisting of the first two rows and the first and the last column of the table. It is easy to see that $S$ does not contain the bishop circle. Also, $S$ is maximal in the sense that if we add any new cell to it, the new coloring will contain a bishop circle. We will show that any optimal coloring $C$ has the same number of cells as $S$ by transforming $C$ to $S$ by iterating the following steps: 1) First we choose any cell $a$ which is in $S$, but not in $C$. If there is no such cell, we are done since maximality of $S$ and optimality of $C$ imply that $S=C$. 2) From the optimality of $C$ it follows that there is a bishop circle $B$ in the coloring $C \cup\{a\}$ containing $a$. Since $S$ does not contain a bishop circle, there is an element $b$ in cycle $B$ which is not in $S$. We replace coloring $C$ with the coloring $\tilde{C}=$ $(C \cup\{a\}) \backslash\{b\}$. To finish the proof, we need to show that $\tilde{C}$ is optimal. For that we need to prove that $B$ is a unique cycle in $C \cup\{a\}$ containing $a$. Assume the opposite. Let $a_{0}, a, a_{1}, \ldots a_{2 r}$ and $b_{0}, a, b_{1}, \ldots b_{2 s}$ be two bishop cycles in $C \cup\{a\}$ such that $a_{0}$ and $b_{1}$ (as well as $a_{1}$ and $b_{0}$ ) are on the same diagonal. Consider the cycle in $C$ (every two consecutive cells are on the same diagonal) $$ a_{0}, b_{1}, b_{2}, \ldots, b_{2 s}, b_{0}, a_{1}, a_{2}, \ldots, a_{2 r} $$ It remains to prove that it contains a bishop circle which will contradict the optimality of $C$. Note that no three consecutive cells are on the same diagonal, so the only problem is if the cells are not pairwise different. Thus we can assume that we can write the cycle in the following form $$ c_{1}, \ldots c_{k}, c_{1}, d_{1}, d_{2}, \ldots, d_{t-1} $$ where $t \geq k$. If we remove first $k$ cells we obtain the cycle $$ c_{1}, d_{1}, d_{2}, \ldots, d_{t-1} $$ Furthermore, if $d_{t-1}, c_{1}$ and $d_{1}$ are on the same diagonal, we remove $c_{1}$. By repeating this procedure, we end up with the bishop's circuit. ## Problem I-3 Let $A B C$ be an acute triangle and $D$ an interior point of segment $B C$. Points $E$ and $F$ lie in the half-plane determined by the line $B C$ containing $A$ such that $D E$ is perpendicular to $B E$ and $D E$ is tangent to the circumcircle of $A C D$, while $D F$ is perpendicular to $C F$ and $D F$ is tangent to the circumcircle of $A B D$. Prove that the points $A, D, E$ and $F$ are concyclic. ## First solution Denote by $T$ the intersection point of $B E$ and $C F$. Clearly, $D, E, F, T$ are concyclic because of the right angle $D E T$ and $T F D$. ![](https://cdn.mathpix.com/cropped/2024_06_05_bec995c17505bb1ad46ag-10.jpg?height=783&width=954&top_left_y=1005&top_left_x=611) The tangent line $D E$ gives $\angle A D E=\angle A C D$. Similarly $\angle F D A=\angle D B A$, therefore $\angle F D E=180^{\circ}-\angle B A C$. This gives $$ \angle B T C=\angle E T F=180^{\circ}-\angle E D F=180^{\circ}-\left(180^{\circ}-\angle B A C\right)=\angle B A C $$ which means that $B, C, A, T$ are also concyclic. With this we have $$ \angle A T E=\angle A T B=\angle A C B=\angle A C D=\angle A D E $$ which shows that $A, E, D, T$ are also concyclic. Therefore all points $A, D, E, F, T$ are concyclic. ## Second solution Denote the angles of $A B C$ conventionally by $\alpha, \beta, \gamma$, also let $\angle B A D=x$ and $\angle D A C=y$. As in the previous solution, notice that $\angle F D E=180^{\circ}-\alpha$. It is enough to show that $\angle E A F=\alpha$. Because of the tangent line $D E$, it holds that $\angle D B E=90^{\circ}-\angle E D B=90^{\circ}-y$, and analogously $\angle F C D=90^{\circ}-x$. We will show that it cannot happen that both points $E$ and $F$ lie inside or outside $A B C$. If they both were outside, we would have $\angle D B E>\angle A B D$ and $\angle F C D>\angle A C D$, in other words $90^{\circ}-y>\beta$ and $90^{\circ}-x>\gamma$. The sum of these inequalities gives $180^{\circ}-x-y>\beta+\gamma$, which is a contradiction, since $x+y=\alpha$. Analogously, $E, F$, cannot be both inside. ![](https://cdn.mathpix.com/cropped/2024_06_05_bec995c17505bb1ad46ag-11.jpg?height=828&width=977&top_left_y=997&top_left_x=631) Without loss of generality assume that $E$ is not outside $A B C$ (i.e. it is inside or on $A B$ ) and $F$ is not inside (i.e. it is outside or an $A C$ ). In order to show that $\angle E A F=\alpha$, it remains to show that triangles $A E B$ and $A F C$ are similar. We have $\angle E B A=\beta-\left(90^{\circ}-x\right)$ and $\angle F C A=\left(90^{\circ}-y\right)-\gamma$. These two angles are equal, since $$ \beta-\left(90^{\circ}-x\right)-\left(\left(90^{\circ}-y\right)-\gamma\right)=x+y+\beta+\gamma-180^{\circ}=\alpha+\beta+\gamma-180^{\circ}=0 $$ Now we can finish the proof by calculating ratios: $$ \frac{B E}{C F}=\frac{B D \cdot \sin y}{C D \cdot \sin x}=\frac{B D}{\sin x} \cdot \frac{\sin y}{C D}=\frac{A B}{\sin \angle A D B} \cdot \frac{\sin \angle A D C}{A C}=\frac{A B}{A C} $$ ## Third Solution Let $G$ be the point on the line $F D$ such that the quadrilateral $A D C G$ is cyclic. Since $D F$ is tangent to the circumcircle of $A B D$ we have $\angle G A C=\angle G D C=\angle D A B$. Similarly, since $D E$ is tangent to the circumcircle of $A C D$ we have $\angle G C A=\angle G D A=$ $\angle F D A=\angle D B A$. We hence conclude that the triangles $A B D$ and $A C G$ are spirally similar with center at $A$. ![](https://cdn.mathpix.com/cropped/2024_06_05_bec995c17505bb1ad46ag-12.jpg?height=594&width=1076&top_left_y=751&top_left_x=410) Additionally, since $\angle F G C=\angle D G C=\angle D A C=\angle B D E$ and $\angle B E D=\angle C F G=90^{\circ}$ (and thus $\triangle B E D \sim \triangle C F G$ ), we have that the same spiral similarity maps the point $E$ to point $F$. From this we get $\angle E A F=\angle B A C$. Since $D E$ and $D F$ are tangent to the circumcircles of $A C D$ and $A B D$ respectively, we also have $\angle A D E=\angle A C D$ and $\angle F D A=\angle D B A$. Therefore, $$ \angle F D E=\angle F D A+\angle A D E=\angle D B A+\angle A C D=180^{\circ}-\angle B A C $$ By combining the above equalities, we get that $\angle E A F=\angle B A C=180^{\circ}-\angle F D E$ and thus $A, D, E, F$ are concyclic, as desired. ## Problem I-4 Let $n \geqslant 3$ be an integer. Zagi the squirrel sits at a vertex of a regular $n$-gon. Zagi plans to make a journey of $n-1$ jumps such that in the $i$-th jump, it jumps by $i$ edges clockwise, for $i \in\{1, \ldots, n-1\}$. Prove that if after $\left\lceil\frac{n}{2}\right\rceil$ jumps Zagi has visited $\left\lceil\frac{n}{2}\right\rceil+1$ distinct vertices, then after $n-1$ jumps Zagi will have visited all of the vertices. (Remark. For a real number $x$, we denote by $\lceil x\rceil$ the smallest integer larger or equal to $x$.) ## Solution Number the vertices $0,1, \ldots, n-1$ clockwise starting at the vertex Zagi is on. After his $i$-th jump Zagi will be at a vertex numbered $1+2+\cdots+i=\frac{i(i+1)}{2}(\bmod n)$. We need to prove that if for all $k \in\left\{0,1,2, \ldots,\left\lceil\frac{n}{2}\right\rceil\right\}$ the fractions $\frac{k(k+1)}{2}$ achieve different values modulo $n$ then they achieve different values modulo $n$ even for all $k \in\{0,1,2, \ldots, n-1\}$. We will in fact prove two following claims: - for numbers of the form $n=2^{r}$, with $r \geq 2$, all $k \in\{0,1,2, \ldots, n-1\}$ the fractions $\frac{k(k+1)}{2}$ achieve different values mod $n$; - for numbers of the form $n=2^{r} \cdot l$, with $r \geq 0$ and $l \geq 3$ odd, we have that there exist distinct $a, b \in\left\{0,1,2, \ldots,\left\lceil\frac{n}{2}\right\rceil\right\}$ such that $\frac{a(a+1)}{2} \equiv \frac{b(b+1)}{2}(\bmod n)$. Let us firstly observe $n$ of the form $2^{r}$, with $r \geq 2$. Let as assume that there are $1 \leq$ $bm>0$, we have $0 \leq bP\left(i_{j}\right)$. Note that $P$ is continuous, so by the intermediate value theorem, there exists $y \in\left(i_{j}, x\right)$ such that $P(y)=\min \left(\frac{P(x)+P\left(i_{j}\right)}{2}, P\left(i_{j}\right)+\frac{1}{2}\right) \in\left(P\left(i_{j}\right), P\left(i_{j}\right)+1\right)$. By continuity of $P$, there exists $\delta>0$ such that $(y-\delta, y+\delta) \subseteq S_{j}$. By ( ††), S(P) is infinite, which is a contradiction. Claim 3. For each $1 \leqslant j \leqslant k, P^{\prime}$ has at least $2\left|S_{j}\right|$ zeroes in $\left(i_{j}, i_{j}+1\right)$. Proof: Indeed, fix $j \in\{1, \ldots, k\}$ and let $S_{j}=\left\{x_{1}, \ldots, x_{m}\right\}$, where we may assume $i_{j}x$ coins, the other $b-1$ bags in the $b$-tuple containing $a$ coins in total. Then we have $a+x0$, then $k(k p+1)=(p+1)(2 p+1)$. Firstly, after observing the equation modulo $p$ we can deduce that $p \mid k-1$. Secondly, the equation can be written as quadratic equation in $p$ : $$ 2 p^{2}+\left(3-k^{2}\right) p+1-k=0 $$ Its discriminant is $D=\left(k^{2}-3\right)^{2}+8(k-1)$. If $k=1$ we obtain $n=p$, but this does not lead to any solution. If $k>1$, then $D$ is strictly greater than $\left(k^{2}-3\right)^{2}$. To be a perfect square, $D$ must be greater than or equal to $\left(k^{2}-2\right)^{2}$. Hence we obtain $$ \left(k^{2}-3\right)^{2}+8(k-1) \geq\left(k^{2}-2\right)^{2} \Longrightarrow 2(k-2)^{2} \geq 5 $$ which holds only for $k=1,2,3$. The case $k=1$ is already solved. The case $k=2$ implies that $p \mid 2-1=1$, which leads to contradiction. In the case $k=3$, we similarly obtain that $p$ must be equal to 2 , but the pair $(k, p)=(3,2)$ does not satisfy the equation $k(k p+1)=(p+1)(2 p+1)$. In the second case, if $p \mid n+1$, then we again introduce positive integer $k$ such that $n+1=k p$ and obtain equation $k(k p-1)=(p+1)(2 p+1)$. Now we have that $p \mid k+1$, and the quadratic equation in terms of $p$ is $$ 2 p^{2}+\left(3-k^{2}\right) p+1+k=0 $$ It discriminant $D=\left(k^{2}-3\right)^{2}-8(k+1)$ is less than $\left(k^{2}-3\right)^{2}$, so it must be less than or equal to $\left(k^{2}-4\right)^{2}$ : $$ \left(k^{2}-3\right)^{2}-8(k+1) \leq\left(k^{2}-4\right)^{2} \Longrightarrow 2(k-2)^{2} \leq 23 $$ We conclude $k \leq 5$. Since $p \mid k+1$, we have that $p$ divides one of the numbers $2,3,4,5,6$, so we have $p \in\{2,3,5\}$. After we plug in those choices for $p$ in (2), we obtain the only solution $(n, p)=(5,2)$. ## Problem T-8 Prove that there are infinitely many positive integers $n$ such that $n^{2}$ written in base 4 contains only digits 1 and 2 . ## Solution We prove that there are infinitely many $n$ 's such that $n^{2}$ written in base 4 contains only 1 and 2 , with the first and last digit being 1 . One example is $n=5$, for which $n^{2}=25=121_{4}$. Now we describe how for given such $n$ we can obtain another, bigger one, which satisfies these requirements as well. Let $n^{2}$ have $k$ digits in base 4 and satisfy aforementioned requirements. Now let us consider the number $n^{\prime}=2^{2 k-1} n+n$. Then we have $$ n^{\prime 2}=\left(2^{2 k-1} n+n\right)^{2}=4^{2 k-1} n^{2}+2 \cdot 2^{2 k-1} n^{2}+n^{2}=4^{2 k-1} n^{2}+4^{k} n^{2}+n^{2} $$ In base 4 this number consists of three copies of $n^{2}$, with the first one $\left(n^{2}\right)$ ending on the right, the second one $\left(4^{k} n^{2}\right)$ ending right before the beginning of first one and the third one ( $4^{2 k-1} n^{2}$ ) overlapping by its last digit with first digit of second one. As both first and last digit of $n^{2}$ are 1 , in this place 2 digits 1 get summed to digit 2. Otherwise there are no other places where two non-zero digits would overlap, neither is there any 'empty space' which would get filled by zeros, so $n^{\prime 2}$ contains only digits 1 and 2. Furthermore, first and last digit of ${n^{\prime 2}}^{2}$ is same as first and last digit of $n^{2}$, so this property also remains. By repeating this construction one gets an infinite sequence of numbers satisfying the problem statement.