# 2019 68th Czech and Slovak
Mathematical Olympiad First Round of the 68th Czech and Slovak Mathematical Olympiad Problems for the take-home part (October 2018) $\mathbb{N} / /(0)$ 1. Let $\left(a_{n}\right)_{n=1}^{\infty}$ be an infinite sequence such that for all positive integers $n$ we have $$ a_{n+1}=\frac{a_{n}^{2}}{a_{n}^{2}-4 a_{n}+6} $$ a) Find all values $a_{1}$ for which the sequence is constant. b) Let $a_{1}=5$. Find $\left\lfloor a_{2018}\right\rfloor$. (Vojtech Bálint) Solution. a) Assume $\left(a_{n}\right)_{n=1}^{\infty}$ is constant. Then $a_{2}=a_{1}$, hence $$ a_{1}=\frac{a_{1}^{2}}{a_{1}^{2}-4 a_{1}+6} $$ which rewrites as $a_{1}\left(a_{1}-2\right)\left(a_{1}-3\right)=0$. It follows that $a_{1} \in\{0,2,3\}$. On the other hand, once $a_{2}=a_{1}$, the sequence is clearly constant (formally e.g. by mathematical induction), thus any such $a_{1}$ indeed works. b) Let $a_{1}=5$. Using the recurrence, we obtain $a_{2} \approx 2.27, a_{3} \approx 2.49, a_{4} \approx 2.77$, and so on. This leads to the following conjecture: For any $n \geqslant 2$ we have $20, \\ & a_{n+1}-2=\frac{a_{n}^{2}}{a_{n}^{2}-4 a_{n}+6}-2=\frac{\left(6-a_{n}\right)\left(a_{n}-2\right)}{\left(a_{n}-2\right)^{2}+2}>0 . \end{aligned} $$ This proves $2\rho+v$, circle $k$ intersects line $l$ at two points $A_{1}, A_{2}$ and we get two triangles $A_{1} B_{1} C_{1}, A_{2} B_{2} C_{2}$ (Fig. 5). We count them as two separate solutions since they differ e.g. in the angle by $B$. When $r=\rho+v$, circle $k$ is tangent to line $l$, we get a single intersection $A$ and a single solution $\triangle A B C$ (by symmetry, it will be isosceles). Finally, when $r<\rho+v$, circle $k$ and line $l$ do not intersect and there is no solution. To summarize: $$ \begin{array}{ll} \sqrt{\rho^{2}+\frac{1}{4} o^{2}}>\rho+v: & \ldots 2 \text { solutions, } \\ \sqrt{\rho^{2}+\frac{1}{4} o^{2}}=\rho+v: & \ldots 1 \text { solution, } \\ \sqrt{\rho^{2}+\frac{1}{4} o^{2}}<\rho+v: & \ldots 0 \text { solutions. } \end{array} $$ ![](https://cdn.mathpix.com/cropped/2024_04_17_447c393b5df10bbb25bcg-09.jpg?height=529&width=961&top_left_y=129&top_left_x=222) Fig. 5 6. Let $n \geqslant 3$ be a positive integer. Tom and Jerry play a game on a regular $n$-gon with one vertex marked as a trap. Initially, Jerry places a piece at one vertex of the n-gon. In each subsequent step, Tom says a positive integer and Jerry moves the piece by the given number of vertices either clockwise or counterclockwise. Find all $n \geqslant 3$ such that Jerry can place the piece and then move it in such a way that it never lands in the trap. How does the answer change if Tom knows $n$ but does not see where Jerry placed the piece and how he moves it? (Pavel Calábek) Solution. Label the vertices $0,1, \ldots, n-1$ clockwise such that the trap is at vertex 0 . If the piece is at $a$ and Tom says $b$, Jerry can move the piece to vertices whose number gives remainder $a-b$ or $a+b$ when divided by $n$. First we show that when $n$ has an odd divisor $d$ then Jerry wins by using the following strategy: Place the piece at a vertex not divisible by $d$ and keep moving it such that this property is preserved. Clearly, for any odd $d$, at least one vertex not divisible by $d$ exists (e.g. vertex 1) and no such vertex is a trap. It remains to show that if $d \nmid a$ then either $d \nmid a-b$ or $d \nmid a+b$. Assume otherwise. Then $d \mid(a+b)+(a-b)=2 a$ and since $d$ is odd, we conclude $d \mid a$, a contradiction. On the other hand, we show that when $n=2^{k}$ is a power of 2 then Tom wins regardless of whether he sees Jerry's moves or not. We say that a non-trap vertex of the $n$-gon has degree $d$ if $2^{d}$ is the highest power of 2 dividing $d$. Further, we set the degree of node 0 equal to $k$. First we describe Tom's strategy when he does see Jerry's moves. The strategy is simple: If the piece is currently at a vertex with degree $d$ then Tom says $2^{d}$. The key observation is that the degree increases at each step: Indeed, if the current vertex is $2^{d} \cdot q$ ( $q$ odd) then the new one will be $2^{d} \cdot q \pm 2^{d}=2^{d} \cdot(q \pm 1)$ which is divisible by $2^{d+1}$ regardless of the sign. Thus the new vertex always has a higher degree than the current one and the trap is eventually reached. Finally, we describe Tom's strategy when he does not see Jerry's moves. All Tom's moves will be of the form $2^{i}$ for some integer $id$ then, for any odd number $q$, the remainder of $2^{d} \cdot q \pm 2^{i}$ when divided by $2^{k}$ is divisible by $2^{d}$ but not by $2^{d+1}$. Formally, Tom's strategy will be a sequence $\left(S_{k-1}, S_{k-2}, \ldots, S_{0}\right)$ of shorter subsequences $S_{i}$ which are themselves defined by a downward induction as follows: (i) $S(k-1)$ consists of a single move $2^{k-1}$. (ii) For a given $i \in\{k-2, k-1, \ldots, 1,0\}$, the subsequence $S_{i}$ consists of a move $2^{i}$ followed by the (already defined) subsequences $S_{k-1}, S_{k-2}, \ldots, S_{i+1}$ one after the other. As an example, when $k=4$ (that is, $n=16$ ), Tom's strategy consists of the moves $$ \left(2^{3}, 2^{2}, 2^{3}, 2^{1}, 2^{3}, 2^{2}, 2^{3}, 2^{0}, 2^{3}, 2^{2}, 2^{3}, 2^{1}, 2^{3}, 2^{2}, 2^{3}\right) . $$ It remains to show that this is a valid strategy for Tom. In fact, we prove a slightly stronger claim: A sequence $\left(S_{k-1}, \ldots, S_{i}\right)$ works if Jerry places the piece at any vertex with degree $d \geqslant i$. We proceed by strong downward induction on $i$. If $i=k-1$ then the claim is clear. Fix $id$, hence, by the above observation, the degree doesn't change. The first move of subsequence $S_{d}$ is $2^{d}$, hence the degree increases to some $d^{\prime}>d$. The remaining part of $S_{d}$ consists of $S_{k-1}, S_{k-2}, \ldots, S_{d+1}$. By the induction hypothesis, Tom wins after $S_{k-1}, S_{k-2}, \ldots, S_{d^{\prime}}$ at the latest. Conclusion. When $n$ is a power of two, Tom wins regardless of whether he sees the moves. Otherwise, Jerry wins. ## 1. Find all primes $p, q$ such that the equation $x^{2}+p x+q=0$ has at least one integer root.
(Patrik Bak) Solution. Denote the integer root by $a$. Then $a^{2}+p a+q=0$, hence $a \mid q$ which implies $a \in\{ \pm 1, \pm q\}$. We distinguish those four cases. $\triangleright$ If $a=-1$ then $p-q=1$, hence $(p, q)=(3,2)$. $\triangleright$ If $a=1$ then $p+q+1=0$, which has no solution. $\triangleright$ If $a=q$ then $q^{2}+p q+q=0$ and after dividing by (positive) $q$ we get $q+p+1=0$ which has already been covered. $\triangleright$ If $a=-q$ then $q^{2}-p q+q=0$ and after dividing by $q$ we get $p-q=1$ which has already been covered. The only candidate is $(p, q)=(3,2)$ and we easily check that it is indeed a valid solution. Another solution. Let $x_{1}, x_{2}$ be the roots of the equation. By Viète relations we get $x_{1}+x_{2}=-p$ and $x_{1} x_{2}=q$. The first equation implies that if one root is an integer then so is the other one. The second equation then implies that the roots are either 1 and $q$ or -1 and $-q$. In the first case we don't get any solutions, in the second case we require $p-q=1$ which gives a unique solution $(p, q)=(3,2)$ among primes. 2. Let $A B C$ be an acute triangle with $A B1$ be an integer. If it is even, then after one step we get $\frac{1}{2} a$. If it is odd, then we get $a+3$, which is even, so in the next step we get $\frac{1}{2}(a+3)$. Because of the assumption $a>1$ we have $\frac{1}{2} a3$, then even $\frac{1}{2}(a+3)1$ except for $a=3$ will decrease after at most two steps. Thus, starting from any number, in a finite number steps we reach either 1 (and then cycle $1 \rightarrow 2 \rightarrow 4 \rightarrow 1$ ) or 3 (and then cycle $3 \rightarrow 6 \rightarrow 3$ ). Observe that our step preserves the divisibility by 3: Since $a$ gives either $a+3$, or $\frac{1}{2} a$, the number after one step is divisible by 3 if and only if the number before the step is. From this we see that if the initial number is divisible by 3, then we cannot ever get 1 (in fact, according to the first paragraph, we would always get 3). On the other hand, if we initially have a number not divisible by 3 , we cannot get a number divisible by 3 , i.e. we will get 1 . In conclusion, the answer is the positive integers that are not divisible by 3 . Remark. The problem resembles the first problem of the IMO 2017. ## Second Round of the 68th Czech and Slovak Mathematical Olympiad
(January 15th, 2019) $\mathbb{N} / /(0)$ 1. Let $n$ be a positive integer. Tom and Jerry play a game on a board consisting of a row of 2018 cells. Initially, Jerry places a piece at some cell. In each subsequent step, Tom says an integer from the interval $[1, n]$ and Jerry moves the piece by the said number of cells, by his choice either to the left or to the right. Tom wins whenever Jerry cannot make a move. Find the smallest $n$ for which Tom can pick numbers such that he wins after a finite number of moves. (Josef Tkadlec) Solution. We will show the smallest such $n$ is 1010 . Suppose $n \leqslant 1009$. Then Jerry has the following simple strategy: He places the piece at an arbitrary cell and then he moves it so that he does not immediately lose. He would not be able to make such a move only if there were at most $n-1$ cells to the left and at most $n-1$ cells to the right. In that case there would be at most $2(n-1)+1=2 n-1 \leqslant 2017$ cells, which is a contradiction. Next assume $n=1010$. Label the cells $1,2, \ldots, 2018$ left to right and denote by $k$ the current position of the piece. If $k \in\{1009,1010\}$, Tom immediately wins by saying 1010. If $k<1009$, Tom can say $1009-k$. If Jerry moves right, the piece lands at a cell 1009 and Tom wins. If Jerry moves left, he moves the piece closer to the left border. Since the board is finite, Jerry cannot move left indefinitely and eventually he will have to move right and lose in the next step. Similarly, if the piece is at a cell $k>1010$, Tom wins by always saying $k-1010$. Another solution. We describe another strategy for Tom when $n=1010$. This strategy forces a win in 3 steps. As before, label the cells 1,2, . , 2018 left to right and denote the current position of the piece by $k$. If $k \in\{1009,1010\}$, Tom says 1010 and wins immediately. If $k \leqslant 504$, Tom says $1009-k$. Since $k-(1009-k)<0$, Jerry has to move right and loses in the next step. Likewise, if $k \geqslant 1515$, Tom says $k-1010$ and forces Jerry to move to 1010 and lose in the next step. Next, if $505 \leqslant k \leqslant 1008$, Tom says 1010 , which forces Jerry to move right and place the piece at a cell $k^{\prime}$ satisfying $1515 \leqslant k^{\prime} \leqslant 2018$, from which Tom can force a win in two steps as described above. Finally, if $1011 \leqslant k \leqslant 1514$, Tom says 1010, which forces Jerry to move left to a cell $k^{\prime}$ satisfying $1 \leqslant k^{\prime} \leqslant 504$. Tom again wins in two more steps. Another solution. We describe yet another strategy for Tom when $n=1010$. The strategy works even when Tom does not see the board. The strategy is simple: Tom keeps alternately saying 1010,1009 . We argue that this strategy makes Tom win. If $k \in\{1009,1010\}$, the first move makes Tom win. If $k<1009$, there is only one way for Jerry to avoid losing in the first two steps: He has to first move right and then move left. This moves the piece to $k^{\prime}=k+1$. Likewise, if $k>1010$, Jerry has to first move left and then right (or lose immediately). This yields $k^{\prime}=k-1$. Either way, after every two steps, Jerry either loses or moves the piece closer to the middle, where he eventually loses. 2. Find all pairs of integers $(m, n)$ that satisfy the equation $n^{n-1}=4 m^{2}+2 m+3$. (Tomáš Jurík) Solution. Clearly, the right-hand side is an odd integer, hence $n^{n-1}$ is also an odd integer which implies that $n$ is odd, $n-1$ is even and finally $n^{n-1}$ is a square of an integer. For $m>1$, the inequalities $(2 m)^{2}<4 m^{2}+2 m+3<(2 m+1)^{2}$ imply that the equation does not have a solution. For $m<-1$, we have the reversed inequalities $(2 m)^{2}>4 m^{2}+2 m+3>(2 m+1)^{2}$, so there are no solutions in this case either. The only remaining options are $m \in\{-1,0,1\}$; by checking each of them we find the only solution $(m, n)=(1,3)$. 3. Let $A B C$ be a triangle with $\angle B A C=90^{\circ}$. Points $D, E$ on its hypotenuse $B C$ satisfy $C D=C A, B E=B A$. Let $F$ be such a point inside $\triangle A B C$ that $D E F$ is an isosceles right triangle with hypotenuse DE. Find $\angle B F C$. (Patrik Bak) Solution. We show that $F$ is the incenter of $\triangle A B C$. Simple angle-chasing in $\triangle B F C$ then yields $\angle B F C=180^{\circ}-\frac{1}{2} B-\frac{1}{2} C=135^{\circ}$. Since $B A=B E$, triangle $B A E$ is isosceles and $\angle B A E=90^{\circ}-\frac{1}{2} \angle B$. Similarly, $\angle D A C=90^{\circ}-\frac{1}{2} \angle C$ and simple angle-chasing gives $\angle D A E=45^{\circ}$ (Fig. 1). This means that $F$ is the circumcenter of $\triangle A D E$ : Indeed, it lies in the same half-plane determined by $B C$ as $A$, and satisfies both $\angle D F E=90^{\circ}=2 \cdot 45^{\circ}=2 \angle D A E$ and $F E=F D$. Being the circumcenter of $\triangle A D E$, point $F$ lies on the perpendicular bisectors of $A E$ and $A D$ which coincide with angle bisectors of $\angle B, \angle C$. Hence we are done. ![](https://cdn.mathpix.com/cropped/2024_04_17_447c393b5df10bbb25bcg-14.jpg?height=452&width=812&top_left_y=1197&top_left_x=351) Fig. 1 Another solution. We present another way to show that $F$ is the incenter of $\triangle A B C$. Denote by $M$ the midpoint of $D E$. Using the notation $B C=a, C A=b, A B=c$ we compute $D E=b+c-a$ (Fig. 2) and $$ B M=B D+D M=(a-b)+\frac{1}{2}(b+c-a)=\frac{1}{2}(a+c-b), $$ hence $M$ is the point of contact of the incircle of $\triangle A B C$ with $B C$. Since $\triangle D E F$ is isosceles and right, we further have $M F=M D=\frac{1}{2} D E=\frac{1}{2}(b+c-a)$ which, according to a well-known formula, is the radius of an incircle of a right triangle. Thus $F$ is the incenter and we conclude as in the first solution. ![](https://cdn.mathpix.com/cropped/2024_04_17_447c393b5df10bbb25bcg-15.jpg?height=458&width=799&top_left_y=433&top_left_x=303) Fig. 2 Remark. Once the contestant formulates a hypothesis that $F$ is the incenter of $\triangle A B C$, there are many other ways to prove it. 4. Find the maximal value of $a^{2}+b^{2}+c^{2}$ for real numbers $a, b, c$ such that $a+b$, $b+c, c+a$ all lie in the interval $[0,1]$. (Ján Mazák) Solution. By symmetry of the problem, we can WLOG suppose $a \geqslant b \geqslant c$. Then both $b-c$ and $b+c$ are non-negative (by our assumptions), hence their product will also be non-negative and $b^{2} \geqslant c^{2}$. Analogously, both $1-b-a$ and $1-b+a$ are non-negative and $(1-b)^{2} \geqslant a^{2}$. Thus we have $a^{2}+b^{2}+c^{2} \leqslant(1-b)^{2}+2 b^{2}=1-b(2-3 b)$. The original restrictions on $a, b, c$ also impose certain restrictions on $b$ : we must have $1 \geqslant a+b \geqslant 2 b$ and $2 b \geqslant b+c \geqslant 0$, hence $b \in\left[0, \frac{1}{2}\right]$. But for $b$ in this interval it is clearly true that $b(2-3 b) \geqslant 0$, hence $a^{2}+b^{2}+c^{2} \leqslant 1$. This value is attained e.g. for $(a, b, c)=(1,0,0)$. Remark. Note that we are maximizing a convex function on a convex set, therefore it is sufficient only to consider the boundary values where $a+b, b+c, c+a \in\{0,1\}$. ## Final Round of the 68th Czech and Slovak Mathematical Olympiad
(March 24-27, 2019) ![](https://cdn.mathpix.com/cropped/2024_04_17_447c393b5df10bbb25bcg-16.jpg?height=163&width=382&top_left_y=274&top_left_x=576) 1. Find all triplets $(x, y, z)$ of real numbers satisfying $$ \begin{aligned} & x^{2}-y z=|y-z|+1, \\ & y^{2}-z x=|z-x|+1, \\ & z^{2}-x y=|x-y|+1 . \end{aligned} $$ (Tomáš Jurík) Solution. The system is symmetric, hence without loss of generality we can assume $x \geqslant y \geqslant z$. Removing the absolute values we get $$ \begin{aligned} & x^{2}-y z=y-z+1, \\ & y^{2}-z x=x-z+1, \\ & z^{2}-x y=x-y+1 . \end{aligned} $$ Subtracting (1) and (2), resp. (2) and (3) and rewriting we obtain $$ \begin{aligned} & (x-y)(x+y+z+1)=0 \\ & (y-z)(x+y+z-1)=0 . \end{aligned} $$ This implies that $x, y, z$ can not be all mutually different. However, they can't be all equal either as this would yield $0=1$ in the original system. Thus precisely two of them are equal and we get two cases: Either $x=y>z$ and $x+y+z=1$, or $x>y=z$ and $x+y+z=-1$. Observe that $(x, y, z)$ is a solution if and only if $(-z,-y,-x)$ is a solution, thus it suffices to solve the first case $x=y>z$ and $x+y+z=1$. Then we have $z=1-2 x$. Plugging this into (1) we obtain $x(3 x-4)=0$, hence $x=0$ or $x=\frac{4}{3}$. This corresponds to triples $(x, y, z)$ equal to $(0,0,1)$ and $\left(\frac{4}{3}, \frac{4}{3},-\frac{5}{3}\right)$. The first triplet violates the assumption $x \geqslant y \geqslant z$, the other one indeed is a solution to the original system. Together with the symmetries we discarded along the way, this gives 6 solutions: $$ \begin{gathered} \left(\frac{4}{3}, \frac{4}{3},-\frac{5}{3}\right),\left(-\frac{5}{3}, \frac{4}{3}, \frac{4}{3}\right),\left(\frac{4}{3},-\frac{5}{3}, \frac{4}{3}\right), \\ \left(\frac{5}{3},-\frac{4}{3},-\frac{4}{3}\right),\left(-\frac{4}{3},-\frac{4}{3}, \frac{5}{3}\right),\left(-\frac{4}{3}, \frac{5}{3},-\frac{4}{3}\right) . \end{gathered} $$ 2. Let $A B C D$ be a rectangle such that $A B=a \geqslant b=B C$. Construct points $P, Q$ on the line $B D$ such that $A P=P Q=Q C$. Determine the number of solutions in terms of $a, b$. (Jaroslav Svrček) Solution. Let $A^{\prime}, C^{\prime}$ be perpendicular projections of $A, C$ onto $B D$, respectively. Note that $A A^{\prime}=C C^{\prime}$ and that $A^{\prime}$ and $C^{\prime}$ are symmetric about the center $S$ of the rectangle. Fix $d>0$. We investigate whether there exist points $P, Q$ on $B D$ such that $A P=P Q=Q C=d$. Point $P$ has to lie on the line $B D$ and on the circle $k_{A}$ with center $A$ and radius $d$. Similarly, point $Q$ has to lie on the line $B D$ and on the circle $k_{C}$ with center $C$ and radius $d$. If $d
A A^{\prime}$ then $k_{A}$ intersects line $B D$ at two points. Denote by $A_{1}$ the one on the ray $A^{\prime} D$ and by $A_{2}$ the one on the ray $A^{\prime} B$. Similarly, let $B_{1}, B_{2}$ be the intersections of $k_{B}$ with rays $C^{\prime} D, C^{\prime} B$, respectively (Fig. 1). Since triangles $A A^{\prime} A_{1}$, $A A^{\prime} A_{2}, C C^{\prime} C_{1}, C C^{\prime} C_{2}$ are all congruent (HL), we have $A_{1} B_{1}=A_{2} B_{2}=A^{\prime} C^{\prime}$ and the pairs of points $\left(A_{1}, B_{2}\right)$ and $\left(A_{2}, B_{1}\right)$ are symmetric about $S$ (whereas pairs $\left(A_{1}, B_{1}\right),\left(A_{2}, B_{2}\right)$ are not). It remains to investigate which of the pairs $(P, Q) \in$ $\left\{\left(A_{1}, B_{1}\right),\left(A_{2}, B_{2}\right),\left(A_{1}, B_{2}\right),\left(A_{2}, B_{1}\right)\right\}$ are a valid solution. ![](https://cdn.mathpix.com/cropped/2024_04_17_447c393b5df10bbb25bcg-17.jpg?height=299&width=633&top_left_y=995&top_left_x=386) Fig. 1 (a) Since $A_{1} B_{1}=A_{2} B_{2}=A^{\prime} C^{\prime}$, pairs $\left(A_{1}, B_{1}\right),\left(A_{2}, B_{2}\right)$ are a valid solution if and only if $d=A^{\prime} C^{\prime}$. We obtain those two solutions whenever $A^{\prime} C^{\prime}>A A^{\prime}$. By the same computation as above, the inequality $A^{\prime} C^{\prime}>A A^{\prime}$ holds if and only if $a / b>\frac{1}{2}(1+\sqrt{5})$. To construct the solutions, we simply construct circles $k_{A}, k_{B}$ with radii $A^{\prime} C^{\prime}$ and take the appropriate intersections with line $B D$. (b) Since points $A_{1}, B_{2}$ are symmetric about $S$, a pair $\left(A_{1}, B_{2}\right)$ is a valid solution if and only if $A A_{1}=A_{1} B_{2}=2 \cdot A_{1} S$. Likewise, a pair $\left(A_{2}, B_{1}\right)$ is a valid solution if and only if $A A_{2}=2 \cdot A_{2} S$. Hence we get an extra solution for every point $X$ on $B D$ such that $A X=2 X S$. Regardless of $a$ and $b$, there are always two such points and they can be constructed for example as the intersections of line $B D$ with the Apollonius circle corresponding to points $A, S$ and ratio 2. Note that this includes the solution obtained earlier in the case $d=A A^{\prime}$. To summarize, there are two solutions when $1 \leqslant a / b \leqslant \frac{1}{2}(1+\sqrt{5})$ and four solutions when $\frac{1}{2}(1+\sqrt{5})12$ is 20 and the impossible remainders are 11,13 and 15 . Another solution. Let us examine the remainders of the expression when divided by 20 . We will show that some odd remainder cannot be attained. The remainders of numbers $3^{b}$ and $-5^{c}$ when divided by 20 are numbers from the sets $\{1,3,7,9\}$ and $\{-1,-5\}$, respectively. Sums of two numbers from these sets attain at most $4 \cdot 2=$ 8 distinct values and all of them are even. Number $2^{a}$ has an odd remainder only for $a=0$, hence the whole expression $2^{a}+3^{b}-5^{c}$ can have at most 8 odd remainders, that is, there exist at least 2 odd remainders that are not attained. Remark. There are, in fact, three such remainders, specifically 11, 13 and 15. On the other hand, one can check that any even remainder can be attained. (All the remainders that cannot be attained for $n \leqslant 30$ are visualized in the following schema.) ![](https://cdn.mathpix.com/cropped/2024_04_17_447c393b5df10bbb25bcg-20.jpg?height=735&width=1098&top_left_y=133&top_left_x=210) 6. Find all positive integers $n$ for which an $n \times n$ table can be filled with integers $1,2, \ldots, n^{2}$, each of them appearing once, so that the $2 n$ arithmetic means of the numbers in every row and column are all integers. (Laura Vištanová) Solution. Our goal is to make sure that the sum of numbers in every row and column is divisible by $n$. Thus we will restrict ourselves to filling the table with numbers $0,1, \ldots, n-1$, where each of them will be used exactly $n$ times. We will consider the following cases: $\triangleright n$ is odd. Consider the table $$ \begin{array}{|ccccc} \hline 0 & 1 & 2 & \ldots & n-1 \\ 0 & 1 & 2 & \ldots & n-1 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 1 & 2 & \ldots & n-1 \\ \hline \end{array} $$ Every column contains $n$ equal numbers hence their sums are divisible by $n$. The sum of every row is equal to $0+1+\cdots+(n-1)=\frac{1}{2} n(n-1)$, which is also a multiple of $n$, since $n$ is odd. $\triangleright n=4 k$ for some positive integer $k$. In this case we split the table $4 k \times 4 k$ into $4 k^{2}$ squares of a size $2 \times 2$ and consider the following pattern: | $x$ | $4 k-x$ | | :---: | :---: | | $4 k-x$ | $x$ | We need to place exactly $2 k$ of such squares for every $x=1,2, \ldots, 2 k-1$ and exactly $k$ of them for $x=2 k$. We are left with zeroes which we place into the $k$ remaining squares. Such a filling of the table will meet the required condition, since all the $2 \times 2$ squares have the sum of its rows and columns divisible by $4 k$ and their placement in the original table will not affect this divisibility. $\triangleright n=4 k+2$ for some non-negative integer $k$. For $k=0($ or $n=2)$ it is easy to see the required filling does not exist. Let $k \geqslant 1$. In this case, we fill the left-top $4 \times 4$ subtable like this: | 1 | $4 k+1$ | 0 | 0 | | :---: | :---: | :---: | :---: | | $2 k$ | $2 k+2$ | 0 | 0 | | $2 k+1$ | 0 | $2 k$ | 1 | | 0 | $2 k+1$ | $2 k+2$ | $4 k+1$ | We see that so far the sum of every row and column is divisible by $4 k+2$. The rest of the table can then be divided into $2 \times 2$ squares and, similarly to the previous example, filled with the pattern | $x$ | $4 k+2-x$ | | :---: | :---: | | $4 k+2-x$ | $x$ | We need exactly $2 k$ of such squares for both $x=1$ and $x=2 k$, exactly $k$ such squares for $x=2 k+1$, and exactly $2 k+1$ such squares for every $x=2, \ldots, 2 k-1$. Clearly, this filling ensures that every row and column has the sum of its numbers divisible by $4 k+2$. Now we just put the remaining zeroes into the $k-1$ remaining $2 \times 2$ squares, which does not change any sum. The required filling exists for every positive integer $n$ distinct from 2 . Another solution. We will show alternative solutions for the cases $n=4 k$ and $n=4 k+2$, where $k$ is a positive integer. $\triangleright n=4 k$ : | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | $2 k$ | $2 k$ | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | $2 k$ | $2 k$ | | $\vdots$ | $\vdots$ | $\vdots$ | $\vdots$ | $\ddots$ | $\vdots$ | $\vdots$ | $\vdots$ | $\vdots$ | | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | $2 k$ | $2 k$ | | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | 0 | 0 | | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | 0 | 0 | | $\vdots$ | $\vdots$ | $\vdots$ | $\vdots$ | $\ddots$ | $\vdots$ | $\vdots$ | $\vdots$ | $\vdots$ | | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | 0 | 0 | | 1 | $4 k-1$ | 2 | $4 k-2$ | $\ldots$ | $2 k-1$ | $2 k+1$ | 0 | 0 | We see that we can pair up the numbers in the rows into pairs with a sum divisible by $4 k$, hence the row sums are divisible by $4 k$. In the first $4 k-2$ columns we have exactly $4 k$ equal numbers, so their sum is a multiple of $4 k$ too. The sums in the last two columns are equal to $2 k \cdot 2 k=4 k^{2}$, which is also divisible by $4 k$. $\triangleright n=4 k+2$. Notice that if we have arbitrary numbers $a_{1}, a_{2}, \ldots, a_{l}$, where each one can be used exactly $l$ times, then we can place them into an $l \times l$ table so that the sum in every row and column is be the same: $$ t\left(a_{1}, a_{2}, \ldots, a_{l}\right)=\left|\begin{array}{ccccc} a_{1} & a_{2} & \ldots & a_{l-1} & a_{l} \\ a_{2} & a_{3} & \ldots & a_{l} & a_{1} \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ a_{l-1} & a_{l} & \ldots & a_{l-3} & a_{l-2} \\ a_{l} & a_{1} & \ldots & a_{l-2} & a_{l-1} \end{array}\right| $$ We use this construction in the following way: We split the set $\{0,1, \ldots, 4 k+1\} \backslash$ $\{0,2 k+1\}$ in an arbitrary way into two disjoint sets $A, B$ such that $|A|=2 k-1$ and $|B|=2 k+1$. Now we create the following four sequences, each consisting of $2 k+1$ numbers: $$ 0,0, A, \quad 2 k+1,2 k+1, A, \quad B, \quad B $$ and for every one of them we will create a table $(2 k+1) \times(2 k+1)$ using the described algorithm. Then we put these tables together into the final $(4 k+2) \times(4 k+2)$ like this: $$ \begin{array}{|cc|} \hline t(0,0, A) & t(B) \\ t(B) & t(2 k+1,2 k+1, A) \\ \hline \end{array} $$ In such a table, every number $0,1, \ldots, 4 k+1$ is used exactly $4 k+2$ times and it is readily checked that the sum of every row and column is divisible by $4 k+2$ : The sum of numbers in the sequences $A$ and $B$ is equal to $s=1+\cdots+(4 k+1)-(2 k+1)=$ $2 k(4 k+2)$, so half of the rows and columns have a sum $2 k(4 k+2)$ and the other half have a sum $(2 k+1)(4 k+2)$.