Problem 1. The sides of an equilateral triangle are intersected by a pair of parallel lines. Given also the size of the angle marked in the picture, determine the size of the one denoted by the question mark (in degrees). ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-01.jpg?height=411&width=1148&top_left_y=254&top_left_x=454) Result. 169 Solution. Since the lines are parallel and using the fact that the sum of the three interior angles of any triangle equals $180^{\circ}$, we easily compute that the angles in the small triangle cut from the equilateral one by the lower line are $60^{\circ}$, $180^{\circ}-71^{\circ}=109^{\circ}$ and $180^{\circ}-109^{\circ}-60^{\circ}=11^{\circ}$ and hence the sought angle equals $180^{\circ}-11^{\circ}=169^{\circ}$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-01.jpg?height=503&width=1424&top_left_y=908&top_left_x=316) Problem 2. Adele has one T-shirt and one skirt of each of the seven colours: red, blue, green, yellow, black, orange and purple. She wants always to wear a T-shirt and a skirt of different colour. Also, if wearing a red piece of clothes, she wants the second piece to be yellow. How many such outfits can Adele form? Result. 32 Solution. There are $6 \cdot 6$ outfits using only colours different from red, 6 from them have the same colour twice. Then there are two outfits using red and yellow. The result is hence $36-6+2=32$. Problem 3. The sum of six distinct positive integers is 22 . What is their product? Result. 840 Solution. The lowest possible sum of six distinct positive integers is $1+2+3+4+5+6=21$. As the desired sum is just one higher, the only possibility is $1+2+3+4+5+7=22$ as adding one to any other integer produces two integers of the same value. $1 \cdot 2 \cdot 3 \cdot 4 \cdot 5 \cdot 7=840$ Problem 4. How many identical blocks $6 \times 15 \times 20$ are needed at least to build a full cube if all the blocks must be oriented in the same way? Result. 120 Solution. The orientation condition tells us that the side length of any such cube must be divisible by $6=2 \cdot 3$, $15=3 \cdot 5$ and $20=2 \cdot 2 \cdot 5$, hence also by $2 \cdot 2 \cdot 3 \cdot 5=60$, which is clearly a valid side length itself. The number of blocks is then $\frac{60^{3}}{6 \cdot 15 \cdot 20}=120$. Problem 5. Sophie drew a line segment of unit length and then she wanted to construct a right triangle with area equal to 0.2 using the segment as one of its sides. At that moment she realized that it could be done in several ways. In how many? Result. 8 Solution. Let $A, B$ be the endpoints of Sophie's segment. Note that the altitude from the third vertex $C$ to side $A B$ must equal 0.4 (so that $\frac{1 \cdot 0.4}{2}=0.2$ is the desired area). It follows that $C$ must lie on one of the two parallel lines to the line $A B$. If the right angle occurs at $A, C$ must also lie on a line perpendicular to $A B$ and going through $A$. Its intersections with both of the parallel lines mentioned above make the first two solutions $C_{1}$ and $C_{2}$ in the figure. Similarly, if the right angle is located at $B$, we obtain solutions $C_{3}$ and $C_{4}$. If the right angle lies at vertex $C$, the Thales theorem says that this is equivalent to $C$ lying on a circle with diameter $A B$. Since $0.4<\frac{1}{2}$, there are four distinct intersections $C_{5}, C_{6}, C_{7}$ and $C_{8}$, none coinciding with the previously obtain points, showing that altogether there are eight ways.with the pair of parallel lines. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-02.jpg?height=477&width=920&top_left_y=498&top_left_x=568) Problem 6. Each letter in the following cryptogram stands for a different nonzero digit. Calculate $B A C$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-02.jpg?height=184&width=264&top_left_y=1113&top_left_x=902) Result. 732 Solution. From the third column we can see that adding $A+B$ to $C$ still gives the last digit $C$, which means $A+B=10$. Now looking at the second column we already know that we have one carry, so we are adding $A+B+C+1=11+C=\overline{1 A}=10+A$ as the sum is clearly larger than just $A$. That gives $C+1=A$. The addition from the first column thus reads $A+A+1=B$. We now have three equations for $A, B$ and $C$, which solve to $A=3$, $B=7$ and $C=2$ and thus the answer is $B A C=732$. Problem 7. A tasty number is a positive integer such that the product of its digits equals 36. Let $a$ and $b$ be numbers defined as follows. - $a$ is the sum of digits of the smallest possible tasty number, - $b$ is the smallest possible sum of digits of a tasty number. Evaluate the difference $a-b$. Result. 3 Solution. Note that 36 factors as $36=2 \cdot 2 \cdot 3 \cdot 3$. The smallest tasty number must also have the smallest possible number of digits. Since the latter cannot be equal to one, it is sufficient to consider and compare the two-digit tasty numbers, one example being 66. To find the smallest one, which would then also be the smallest tasty number, one must make first digit $d$ (a divisor of 36) as small as possible whereas $\frac{36}{d}$ (the second digit) must not exceed 9. That yields the tasty number 49 with the sum of the digits equal to 13 . To find a tasty number with the smallest possible sum of digits, note that erasing all occurrences of the digit 1 decreases the sum of the digits and keeps the product unchanged. Since $d_{1}+d_{2} \leq d_{1} \cdot d_{2}$ holds for any digits $d_{1}, d_{2}>1$, we conclude that the smallest possible sum of digits is achieved (not only, though) by 2233 and equals 10. The sought difference is thus $13-10=3$. Problem 8. One day, robots have completed the first base on Mars with room for 100 people and since then they were expanding it to take 10 more people after every month. On the same day, the first Mars shuttle set out from the Earth to bring 20 colonists to the base after 7 months of journey. That was the first one from $n$ identical missions scheduled to launch $0,1,2, \ldots, n-1$ months after the initial day. Determine the maximum possible $n$ so that the capacity is never exceeded. Result. 16 Solution. Seven months after the initial day, the first 20 people came and then, in general, $k$ months after the beginning $20(k-6)$ new people came, $k \geq 7$. In that time, the capacity of the base was $100+10 k$ which gives us the inequality $$ 20(k-6) \leq 100+10 k $$ which can easily be simplified into the form $$ k \leq 22 $$ Launch of this latest possible mission (note that we have just proved that there could not be any more and also that smaller $k$ makes no trouble) happened seven months earlier showing that the longest possible launch schedule was $0,1, \ldots, 15=22-7$ months after the beginning. It follows that the largest possible $n$ equals 16 . Problem 9. In the picture, there is a rectangle divided into three smaller rectangles. Determine the area of the middle one given the areas of the other two and the two marked lengths. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-03.jpg?height=365&width=528&top_left_y=720&top_left_x=770) Result. 42 Solution. Let us denote the height of the rectangles by $h$ and the sought area by $A$. Then $30+A=9 h$ and $A+14=7 h$. This system of equations solves to $h=8$ and $A=42$. Problem 10. Marek and Lukáš decided to challenge each other: If any of them submits a wrong answer to a Náboj problem with number $n$, he must do $10 n$ push-ups. Náboj has 42 tasks. Marek looked only at problems with numbers divisible by 5 and Lukáš worked only on problems with numbers having remainder 1 when divided by 5 . Given that both of them submitted at least one wrong answer, no problem was answered incorrectly twice, and Marek did the same number of push-ups as Lukáš, what is the minimum possible number of push-ups Marek could have done? Result. 550 Solution. Since Marek solves only problems whose number is divisible by 5 , the number of push-ups each of them did is divisible by 50 . As Lukáš solved only problems with numbers that have remainder 1 when divided by 5 , he must have done at least 5 wrong submissions to obtain a number of push-ups divisible by 50 . Assuming that Lukáš submitted wrong answers for problems 1, 6, 11, 16 and 21 and Marek's wrong submissions were 10, 20 and 25 , each of them had done 550 push-ups and. Since 1, 6, 11, 16, and 21 is the 5 -tuple of problems solved by Lukáš with the least possible sum of problem numbers, 550 is the minimum of push-ups Marek has done. Problem 11. In a group of nine friends, some have lent money to others. One day, they decided to get rid of those debts. The table shows the balances for each pair of the friends, e.g. A owes 5 to $B$. If a transaction means that one person gives some money to another person, determine the smallest possible number of transactions needed to settle all | | | | | | | | | | | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | | 0 | -5 | -1 | 0 | | | 5 | 2 | 4 | | | 5 | 0 | 3 | - | | | 2 | 1 | -4 | | | 1 | -3 | 0 | $\mid-0$ | | | 6 | -3 | 0 | | | 0 | u | | | -8 | -4 | 7 | 2 | 1 | | | | -1 | -2 | | | 1 | -11 | 4 | - | | | | 0 | -3 | 121 | -4 | 0 | 6 | -4 | 0 | | | | -2 | -6 | $\mid-7$ | 11 | -6 | 0 | -1 | 10 | | | | -7 | 3 | $\mid-2$ | -4 | | 1 | 0 | 4 | | | | 4 | 0 | $\mid-1$ | | | -5 | -4 | 0 | the debts. Solution. Summing all the rows, we get the total balances of the nine friends: $+11,+9,+1,+8,-8,-4,-11,-3,-3$. Since five of them are negative, there must be at least five transactions. On the other hand, one of them has to pay to the guy with balance +1 and that cannot be the only payment he/she makes, so at least 6 transactions are necessary and this number is easy to achieve. Problem 12. While going for a walk, Alex and Maxi found 35 chestnuts. They split them into several (more than one) piles, each containing at least 2 chestnuts, and then took one chestnut from each pile and put it onto the first pile. Now all the piles contain the same amount of chestnuts. How many chestnuts were initially on the second pile? Result. 8 Solution. Positive divisors of 35 are 1, 5, 7 and 35 . Since all piles have the same size at the end, one of these factors must be the number of piles. As there are multiple piles (even after removing one chestnut from some), it cannot be one. The number 35 is also not possible since every pile would initially contain only one chestnut. If there are seven piles, at the end each would have five chestnuts. But the initial distribution would have to have pile sizes of: $-1,6,6,6,6,6,6$, which is also not possible. The only possible case left is five piles with the following initial distribution: $3,8,8,8,8$. Problem 13. In the following figure, two angle sizes are given explicitly. Further, we know that the sizes of the marked angles adjacent to point $A$ are in ratio $2: 1$, and the same holds at point $B$; the bigger angle is always marked twice. Determine the size of the angle $A C B$ in degrees. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-04.jpg?height=694&width=625&top_left_y=915&top_left_x=721) Result. 31 Solution. Let us label three other points according to the picture and denote $\alpha=|\varangle C A D|, \beta=|\varangle C B D|$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-04.jpg?height=725&width=602&top_left_y=1756&top_left_x=727) Using the pair of equal angles adjacent to $X$ we obtain $39^{\circ}+3 \alpha=27^{\circ}+3 \beta$. An analogous computation at $Y$ gives $39^{\circ}+2 \alpha=|\varangle A C B|+2 \beta$. From the first equation we compute $\beta-\alpha=4^{\circ}$ and plugging this into the second equation results in $|\varangle A C B|=39^{\circ}+2(\alpha-\beta)=31^{\circ}$. Problem 14. For how many integers $a$ does the function $f(x)=9 x^{2}+a x-2022$, defined for all real numbers $x$, attain exactly 2022 distinct negative integer values? Result. 11 Solution. Writing $f(x)=\left(3 x+\frac{a}{6}\right)^{2}-\frac{a^{2}}{36}-2022$ shows that $f$ attains exactly all real numbers greater or equal to $-\frac{a^{2}}{36}-2022$. The given condition then implies $-2023<-\frac{a^{2}}{36}-2022 \leq-2022$ which is equivalent to $\frac{a^{2}}{36}<1$ and further $a^{2}<36$. That holds exactly for $a \in\{-5,-4, \ldots, 4,5\}$ and the result is thus 11 . Problem 15. There is a square $A B C D$ with midpoint $P$ inscribed in right angle $A O B$. Given that $A O=6$ and $O P=4 \sqrt{2}$, determine the product of the distances of the point $D$ from lines $O A$ and $O B$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-05.jpg?height=476&width=468&top_left_y=573&top_left_x=794) Result. 48 Solution. We draw perpendiculars from the point $P$ to the $x$-axis and $y$-axis. Then triangles $P F A, P E B$ are congruent. Hence, $P F=P E$. Further, $P F O E$ is a square hence $O E=O F=\frac{O P}{\sqrt{2}}=4$. That is, $B E=A F=O A-4=2$ and $O B=O E-B E=4-2=2$. Further, if we draw a perpendicular from $D$ to the $y$-axis, it follows that triangles $D G A, A O B$ are congruent hence $D G=O A=6, A G=O B=2$. That is, $x_{D}=6, y_{D}=8$. Thus, $k=48$. Problem 16. The subway system of Nábojpolis consists of a single circular line with 2022 stations named $1,2, \ldots, 2022$ with equal distances between neighbouring stations. When visiting the city, Petr bought a weekly ticket and decided to spend the whole time in the subway, going around many times. He starts his journey at the station 1 and his train goes in the increasing direction (i.e. the next station is 2). On the wall of one of the stations he sees a beautiful problem. Solving the problem takes four times longer than Petr's journey so far, and right after getting the solution he finds himself at station 2022. What was the number of the station where he saw the problem? Result. 1214 Solution. Let $x$ be the station where Petr saw the problem. The distance from 1 (Petr's start) to $x$ is $x-1$. The total distance traveled after solving the problem is $5 \cdot(x-1)$. Starting at Station 1 and traveling $5 \cdot(x-1)$ Petr ends up at station $1+5 \cdot(x-1)=2022 \bmod 2022$. Now we look for $x$ so that $$ \begin{aligned} 1+5 \cdot(x-1)=2022 & \bmod 2022 \\ 5 \cdot(x-1)=-1 & \bmod 2022 \\ 5 x=4 & \bmod 2022 \end{aligned} $$ holds. Dividing 2022 by 5 we easily see that 2 remain. Which means that $5 \cdot 404=2020$ and $$ 5 \cdot 404=-2 \quad \bmod 2022 $$ Multiplying both sides with 3 : $$ 5 \cdot 1212=-6 \quad \bmod 2022 $$ Add 10 to both sides: $$ 5 \cdot 1214=4 \quad \bmod 2022 $$ Hence Petr saw the problem at station 1214 . Problem 17. The figure shows three circles: a small one of radius 1 touching two bigger ones which are of the same size. Moreover, one of their centres is the midpoint of the segment joining the other two centres. Determine the length of the dashed segment. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-06.jpg?height=425&width=349&top_left_y=256&top_left_x=862) Result. $\quad 4 \sqrt{2} \doteq 5.657$ Solution. The midpoint condition implies that all the circle centers lie on the perpendicular bisector of the dashed segment (which we place horizontally) and it is easy to see that the one being the midpoint of the other two is the center of the upper bigger circle. The distance of the centers of the two bigger congruent circles can be computed as the distance of their upmost points which equals the diameter of the small circle, i.e. 2. Denoting the common value of the radii of the bigger circles $R$, the other distance can be expressed as $R-1$. Hence $R-1=2$ which yields $R=3$. Now let us look at the right triangle with vertices in the the middle circle center, midpoint of the dashed segment and one intersection of the bigger circles. The Pythagorean theorem then gives the length of the dashed segment as $2 \sqrt{3^{2}-1^{2}}=4 \sqrt{2}$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-06.jpg?height=371&width=277&top_left_y=1111&top_left_x=889) Problem 18. There are 2022 milk-drinking dragons standing in a row. The first of them has 1 pint of milk, the second has 2 and so on, all the way to the 2022nd dragon which has 2022 pints. The first of them will transfer half his milk and half a pint to the second one, then the second will transfer half his milk and half a pint to the third one and so on, until the 2021st dragon transfers half his milk and half a pint to the 2022nd one. How much milk (in pints) will the 2022nd dragon have after that? Result. 4043 Solution. Let us assume that, before the $n$-th transfer in the process, the $n$-th dragon has $2 n-1$ pints of milk. Then, after the transfer, the $n+1$-th dragon will have $n+1+\frac{2 n-1}{2}+\frac{1}{2}=2 n+1=2(n+1)-1$ pints. Therefore, by trivial induction, for any $k \geq n$ the $k$-th dragon will have $2 k-1$ pints of milk after receiving the transfer. Because, indeed, the first dragon has $1=2 \times 1-1$ pint of milk at the beginning, the last dragon will have $2 \times 2022-1=4043$ pints at the end. Problem 19. Point $X$ is selected randomly in a square $A B C D$ of side length 2 . What is the probability that the segments $A X, B X, C X$ and $D X$ are all longer than 1 ? Result. $\quad 1-\frac{\pi}{4} \doteq 0.215$ Solution. Notation. $[X]$ represents the area of $X$. Points $X$ that satisfy all inequalities lie inside the region $R$ on the picture below. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-06.jpg?height=311&width=305&top_left_y=2329&top_left_x=881) We will calculate the probability by $[R] /[A B C D]$. $[A B C D]$ is simply equal to 4 . $[R]=[A B C D]-4[S][R]=4-4 \cdot \frac{\pi \cdot 1^{2}}{4}=4-\pi$ $[R] /[A B C D]=\frac{4-\pi}{4}=1-\frac{\pi}{4}$ Problem 20. The ratio between the sides of the rectangle is $2: 1$ and the distance from $A$ to $B$ is 1 . What is the area of the rectangle? ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-07.jpg?height=237&width=466&top_left_y=430&top_left_x=795) Result. $\quad 10 / 9 \doteq 1.111$ Solution. The drawn diagonal splits the rectangle into 2 right triangles. Let the height of the triangle be $a$ and the hypotenuse be $1+2 b$. As seen in the sketch the height splits the triangle into 2 similar right triangles with legs of length $a$ and $b$ as well as $1+b$ and $a$. As these triangles are similar and the ratio of their hypotenuses is given as $2: 1$, we follow that $2 \cdot b=a$ and $2 \cdot a=1+b$. This solves to $a=\frac{2}{3}$ and $b=\frac{1}{3}$. The total area of the rectangle then is equal to the diagonal times $a \cdot(1+2 b) \cdot a=\left(1+\frac{2}{3}\right) \cdot \frac{2}{3}=\frac{10}{9}$ Problem 21. Each of five dwarfs wore a hat of a distinct colour. Two dwarfs exchanged their hats, then again some two dwarfs exchanged their hats and then this happened once again. In how many ways could this have happened, provided that in the end no dwarf wore the hat of the same colour as at the beginning? Result. 180 Solution. Using cycles: The resulting permutation has to consist of a 2-cycle and a 3-cycle and there are $\binom{5}{2} \cdot 2$ such permutations (choose the 2 -cycle and choose the orientation of the 3 -cycle). The 3 -cycle can be decomposed into two 2-cycles in 3 (ordered) ways. Finally, there are 3 options when to do the independent 2-cycle, in total $20 \cdot 3 \cdot 3=180$. Not using cycles: Pick the first swap in $\binom{5}{2}=10$ ways. Then there are two options: either the next swap is disjoint with the first one (1), or not (2). In (1), there are $\binom{3}{2}=3$ options for the second swap and 4 for the final swap, while in (2) there are $2 \cdot 3=6$ options for the second one and the final one is determined, hence $10 \cdot(3 \cdot 4+6)=180$ ways in total. Problem 22. Marcus wrote all roman numerals from $I, I I, I I I, I V, \ldots$ to $z$ on the blackboard, each on a new line. Aurelius noticed that there is the same number of the following substrings: $I V, I X, X L, X C, C D$, and $C M$, written on the blackboard. What is the smallest $z \geq I V$ for which that is possible? (Give the answer as a decimal, not a roman numeral.) Result. 999 Solution. The amount of the $I V$ is the amount of the digit 4 on the last position from numbers 1 to $z$. Similarly $I X$ is the amount of the digit 9 on the last positions. Amount of the $X L$ is the amount of the 4 on the second to last position. Similarly we can deduce that $X C$ is 9 on the second to last position, $C D$ is 4 on third to last position and $C M$ is 9 on the third to last position. Recall that from 01 to 99 there are the same number of 4 on the last position as on the first position. This is due to the fact, that those numbers are all possible combinations of the picking a digit 0 to 9 on first position and a digit 0 to 9 on the second position. Therefore 999 has all combination of the picking a digit 0 to 9 on each position and therefore must have same amount of 4 and 9 on each position. To prove that 999 is minimal it is sufficient to compare 9 on the first position with 9 on the lat position. The amount of the 9 on the last position increase in every 10 numbers by one. But the amount of the 9 on the first position is 0 till the number 900 is written and then increase by 1 on each number. We know that the amount is equal at 999 and therefore it can not be equal on any smaller number greater then 9 . Similarly with the 4 on the last position, which completes the proof. Problem 23. Out of fifty students, some play ice hockey and some field hockey (it is possible for each student to play neither, one, or both sports). The number of those not playing anything is twice the number of those playing field hockey. Moreover, fifteen more students play only ice hockey than those who play both sports. Find all possible values of the number of students not playing ice hockey, and give their product. Result. 14725 Solution. Let us denote by $i, f, b$, and $n$ the number of students playing only ice hockey, only field hockey, both sports, and no sport, respectively. Solving the system of equations $$ \begin{aligned} i+f+b+n & =50 \\ n & =2 \cdot(f+b) \\ i & =b+15 \end{aligned} $$ with a parameter $i$ yields $f=\frac{1}{3}(95-4 i), n=\frac{2}{3}(50-i), b=i-15$. In order for all these numbers to be non-negative integers, $i$ must be one of $17,20,23$, yielding possible values of the sought number $f+n: 9+22=31,5+20=25$, $1+18=19$, the product of which is 14725 . Problem 24. The points $A, B, C, D$ lie on a circle of radius 1 with center $M$. Segments $A B$ and $C D$ are perpendicular. The circle with diameter $A B$ touches the one with diameter $C D$ at a single point $P$ and they both have the same size. Determine the length of the segment $M P$. Result. $1 / \sqrt{3} \doteq 0.577$ Solution. Move and rotate the sketch such that: $\overline{A B}$ parallel to y-axis, $\overline{C D}$ parallel to x-axis and $M=(0,0)$. Now the points $A, B, C, D$ are mirrored versions of each other: $$ A=(x,-y), \quad B=(x, y), \quad C=(y, x), \quad D=(-y, x) $$ W.l.o.g. assume $x>0, y>0$. Since radius $=1$ : $$ x^{2}+y^{2}=1 $$ The circles each touch two of the points $A, B, C, D$ it follows that the circle around $M_{A B}$ touches $A$ and $B$ and the circle around $M_{C D}$ touches $C$ and $D$ Next consider the points: $$ M=(0,0), \quad M_{A B}=(x, 0), \quad M_{C D}=(0, x) $$ They form a right triangle with side lengths $x, x$ and $2 y .2 y$ since both of the touching circles have radius $y$. With the Pythagorean theorem: $$ x^{2}+x^{2}=(2 y)^{2} $$ Simplifying the two quadratic formula yields $y=1 / \sqrt{3}$ Since $P$ lies on the midpoint of the hypotenuse $|\overline{M P}|=y=1 / \sqrt{3}$ Problem 25. Let $\left\{a_{n}\right\}_{n=1}^{\infty}$ be a sequence of real numbers such that $$ a_{n+1}^{2}+a_{n}^{2}=a_{n+1}+a_{n}+24 $$ holds for any positive integer $n$. Find the largest possible value of $a_{1}+a_{2022}$. Result. 8 Solution. Notice that $a_{x+2}^{2}-a_{x+2}=a_{x}^{2}-a_{x}$. Hence, for every positive integer $n$ : $$ a_{x+2 n}^{2}-a_{x+2 n}=a_{x}^{2}-a_{x} $$ It follows that $$ a_{2+2 \cdot 1010}^{2}-a_{2+2 \cdot 1010}=a_{2}^{2}-a_{2} $$ Since $$ a_{2}^{2}-a_{2}+a_{1}^{2}-a_{1}=24 $$ it follows that $$ a_{2022}^{2}-a_{2022}+a_{1}^{2}-a_{1}=24 $$ Let $a=a_{2022}+a_{1}$ and AM-GM inequality $a=a_{1}+a_{2022} \geq 2 \cdot \sqrt{a_{1} \cdot a_{2022}}$, it follows that $a^{2}=a_{2022}^{2}+a_{1}^{2}+2 \cdot a_{1} \cdot a_{2022}$, and then $a_{2022}^{2}+a_{1}^{2} \geq \frac{a^{2}}{2}$. Hence, $$ 24 \geq \frac{a^{2}}{2}-a $$ Hence, $a \leq 8$. Such sequence does exists as $a_{n}=4$, for all positive integers $n$ satisfies conditions from problem statement. Problem 26. More than $39 \%$, but less than $40 \%$ members of a chess club are boys. If one of the girls decided to leave the club, the percentage of boys would still be under $40 \%$, but if a new boy joined the club instead, the percentage would be at least $40 \%$. What is the smallest possible number of current members of the club? Result. 64 Solution. Let $n$ be the total number of members and $a$ the number of boys. We have inequalities $$ \begin{aligned} \frac{a}{n} & >0.39 \\ \frac{a}{n-1} & <0.4 \\ \frac{a+1}{n+1} & \geq 0.4 \end{aligned} $$ Rearranging the second and the third and multiplying by 5 yields $$ 2 n-2>5 a \geq 2 n-3 $$ and since $5 a$ is an integer and $2 n-2,2 n-3$ are consecutive integers, $5 a=2 n-3$ must hold. Plugging this into the first inequality and solving for $n$ produces $n>60$. For $a=\frac{1}{5}(2 n-3)$ to be an integer, the smallest possible value of $n$ is 64 . Problem 27. We have found three quadratic functions with the following properties: $f_{1}$ has a common root with $f_{2}$ and with $f_{3}$ and function $f_{2}$ has a common root with $f_{3}$ but there is no common root for all three functions. Also, we discovered that they take the following forms: $$ \begin{aligned} & f_{1}(x)=x^{2}-b x+1980 \\ & f_{2}(x)=x^{2}-(b+1) x+2024 \\ & f_{3}(x)=x^{2}-(b+2) x+a \end{aligned} $$ where $a, b$ are some fixed real numbers. Find the value of $a$. Result. 2070 Solution. Let the $k_{1}, k_{2}, k_{3}$ denote the roots. Then the functions have the following form $$ \begin{aligned} & \left(x-k_{1}\right)\left(x-k_{2}\right)=x^{2}-\left(k_{1}+k_{2}\right) x+k_{1} \cdot k_{2} \\ & \left(x-k_{1}\right)\left(x-k_{3}\right)=x^{2}-\left(k_{1}+k_{3}\right) x+k_{1} \cdot k_{3} \\ & \left(x-k_{3}\right)\left(x-k_{2}\right)=x^{2}-\left(k_{3}+k_{2}\right) x+k_{3} \cdot k_{2} \end{aligned} $$ in some order. Without loss of generality let $b=k_{1}+k_{2}$ and $b+1=k_{1}+k_{3}$, therefore $b+2=k_{2}+k_{3}$. Solving this system of equations yields solution $k_{1}=\frac{b-1}{2}, k_{2}=\frac{b+1}{2}$ and $k_{3}=\frac{b+3}{2}$. Since $1980=k_{1} \cdot k_{2}=\frac{(b-1)(b+1)}{4}$ we can solve that $k_{1}=44, k_{2}=45, k_{3}=46$ and therefore $a=45 \cdot 46=2070$. Problem 28. A volleyball tournament had six participants: Alice, Bob, Charlie, Dave, Eva and Frank. In each game, two players played against two others. Each possible pair played every other pair exactly once. Alice won 30 games, Dave 12 games and Frank 18 games. How many games did Bob win? Result. 10 Solution. Every player has a total of 30 games as for every out of the 5 possible partners there are $\binom{4}{2}=6$ different pairs of opponents. $5 \cdot 6=30$. Hence we know that Alice wins all of her games. Every two players have 6 games together and face each other 12 times (4 possible partners for first player, 3 possible for the second one). As Frank has 18 wins and faces Alice 12 times were he loses, he wins every game not played against Alice. Dave won 12 games. 6 of which together with Alice and 3 together with Frank (Dave and Frank played against Alice 3 times and lost). The remaining 3 victories were in games without Alice or Frank. There are exactly 3 possible games to be played without Alice or Frank, in each Dave is paired with one of the other 3 players playing against the remaining 2 . Hence we follow that Dave won each game without Alice or Frank. With this information we can see that Bob, Charlie and Eve all won the same amount of games: 6 with Alice, 3 with Frank and 1 with Dave. Bob won $6+3+1=10$ games. Shortcut: If we add all games of every player $30 \cdot 6=180$, each game is counted 4 times (once by each player) Hence there were $180 / 4=45$ games played in total. As the question does not differentiate further between Bob, Charlie and Eve, they all have to have the same amount of wins, since the question asks for a unique solution. Each win is counted twice (once by each winner) Hence: $2 \cdot 45=30+18+12+3 \cdot b o b$ which solves to $b o b=10$ Problem 29. Consider a right triangle with sides of lengths $3,4,5$. This triangle can be split along its altitude into two similar triangles and this process can be repeated, doubling the number of triangles in each step. Compute the average perimeter of the triangles obtained after five steps. Result. $\quad \frac{50421}{25000}=2.01684 \doteq 2.017$ Solution. Let us compute the sum of perimeters first. Each split of a triangle $T$ produces two triangles $T_{1}$ and $T_{2}$ similar to $T$ with the similarity ratios $\frac{3}{5}$ and $\frac{4}{5}$, respectively, therefore the sum of perimeters of $T_{1}$ and $T_{2}$ will be $\frac{7}{5}$ times the perimeter of $T$. We infer that each split of all the present triangles results in multiplying the sum of perimeters by $\frac{7}{5}$. Hence the sum of perimeters after five splits will be $(3+4+5)\left(\frac{7}{5}\right)^{5}$ and since there are $2^{5}$ triangles after five splits, the average perimeter is going to be $$ 12 \cdot\left(\frac{7}{5}\right)^{5} \cdot \frac{1}{2^{5}}=\frac{50421}{25000} $$ Problem 30. Marcin decided to climb a route on his climbing wall consisting of 10 holds numbered by $1, \ldots, 10$ from the lowest one to the highest one using only one arm and one leg in the following manner. He starts with the hand on hold 3 and the foot on hold 1. In one step he can move the hand or the foot upwards by several holds, but the numbers of the two holds he is using in any moment, always with hand above foot, can differ at most by 3 and at least by 1 . The route is considered climbed as soon as he grabs the hold 10. In how many ways can Marcin climb it? Result. 1458 Solution. We can visualize the achievable positions on the wall together with the number of ways leading to them from the starting position by the following cascade table. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-10.jpg?height=577&width=631&top_left_y=1079&top_left_x=724) The number of line denotes the hand position, the number of column gives the position of the foot. Initially, we have only the highlighted 1 at the starting position $(1,3)$. The number in a new cell is obtained as the sum of all the numbers above and on the left. For example, we have three ways how to get to the position $(3,4)$ : either from $(2,4)$ (which itself is reachable from $(2,3)$, or $(1,4)$ ), or directly from $(1,4)$. Applying this rule we can fill the table up to the last line where it gets a bit different due to the rule that Marcin ends immediately after reaching top hold. In particular, the only predecessor of $(8,10)$ is $(8,9)$ and $(9,10)$ cannot be reached at all. The result is then the sum of the numbers in the last row which equals $729+729=1458$. Problem 31. The following figure contains three regular hexagons. The smallest one has side length 1 . What is the area of the smallest circle that can cover the whole figure? ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-10.jpg?height=569&width=691&top_left_y=2097&top_left_x=682) Result. $\quad 21 \pi \doteq 65.973$ Solution. The equilateral triangle in the middle has side length 1. Hence the other hexagons have side length 2 and 3 respectively. The diameter of the circle must be at least as long as the longest diagonal through all hexagons. It is rather obvious that this longest diagonal goes from $A$ to $B$. The shorter leg of the triangle in the sketch has a length of 3 and the longer leg has length $\sqrt{3} \cdot(2+3)=5 \sqrt{3}$. Using the theorem of Pythagoras we get $|A B|^{2}=3^{2}+(5 \sqrt{3})^{2}=9+25 \cdot 3=84$. Therefore the area of the circle is $\frac{|A B|^{2}}{4} \pi=\frac{84}{4} \pi=21 \pi$. With the theorem of Thales it can easily be seen that this circle in fact inscribes all three hexagons. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-11.jpg?height=671&width=671&top_left_y=481&top_left_x=698) Problem 32. Lukáš and Teri are playing a game on a $42 \times 42$ board. Firstly, Lukáš places $x \geq 8$ knights on the board (at most one knight on each square). Then Teri chooses eight knights. Finally, Lukáš removes from the board all knights that weren't chosen by Teri. Teri wins if no two of the eight knights attack each other at the end of the game. Determine the smallest number $x$ for which Teri can ensure that she wins no matter how Lukáš places the $x$ knights. Result. 15 Solution. Consider the standard black and white colouring of the chessboard and observe that each knight attack only squares of the other colour. Therefore, if $x=2 \cdot 7+1=15$, according to the pigeon hole principle, amongst any 15 knights there certainly are 8 knights that are on squares of the same colour, which means that no two of them attack each other. This, Terri can surely win if $x=15$. We show that Teri cannot win if $x \leq 14$. Let $(r, c)$ denote the square in $r$-th row and $c$-th column. Consider the following 7 pairs of squares: $$ \begin{aligned} & P_{1}:(1,1),(3,2), \\ & P_{2}:(1,2),(3,3), \\ & P_{3}:(1,3),(3,4), \\ & P_{4}:(1,4),(3,5), \\ & P_{5}:(1,5),(3,6), \\ & P_{6}:(1,6),(3,7), \\ & P_{7}:(1,7),(3,8), \end{aligned} $$ Lukáš places $x \leq 14$ knights arbitrarily on these 14 squares. If Teri chooses any 8 them, then according to the pigeon hole principle, two knights chosen by Teri belong to the same pair. Observe that these knights attack each other due to the choice of the 7 pairs. Therefore, the smallest number $x$ for which Teri can surely win is 15 . Problem 33. A river is one mile wide. Paul needs 27 minutes to travel one mile downstream in his rowboat and 36 minutes to travel one mile across the river to the opposite point on the other bank. How long does he need to travel one mile upstream? Give the answer in minutes. Result. 48 Solution. Let us assume that the boy can row $x$ miles per minute on his own (on still water) while the stream's velocity is $y$ miles per minute. Thus the time required to travel one mile downstream can be written as $\frac{1}{x+y}$ minutes. Now we need to calculate the time needed to travel one mile to the opposite point on the other bank. In order to get there quickest, the boy will need to aim $z$ miles upstream so that the river carries him $z$ miles downstream during his travel. By the Pythagorean theorem, the length of his own travel will be $\sqrt{1+z^{2}}$; since it has to happen in the same time as being carried $z$ miles by the stream, there occurs the proportion $\sqrt{1+z^{2}}: z=x: y$, so $y^{2}\left(1+z^{2}\right)=x^{2} z^{2}, y^{2}=z^{2}\left(x^{2}-y^{2}\right)$ and finally $z^{2}=\frac{y^{2}}{x^{2}-y^{2}}$. It means that the distance he has to cover (as if on still water) is $\sqrt{1+z^{2}}=\sqrt{\frac{\left(x^{2}-y^{2}\right)+y^{2}}{x^{2}-y^{2}}}=\frac{x}{\sqrt{x^{2}-y^{2}}}$. The time required for that is $\frac{1}{\sqrt{x^{2}-y^{2}}}$ minutes. Meanwhile, the velocity of rowing upstream is $x-y$ miles per minute, so the time in minutes needed to travel one mile like that is $\frac{1}{x-y}$, and obviously there is $\left(\frac{1}{\sqrt{x^{2}-y^{2}}}\right)^{2}: \frac{1}{x+y}=\frac{x+y}{x^{2}-y^{2}}=\frac{1}{x-y}$. Because we already know that $\frac{1}{x+y}=27$ and $\frac{1}{\sqrt{x^{2}-y^{2}}}=36$, now it is determined that $\frac{1}{x-y}=36^{2}: 27=48$. Problem 34. Twin brothers, Sloan and Quigley, train at a running oval. They start at the same point, clearly marked as the start, and run around the oval in the same direction, each maintaining his constant velocity. The training ends as soon as the newbie runner Sloan finishes one length of the stadium, returning to the starting point. Quigley is highly talented and runs six times faster than Sloan. The twins look identical. Nevertheless, if we look at a snapshot from the training, which is simply a photo of the stadium, it is usually possible to determine which brother is which (using only the information given above and that one snapshot). How many times during the training can one take a snapshot where the brothers cannot be distinguished? (We do not count the very start and end of their training.) Result. 34 Solution. Let $s \in(0,1)$ denote the position of Sloan on the oval (excluding hence the start and the end). The position of Quigley can then be computed as $6 s(\bmod 1)$ where by $x(\bmod 1)=x-\lfloor x\rfloor$ we just mean the fractional part of $x$. The brothers are then indistinguishable if and only if $s=(6(6 s(\bmod 1)))(\bmod 1)$. Notice that the inner occurence of (mod 1) makes no effect on the whole expression and can thus be omitted. Hence we can rewrite our equation as $$ 36 s \quad(\bmod 1)=s \quad(\bmod 1) $$ implying that $35 s$ is an integer. Thus $s=\frac{a}{35}$ for $a \in\{1,2, \ldots, 34\}$ (recall that $00, f(x)>-\frac{4}{x}$ and $f\left(f(x)+\frac{4}{x}\right)=3$, evaluate $f(16)$ (a function $f$ is injective if for all $x$ and $y, f(x)=f(y)$ implies $x=y$ ). Result. $\quad \frac{15}{4}=3.75$ Solution. There is a positive real number $a$ such that $f(a)=3$. Setting $x=a$ it follows that $f\left(f(a)+\frac{4}{a}\right)=f\left(3+\frac{4}{a}\right)=3$. Since $f$ is an injective function, it follows that $$ a=3+\frac{4}{a} $$ Hence, $a=4$. This shows that $$ f(x)+\frac{4}{x}=4 $$ That is $$ f(x)=4-\frac{4}{x} $$ Hence, $f(16)=\frac{15}{4}$. Problem 39. Terry is hiking and has found a spring. She has two bottles, one with the volume of $2022 \mathrm{ml}$ and other with the volume of $51 \mathrm{ml}$. She can pour some water from one bottle to the other one, fill any of them to the full from the spring, or empty any of them into the stream. By these operations, she wants to get to the situation where: - she knows the volume $V$ of water contained in one of the bottles, - $V$ is the smallest possible under the previous condition. What is the smallest possible number of pours between the bottles to achieve this goal? Result. 121 Solution. Since $\operatorname{gcd}(2022,51)=3$ the minimal volume cannot be smaller than 3 . We will show how to achieve it using the minimal possible number of pours. Observe that we can not have both bottles at the same time, non empty non full. If we have $51 \neq x \neq 2022 \mathrm{ml}$ in any bottle then the filling, or emptying this bottle would set us to the beginning. Therefore there are only two ways how we can proceed, one that fills smaller and pour into the big one and second that fills bigger bottle and pours to the smaller one. Since they are symmetric let us consider the first one: Fill smaller one and pour it into the bigger one and repeat until we have some left over water in the smaller bottle. We get $2022=39 \cdot 51+33 \mathrm{ml}$ leftover in the small bottle. Now empty the big one and pour the smaller to the big. Repeating this processes give us leftovers as follows: $18,36,3$. To get 18 in the big bottle we poured 41 times and to get 36 in the big bottle we additionally poured 41 times and to get 3 in small bottle we need only 39 pours. Therefore 121 pours in total. Problem 40. Positive integers $a, b$ have the property that $a+b$ divides $51 \cdot \operatorname{lcm}(a, b)$. How many different values can the expression $$ \frac{51 \cdot \operatorname{lcm}(a, b)}{a+b} $$ take? By $\operatorname{lcm}(a, b)$ we denote the least common multiple of positive integers $a$ and $b$. Result. 25 Solution. Let us define $\operatorname{gcd}(a, b)=D$ and then writing $a=D x, b=D y$ where $\operatorname{gcd}(x, y)=1$. Whence, it follows that $x+y$ must divide 2021xy. Since $\operatorname{gcd}(x+y, x y)=1$, we obtain that $x+y$ divides $51=3 \cdot 17$. Hence, $x+y$ can be $3,17,51$. Let $k \in\{3,17,51\}$ then considering $x+y=k$ and $\operatorname{gcd}(x, y)=1$ together yielding to the fact that $\operatorname{gcd}(x, k)=\operatorname{gcd}(y, k)=1$. Now, let us define $c=\frac{51 \cdot \operatorname{lcm}(a, b)}{a+b}$ it follows that $c=\frac{51 x y}{x+y}$. Since, we have $\phi(k)$ choices for $(x, y)$, where $\phi(k)$ is Euler's Totient function. It follows that we must have $\frac{\phi(k)}{2}$ choices for $c$. Hence, the total number of possibilities for $c$ is indeed $\frac{\phi(3)+\phi(17)+\phi(51)}{2}=\frac{51-1}{2}=25$. Problem 41. In the following figure, the vertices of rhombus $A B C D$ lie on the curves $y=\frac{k_{1}}{x}$ and $y=\frac{k_{2}}{x}$. If $|\varangle B C D|=120^{\circ}$, determine $\left|\frac{k_{1}}{k_{2}}\right|$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-15.jpg?height=803&width=791&top_left_y=598&top_left_x=632) Result. 3 Solution. From the nature of the rhombus and the notion of symmetry, it follows that $O C$ is perpendicular to $O D$. Make perpendicular lines from $C, D$ respectively to cut the $x$-axis on $M, N$ respectively. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-15.jpg?height=800&width=796&top_left_y=1596&top_left_x=627) Now, the area of the triangle $O C M$ is $\frac{|C M| \cdot|O M|}{2}=\left|\frac{k_{2}}{2}\right|$ and the area of the triangle $O D N$ is $\left|\frac{k_{1}}{2}\right|$. Since triangles $\triangle C O M, \triangle O D N$ are similar, it follows that the ratio of the areas of these triangles is $\left(\frac{|O D|}{|O C|}\right)^{2}=\left|\frac{k_{1}}{k_{2}}\right|$. Since $|\varangle B C D|=$ $120^{\circ}$ it follows that $|\varangle O C D|=60^{\circ}$. Using the tangent function in right triangle $C O D$, we compute $$ \left|\frac{k_{1}}{k_{2}}\right|=\left(\frac{|O D|}{|O C|}\right)^{2}=\left(\tan 60^{\circ}\right)^{2}=3 $$ Remark. As an alternative way for proving that $O D \perp O C$ we can do this: let $y=r x+s$ be the equation of the line passing through $B, D$ and $y=t x+u$ be the equation of the line passing through $A, D$, it follows that $x_{D}, x_{B}$ are roots of the equation $r x^{2}+s x-k_{1}$ and hence their sum is $-\frac{s}{r}$. By the same argument, $x_{C}+x_{A}=-\frac{u}{t}$. Since we have rhombus, it follows that $x_{C}+x_{A}=x_{D}+x_{B}$ this shows that the $\frac{u}{t}=\frac{s}{r}$. This shows that two lines $y=t x+u, y=r x+s$ intersect at $\left(-\frac{s}{r}, 0\right)$. On the other hand, $\frac{k_{1}\left(x_{B}+x_{D}\right)}{x_{B} \cdot x_{D}}=y_{D}+y_{B}=y_{C}+y_{A}=\frac{k_{2}\left(x_{C}+x_{A}\right)}{x_{C} \cdot x_{A}}=0$. Whence, $x_{C}+x_{A}=x_{D}+x_{B}=0$. Thus, two diagonals intersect at the origin and hence $u=s=0$. We can continue this algebraic approach to determine the ratio $\frac{k_{1}}{k_{2}}$. Problem 42. There are 2022 marbles of six different colours in a bag. If we pick any 2000 of them, it is certain that they contain at least five different colours. What is the minimal $N$ such that, given only the piece of information from the last sentence, we can be sure that whenever we pick any $N$ marbles, there are at least four different colours among them? Result. 1988 Solution. Let us denote the numbers of the marbles of the respective colours in increasing order: $A \leq B \leq C \leq D \leq$ $E \leq F, A+B+C+D+E+F=2022$. The given condition implies that $C+D+E+F<2000$, i.e. $A+B \geq 23$. Since $C \geq B \geq \frac{A+B}{2} \geq \frac{23}{2}$, we know that $C \geq 12$ and hence $N=2022-(23+12)+1=1988$ works. On the other hand, the example of $(A, B, C, D, E, F)=(11,12,12,662,662,663)$, which satisfies the given condition, shows that $663+662+662=1987$ is not enough. Problem 43. Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be a function satisfying $$ f(x)=f(137-x)=f(2202-x)=f(3028-x) $$ What is the largest number of different values that can appear in the list $f(1), f(2), f(3), \ldots, f(2022)$ ? Result. 207 Solution. Since $f(2202-x)=f(x)=f(2202-137+x)=f(2065+x)$, the function $f$ is periodic with period 2065 . Similarly, $f(3028-x)=f(x)=f(3028-2202+x)=f(826+x)$ yields period 826. It is known that if function has two or more periods $p_{1}, p_{2}, p_{3} \ldots$, it also has a period of $\operatorname{gcd}\left(p_{1}, p_{2}, p_{3} \ldots\right)$, therefore period of the function $f$ is $\operatorname{gcd}(826,2065)=413$. From equation $f(x)=f(137-x)$ we know that function is symmetric with lines of symmetry $68.5+137 \cdot k$, for example: $f(68)=f(69), f(0)=f(137)$ or $f(276)=f(137-276)=f(137-276+413)=f(274)$. Therefore maximal amount of different values is $\frac{413+1}{2}=207$. Problem 44. Let $A B C$ be an isosceles right triangle with $|A B|=|A C|=4$. Point $P$ is chosen inside $A B C$ such that $|P A|=2$. Find the least possible value of $\frac{|B P|}{2}+|C P|$. Result. $\quad \sqrt{17} \doteq 4.123$ Solution. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-16.jpg?height=435&width=719&top_left_y=1687&top_left_x=677) Consider point $T$ on side $A B$ such that $|A T|=1$. Further, $|A P|=2,|A B|=4$. Then $|P A|^{2}=|A T| \cdot|A B|$. That is, $\frac{|P A|}{|A T|}=\frac{|A B|}{|P A|}$. Moreover, $|\varangle P A T|=|\varangle P A B|$. Thus, triangles $\triangle P A T, \triangle B A P$ are similar. Hence, $\frac{P T}{P B}=\frac{P A}{A B}=\frac{1}{2}$. It follows that $P T=\frac{B P}{2}$. Thus, $\frac{|B P|}{2}+C P=C P+P T$. Further, $|C T|=\sqrt{|A T|^{2}+|A C|^{2}}=\sqrt{17}$. Further, $$ P C+P T \geq T C=\sqrt{17} $$ The equality occurs whenever $C, P, T$ are collinear. Problem 45. In a $4 \times 4$ grid, 8 one-sided mirrors have been placed along the diagonals of some cells (at most one in a cell). The mirrors bounce off a ray of light if it comes from the mirror-side and annihilate the ray if it comes from the other side. In the middle of each of the 8 vertical boundary segments, there is a laser, pointing (perpendicularly) into the grid. How many configurations of the mirrors satisfy the condition that each of the eight light rays originating from the lasers hits either the top or the bottom of the grid (i.e., none of the rays gets annihilated or hits a laser)? Result. 90 Solution. Note that it suffices to pick two squares from each row and each column and this induces a required mirror configuration. Indeed, there must be at least two mirrors in each column and row, since otherwise we would have either a horizontal/vertical ray of light or some ray would be annihilated. Conversely, given set of squares such that there are two in each column and row, then we can choose the orientation of the mirror to be so that it pairs up the nearest sides in each direction. This yields a valid (and the only valid orientation of mirrors that is on this set) configuration of mirrors. Thus we need to find the number of ways to pick squares of table $4 x 4$ so that there are exactly two of those in each column and row. Inverting mirrors by switching mirror and absorption side give us that any laser will now loop within this grid. There are only two ways how lasers can cycle inside, two four-cycle, or one eight-cycle. Two four cycles is equivalent to placing mirrors into two rectangular formation. Placing one rectangle can be done in the following way: Without loss of generality one of the sides of one of the rectangles will be in the top row, hence we can pick firs two mirrors of the top row in 6 ways and then pick the second row in 3 ways, together $6 \cdot 3=18$ ways. The other rectangle is then uniquely determined. To achieve eight-cycle first pick two mirrors in top row in 6 ways. Now pick two mirrors in corresponding columns in a way that they do not share a row, there are now $3 \cdot 2$ ways. And finally pick the remaining mirror in one of the rows that have currently one mirror, in two ways. This uniquely determines the eight-cycle, in $6 \cdot 3 \cdot 2 \cdot 2=72$ ways. Together $72+18=90$. Problem 46. Find the smallest positive integer that becomes seven times larger after moving its last digit to the front (e.g. 135 would change into 513). Result. 1014492753623188405797 Solution. Let us denote the last digit as $a$ and the number denoted by the rest of digits as $b$. Then the original number is equal to $10 b+a$ and the new number is equal to $10^{k} a+b$, where $k$ is the number of digits of $b$, thus $k=\left\lfloor\log _{10} b\right\rfloor+1$. Now we have to solve the equation $70 b+7 a=10^{k} a+b$, that is $b=\frac{\left(10^{k}-7\right) a}{69}$. Because we need to minimize $b$, it is sufficient to find the smallest value of $k$ such that for some $a$ occurs $69 \mid\left(10^{k}-7\right) a$. Of course $10^{k}-7$ is always divisible by 3 , so it is enough that $23 \mid\left(10^{k}-7\right) a$, which happens when and only when $23 \mid 10^{k}-7$, namely because 23 is a prime number and $a<23$. Therefore we have to find the smallest $k$ such that $10^{k} \equiv 7(\bmod 23)$. And since $10^{-1}=7(\bmod 23)$, it can be directly derived from Fermat's little theorem that 21 is the smallest such $k$. Now we insert this value into the equation to determine that $b=\frac{\left(10^{21}-7\right) a}{69}$. Now it is needed to determine the smallest possible values of $a$ and $b$ : reversing the formula for $k$ allows us to know that $b$ needs to have 21 digits, hence $b \geq 10^{20}$, which means that $\left(10^{21}-7\right) a \geq 69 \times 10^{20}$. The smallest such $a$ is 7 , so $a=7$ and $b=\frac{7 \times 10^{21}-49}{69}$. Now we can directly calculate $6999999999999999999951: 69=2333333333333333333317: 23=101449275362318840579$. Therefore the number we intended to find is 1014492753623188405797 . Problem 47. Two wizards, Arithmetix and Combinatorica, have their rematch (as you may remember, they first met during Náboj 2018). Both start with 100 hitpoints. Arithmetix learned two spells: one does 50 damage (i.e. reduces the opponent's hitpoints by 50 ) while the other one lowers the accuracy of the opponent by $25 \%$ for the rest of the game (e.g. from $65 \%$ to $40 \%$ ). Accuracy is the probability that the spell will actually work (negative accuracy is interpreted as zero probability) and both spells of Arithmetix have accuracy $100 \%$. Combinatorica always uses a spell which does 50 damage with the initial accuracy of $100 \%$. They cast one spell at a time and take turns. Arithmetix begins and in each of his turns, he decides which of the two spells to cast by flipping a fair coin. Match ends when one or the other wizard has 0 or less hitpoints. What is the probability that either of them wins without taking any damage? Result. $\quad \frac{141}{1024} \doteq 0.138$ Solution. Let $(A, C, p, t)$ denotes the state of the match. Value of $A$ is the number of hitpoints of Arithmetix, $C$ is the number of hitpoints of Combinatorica, $p$ is current accuracy of the Combinatorica's spell and $t$ denotes which player is currently on the move. Starting position is therefore $(100,100,100, A)$, and sought end position are $(0,100, p, A)$, $(100,0, p, C)$. Note that the first casted spell can not be the damage spell as then Combinatorica could not missed his spell, and therefore both wizards would have taken damage. Also note, that if $p=0 \%$ at some point then Arithmetix wins, as the probability that duel will drag infinitely is limitly close to zero. It takes Combinatorica two hits to eliminate Arithmetix so in order for Combinatorica to win, Arithmetix had to use accuracy spell at least two times. That leaves us with possible sought outcomes $(100,0,75, C),(100,0,50, C),(100,0,25, C),(100,0,0, C),(0,100,50, A)$ and $(0,100,25, A)$. - The first outcome can be reached in the only possible match is as follows: accuracy spell, miss, hit, miss, hit, with probability $\frac{1}{2} \cdot \frac{1}{4} \cdot \frac{1}{2} \cdot \frac{1}{4} \cdot \frac{1}{2}=\frac{1}{2^{7}}$. - For the second outcome there are two ways how it could went by: accuracy, miss, hit, miss, accuracy, miss, hit or accuracy, miss, accuracy, miss, hit, miss, hit. In both cases probability multiplicand by the Arithmetix spell is $\frac{1}{2^{4}}$ however multiplicand by the Combinatorica is either $\frac{1}{4} \cdot \frac{1}{2} \cdot \frac{1}{2}=\frac{1}{2^{4}}$ or $\frac{1}{4} \cdot \frac{1}{4} \cdot \frac{1}{2}=\frac{1}{2^{5}}$, therefore the probability of this outcome is $\frac{1}{2^{4}}\left(\frac{1}{2^{4}}+\frac{1}{2^{5}}\right)=\frac{3}{2^{9}}$. - In the similar manner, we can deduce, that the formula for the probability of the outcome $(100,0,25, C)$, is $\frac{1}{2^{5}}\left(\frac{3^{2}}{2^{7}}+\frac{3}{2^{6}}+\frac{3}{2^{7}}\right)=\frac{9}{2^{1} 1}$. - And for the last of the Arithmetix winning outcome, it is $\frac{1}{2^{4}} \cdot \frac{3}{2^{5}}+\frac{1}{2^{5}} \cdot\left(\frac{3^{2}}{2^{7}}+\frac{3}{2^{6}}+\frac{3}{2^{7}}\right)=\frac{3}{2^{9}}+\frac{9}{2^{11}}=\frac{21}{2^{11}}$. - For the first Combinatorica's winning outcome it has to be accuracy spell, hit, accuracy spell, hit. Which yields $\frac{1}{2^{2}} \cdot \frac{3}{2^{2}} \cdot 12=\frac{3}{2^{5}}$. - For the second of the Combinatorica's winning outcome it is either accuracy spell, hit, accuracy spell, miss, accuracy spell, hit or accuracy spell, miss, accuracy spell, hit, accuracy spell, hit. These total to $\frac{1}{2^{3}} \cdot\left(\frac{3}{4} \cdot \frac{1}{2} \cdot \frac{1}{4}+\frac{1}{4} \cdot \frac{1}{2} \cdot \frac{1}{4}\right)=$ $\frac{1}{2^{3}}\left(\frac{3}{2^{5}}+\frac{1}{2^{5}}\right)=\frac{1}{2^{6}}$. Therefore probability that match finish with one of the wizards taking no damage is sum of the probabilities of above-mentioned cases. Hence $\frac{1}{2^{7}}+\frac{3}{2^{9}}+\frac{9}{2^{11}}+\frac{21}{2^{11}}+\frac{3}{2^{5}}+\frac{1}{2^{6}}=\frac{29}{2^{10}}+\frac{7}{2^{6}}=\frac{141}{1024}$. Problem 48. Let $a$ and $b$ be positive integers and $\left(A_{n}\right)_{n=1}^{\infty}$ be a sequence of real numbers satisfying the relations $A_{1}=b, A_{2}=a$ and $$ A_{n}=A_{n-1}+A_{n-2} \quad \text { for every } n \geq 3 $$ Next, let $\left(B_{n}\right)_{n=1}^{\infty}$ be another sequence satisfying $B_{1}=a+2 b, B_{2}=3 a+b$ and again $$ B_{n}=B_{n-1}+B_{n-2} \quad \text { for every } n \geq 3 $$ Furthermore, we know that there exist indices $k, l \geq 1$ such that $A_{k}=2022$ and $B_{l}=2793$. What is the minimal possible value of $a \cdot b$ ? Result. 1080 Solution. Note that $B_{n}=A_{n}+A_{n+2}$ - for $n=1$ we have $A_{1}+A_{3}=A_{1}+\left(A_{1}+A_{2}\right)=a+2 b=B_{1}$, for $n=2$ it is $A_{2}+A_{4}=A_{2}+\left(A_{2}+A_{3}\right)=2 a+(a+b)=3 a+b=B_{2}$, and further derived by induction: $B_{n+2}=B_{n+1}+B_{n}=$ $\left(A_{n+1}+A_{n+3}\right)+\left(A_{n}+A_{n+2}\right)=\left(A_{n}+A_{n+1}\right)+\left(A_{n+2}+A_{n+3}\right)=A_{n+2}+A_{n+4}$. Since numbers $a, b$ are positive, we have $A_{n+1}>A_{n}$ for $n \geq 2$, and $A_{3}>A_{1}$. As we will see that 1080 is attainable as a solution. Assume that $k>2$, as otherwise the answer $a b=A_{1} A_{2}$ would be equal to at least 2022 . The assumption, that $k \leqslant l$, is in contradiction with $$ 2793=A_{l+2}+A_{l}=A_{l+1}+2 A_{l}>2 A_{l} \geq 2 A_{k}=2 \cdot 2022=4044 $$ Therefore, $k>l$. Moreover $k=l+1$ leads to $$ 2793=A_{l+2}+A_{l}=A_{l+1}+2 A_{l}=2022+2 A_{l} $$ and as the right handside is even, and the left one is odd this case is not possible. The assumption that $k>l+3$ is in contradiction with $2793=A_{l}+A_{l+2}p^{2}+p$. Result. 36668 Solution. Note that $a^{3}+b^{3}+c^{3}-3 a b c=\frac{1}{2} \cdot(a+b+c)\left((a-b)^{2}+(b-c)^{2}+(c-a)^{2}\right)$. Now, letting $a-b=x, b-c=y$ it follows that $c-a=-x-y$. Then, $\frac{1}{2}\left((a-b)^{2}+(b-c)^{2}+(c-a)^{2}\right)=x^{2}+x y+y^{2}$. Thus, we use the following facts: 1. If $p \equiv 2(\bmod 3)$ such that $p$ divides $x^{2}+x y+y^{2}$ then $p$ divides $x, y$. 2. If $p \equiv 1(\bmod 3)$ the equation $z^{2}+z+1 \equiv 0(\bmod p)$ has two roots namely $r, r^{-1}$. Thus, $x^{2}+x y+y^{2} \equiv$ $(x-r y)\left(x-r^{-1} y\right)(\bmod p)$. Therefore, if $p$ divides $x^{2}+x y+y^{2}$ then $x \equiv r y(\bmod p)$ or $x \equiv r^{-1} y(\bmod p)$. Now, if $p \equiv 2(\bmod 3)$ then either $a+b+c \equiv 0(\bmod p)$ and this leads to $p^{2}$ triples or $p$ divides $x^{2}+x y+y^{2}$ which according to fact i leads to $a-b \equiv b-c \equiv 0(\bmod p)$. Hence, $a \equiv b \equiv c(\bmod p)$. We only need to remove the duplicate case, that is, when $a \equiv b \equiv c(\bmod p)$ and $a+b+c \equiv 0(\bmod p)$. This leads to the removal of $(0,0,0)$. Hence, we have $p^{2}+p-1$ solutions. Thus, $N_{p} \leq p^{2}+p$ for all $p \equiv 2(\bmod 3)$. If $p \equiv 1(\bmod 3)$, then there are $p^{2}$ solutions for $a+b+c \equiv 0(\bmod p)$. If $p$ divides $x^{2}+x y+y^{2}$ then, according to the second fact, either $a-b \equiv r(b-c)(\bmod p)$ or $a-b \equiv r^{-1}(b-c)(\bmod p)$. In the former case, we would obtain $a \equiv(r+1) b-r c(\bmod p)$ and in the latter case, we have $a \equiv\left(r^{-1}+1\right) b-r^{-1} c(\bmod p)$. In each case, there are $p^{2}$ triplets $(a, b, c)$. The last two cases have common solutions whenever $a \equiv b \equiv c(\bmod p)$. Thus, there are $p$ double counted solutions. If the first two equations have a common solutions then $(r+2) b-(r-1) c \equiv 0(\bmod p)$. Hence, there are $p$ solutions here. Finally, if all three equations have a common solution it follows that $a \equiv b \equiv c \equiv 0(\bmod p)$. According to the inclusion-exclusion principle, there are $3 p^{2}-3 p+1$ solutions. Finally if $p=3$ then we find that $a^{3}+b^{3}+c^{3} \equiv 0(\bmod 3)$. Since $x^{3} \equiv x(\bmod 3)$ it follows that $a+b+c \equiv 0$ $(\bmod 3)$. Hence, there are only 9 solutions here. Since $3 p^{2}-3 p+1>p^{2}+p$ for all prime of the form $3 k+1$ we find that the answer is all the primes of the form $3 k+1$. Their sum is: 36668 . ## Remark. There are several ways for proving facts 1 and 2 . To prove 1 st consider equation $x^{3} \equiv y^{3}(\bmod p)$. Raising both sides to the exponent of $\frac{p+1}{3}$ to obtain $x^{p+1} \equiv y^{p+1}(\bmod p)$. Now, if $p$ doesn't divide $x, y$ it follows that $x^{2} \equiv y^{2}$ $(\bmod p)$. Thus, $x^{2} \equiv y^{2}(\bmod p)$ and $x^{3} \equiv y^{3}(\bmod p)$. It follows that $x \equiv y(\bmod p)$. Hence, $0 \equiv x^{2}+x y+y^{2} \equiv 3 y^{2}$ $(\bmod p)$. Thus, $p$ must divide 3 , But, $p$ is of the form $3 k+2$. In order to prove the 2 nd fact, note that the equation $z^{3} \equiv 1(\bmod p)$ has three solutions whenever $p \equiv 1(\bmod 3)$. Thus, $z^{2}+z+1 \equiv 0(\bmod p)$ has two roots namely $r, r^{-1}$. Problem 51. Determine the number of ways to put kings (at least one) on a $3 \times 11$-chessboard such that no two kings attack each other. Note: Two kings not attacking each other means that two kings are not allowed to be positioned on adjacent squares, neither horizontally nor vertically nor diagonally. Result. 132290 Solution. For $n \geq 0$, let $k(n)$ be the number of positions of kings on a $3 \times n$-chessboard such that no two kings attack each other including an "empty chessboard". Since there is only one empty chessboard we have $k(0)=1$. Furthermore, we get $k(1)=5$ ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-20.jpg?height=324&width=918&top_left_y=787&top_left_x=570) and $k(2)=11$ by direct enumeration. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-20.jpg?height=728&width=1704&top_left_y=1209&top_left_x=176) Now we can compute $k(3)=35$. If the middle column is not occupied by any king, we have 5 possibilites for the first and the third column in each case due to $k(1)=5$. This leads to 25 possibilities including the empty chessboard. If only the second column is occupied, we have 4 different cases to put one or two kings in this column. In addition, there are 6 possible positions of kings such that both the middle column and one of the outer columns are taken. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-21.jpg?height=714&width=1106&top_left_y=144&top_left_x=476) Hence we classify the possible positions $k(n)$ on a $3 \times n$-chessboard for $n \geq 2$ according to the occupation of the last column at the right border. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-21.jpg?height=314&width=263&top_left_y=982&top_left_x=194) $k_{e}(n)$ (empty) ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-21.jpg?height=320&width=280&top_left_y=979&top_left_x=477) $k_{d}(n)$ (down) ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-21.jpg?height=314&width=277&top_left_y=982&top_left_x=772) $k_{m}(n)$ (middle) ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-21.jpg?height=317&width=277&top_left_y=984&top_left_x=1072) $k_{u}(n) \quad($ up $)$ ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-21.jpg?height=320&width=274&top_left_y=979&top_left_x=1368) (two) From that we conclude $k(n)=k_{e}(n)+k_{d}(n)+k_{m}(n)+k_{u}(n)+k_{t}(n)$ and, since kings must not attack each other, we get the following equations: $$ \begin{aligned} k_{e}(n) & =k(n-1) \\ k_{d}(n) & =k_{u}(n-1)+k_{e}(n-1) \\ k_{u}(n) & =k_{d}(n-1)+k_{e}(n-1) \\ k_{m}(n) & =k_{t}(n)=k_{e}(n-1) \end{aligned} $$ Due to symmetry we have $k_{d}(n)=k_{u}(n)$ and for $n \geq 2$ we see the relationship $$ \begin{aligned} k(n) & =k_{e}(n)+2 \cdot k_{d}(n)+2 \cdot k_{m}(n) \\ & =k(n-1)+2 \cdot k_{d}(n)+2 \cdot k_{e}(n-1) \\ & =k(n-1)+2 \cdot k_{d}(n)+2 \cdot k(n-2) \end{aligned} $$ leading to the equation $$ 2 \cdot k_{d}(n)=k(n)-k(n-1)-2 \cdot k(n-2) $$ Starting from $k_{d}(n)=k_{u}(n-1)+k_{e}(n-1)$ we obtain $$ 2 \cdot k_{d}(n)=2 \cdot k_{d}(n-1)+2 \cdot k(n-2) $$ Inserting the equation for $k_{d}$ two times, we get the recursion $$ \begin{aligned} & k(n)-k(n-1)-2 \cdot k(n-2)=k(n-1)-k(n-2)-2 \cdot k(n-3)+2 \cdot k(n-2) \\ \Longleftrightarrow \quad & k(n)=2 \cdot k(n-1)+3 \cdot k(n-2)-2 \cdot k(n-3) \end{aligned} $$ for $k(n)$ with $n \geq 3$ and the starting conditions $k(0)=1$ and $k(1)=5$ and $k(2)=11$. Computing this recursion up to $k(11)$, we get $$ \begin{aligned} k(3) & =2 \cdot 11+3 \cdot 5-2 \cdot 1=35 \\ k(4) & =2 \cdot 35+3 \cdot 11-2 \cdot 5=93 \\ k(5) & =2 \cdot 93+3 \cdot 35-2 \cdot 11=269 \\ k(6) & =2 \cdot 269+3 \cdot 93-2 \cdot 35=747 \\ k(7) & =2 \cdot 747+3 \cdot 269-2 \cdot 93=2115 \\ k(8) & =2 \cdot 2115+3 \cdot 747-2 \cdot 269=5933 \\ k(9) & =2 \cdot 5933+3 \cdot 2115-2 \cdot 747=16717 \\ k(10) & =2 \cdot 16717+3 \cdot 5993-2 \cdot 2115=47003 \\ k(11) & =2 \cdot 47003+3 \cdot 16717-2 \cdot 5933=132291 \end{aligned} $$ After subtracting the empty chessboard, we get the solution 132290 . Problem 52. Given an acute-angled triangle $A B C$, the points $A^{\prime}, B^{\prime}$ and $C^{\prime}$ are defined as follows: $A^{\prime}$ is the point where altitude from $A$ on the side $B C$ meets the outwards-facing semicircle with $B C$ as the diameter. Points $B^{\prime}, C^{\prime}$ are located analogously. Let us denote by $[X Y Z]$ the area of triangle $X Y Z$. If $\left[B C A^{\prime}\right]=5,\left[B^{\prime} C A\right]=6,\left[B C^{\prime} A\right]=7$, find $[A B C]$. Result. $\quad \sqrt{110} \doteq 10.488$ Solution. We will prove $\left[B C A^{\prime}\right]^{2}+\left[C A B^{\prime}\right]^{2}+\left[A B C^{\prime}\right]^{2}=[A B C]^{2}$, which gives the result. Denote $D$ foot of perpendicular from $A$ to $B C$. From Euclid height theorems we can show that $\left|A^{\prime} D\right|^{2}=|B D| \cdot|D C|$ hence $$ \left(\frac{\left[B A^{\prime} C\right]}{[B A C]}\right)^{2}=\frac{|B D| \cdot|C D|}{|A D|^{2}} $$ Because: $\frac{|B D|}{|A D|}=\operatorname{cotan}(\beta)$, we want to prove $$ \sum \operatorname{cotan}(\beta) \cdot \operatorname{cotan}(\gamma)=1 $$ Since $\alpha+\beta+\gamma=180^{\circ}$, it follows that $0=\sin (\alpha+\beta+\gamma)=\sin (\alpha) \cdot \cos (\beta) \cdot \cos (\gamma)+\sin (\beta) \cdot \cos (\alpha) \cdot \cos (\gamma)+\sin (\gamma) \cdot \cos (\beta) \cdot \cos (\alpha)-\sin (\alpha) \cdot \sin (\beta) \cdot \sin (\gamma)$, $\sin (\alpha) \cdot \sin (\beta) \cdot \sin (\gamma)=\sin (\alpha) \cdot \cos (\beta) \cdot \cos (\gamma)+\sin (\beta) \cdot \cos (\alpha) \cdot \cos (\gamma)+\sin (\gamma) \cdot \cos (\beta) \cdot \cos (\alpha)$, $1=\frac{\cos (\beta) \cdot \cos (\gamma)}{\sin (\beta) \cdot \sin (\gamma)}+\frac{\cos (\beta) \cdot \cos (\alpha)}{\sin (\beta) \cdot \sin (\alpha)}+\frac{\cos (\alpha) \cdot \cos (\gamma)}{\sin (\alpha) \cdot \sin (\gamma)}=\operatorname{cotan}(\beta) \cdot \operatorname{cotan}(\gamma)+\operatorname{cotan}(\alpha) \cdot \operatorname{cotan}(\gamma)+\operatorname{cotan}(\beta) \cdot \operatorname{cotan}(\alpha)=1$. Therefore area $[A B C]$ can be found as $\sqrt{\left[A^{\prime} B C\right]^{2}+\left[A B^{\prime} C\right]^{2}+\left[A B C^{\prime}\right]^{2}}=\sqrt{25+36+49}=\sqrt{110}$. Problem 53. In the real-time strategy game The Settlers, Valentin finds a new island with the following properties: - The island of the shape of a circular disc has three ports $A, B$, and $C$ at its shore. - There are four important buildings $D, E, G$, and $H$, which form the vertices of a rectangle $D E G H$. - At the center $D$ of the island there is the castle. - The church $E$ is located exactly half-way between port $B$ and port $A$. - The hunter's hut $G$ is situated closer to port $B$ than to port $A$. - The storehouse $H$ of all resources lies exactly at the orthocenter of the triangle $\triangle A B C$. Valentin knows that the distance from $D$ to $E$ is $8 \mathrm{~km}$ and that the distance from $E$ to $G$ is $13 \mathrm{~km}$. How many kilometers does he have to transport his ore from the storehouse to the nearest port? Result. 10 Solution. Calculations are done without using units. Since $D E G H$ is a rectangle, we have $|D E|=|H G|=8$ and $|D H|=|E G|=13$. Furthermore, we know that $H$ is closer to $B$ than to $A$, that $D$ is the circumcenter and $H$ is the orthocenter of the triangle $\triangle A B C$. ![](https://cdn.mathpix.com/cropped/2024_06_04_83623551ceb391442cccg-23.jpg?height=882&width=899&top_left_y=296&top_left_x=584) Since circumcenter $D$, centroid $S$ and orthocenter $H$ lie on the Euler line satisfying $|S H|=2|D S|$, for the similar triangles $\triangle S H C$ and $\triangle E G C$ we have $$ \frac{|C H|}{|H S|}=\frac{|C G|}{|G E|} \Longleftrightarrow \frac{|C H|}{2}=\frac{|C G|}{3} \Longleftrightarrow|C H|=2 \cdot|H G| $$ This yields $|C H|=16$. Since $\triangle D H C$ is right-angled, we get $|C D|^{2}=16^{2}+13^{2}$ by the Pythagorean theorem. Note that the radius of the circumcircle of $\triangle A B C$ is $|A D|=|B D|=|C D|$. In the right-angled triangle $\triangle A E D$, we obtain $|A E|=\sqrt{16^{2}+13^{2}-8^{2}}=19=|E B|$ and hence $|G B|=19-13=6$. Using the Pythagorean theorem once more, we get $|H B|^{2}=\sqrt{8^{2}+6^{2}}=10$. Therefore, the distance from $H$ to the nearest port is $10 \mathrm{~km}$.