exam: BalticWay

problem:
Let $\alpha$ be a non-zero real number. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that

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

for all $x, y \in \mathbb{R}$.
Answer: $f(x)=c x^{2}$ for any real constant $c$ if $\alpha=2 ; f(x)=0$ otherwise.

solution:
Let $P(x, y)$ denote the assertion of the given functional equation. Note that $P(1,0)$ is $f(1)=f(1)+f(0)$ which implies

$$
f(0)=0
$$

Applying this result to $P(x,-x)$ and $P(-x, x)$ where $x \neq 0$ we get:

$$
\begin{aligned}
& 0=(1-\alpha) x f(x)+x f(-x) \\
& 0=(\alpha-1) x f(-x)-x f(x)
\end{aligned}
$$

By adding (1) and (2) and simplifying, we get $0=\alpha x f(-x)-\alpha x f(x)$ which implies

$$
f(x)=f(-x)
$$

for all $x \neq 0$. Since $f(0)=0=f(-0)$, we can conclude that $f$ is even. Therefore (1) simplifies to

$$
0=x f(x)(2-\alpha)
$$

which implies that if $\alpha \neq 2$ then $f(x)=0$ for all $x \in \mathbb{R}$. It is easy to check that this function works. Now let us consider the case $\alpha=2$. The initial functional equation becomes

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

which can be rewritten as

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

Note that the right hand side is symmetric with respect to $x$ and $y$. From this we can deduce that $x f(x+y)-(x+y) f(x)=y f(x+y)-(x+y) f(y)$ where factorizing yields

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

By replacing $y$ with $-y$ and using the fact that $f$ is even, we get

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

Taking $x=\frac{z+1}{2}$ and $y=\frac{z-1}{2}$ in both (3) and 4, we get

$$
\begin{aligned}
f(z) & =z\left(f\left(\frac{z+1}{2}\right)-f\left(\frac{z-1}{2}\right)\right) \\
z f(1) & =f\left(\frac{z+1}{2}\right)-f\left(\frac{z-1}{2}\right)
\end{aligned}
$$

respectively. Equations (5) and (6) together yield $f(z)=z \cdot z f(1)=z^{2} f(1)$ which must hold for all $z \in \mathbb{R}$.

Thus, the only possible functions that satisfy the given relation for $\alpha=2$ are $f(x)=c x^{2}$ for some real constant $c$. It is easy to check that they indeed work.

solution_match: Solution 1:


solution:
Multiplying the given equation by $y$ gives

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

which is equivalent to

$$
x y(f(x+y)-f(x)-f(y))=\alpha y^{2} f(x)
$$

The left-hand side of this equation is symmetric in $x$ and $y$. Hence the right-hand side must also stay the same if we swap $x$ and $y$, i.e.,

$$
\alpha y^{2} f(x)=\alpha x^{2} f(y)
$$

As $\alpha \neq 0$, this implies

$$
y^{2} f(x)=x^{2} f(y)
$$

Setting $y=1$ in this equation immediately gives $f(x)=c x^{2}$ where $c=f(1)$. Plugging $f(x)=c x^{2}$ into the original equation gives

$$
c x(x+y)^{2}=c(x+\alpha y) x^{2}+c x y^{2}
$$

where terms can be rearranged to obtain

$$
c x(x+y)^{2}=c x\left(x^{2}+\alpha x y+y^{2}\right)
$$

If $c=0$ then (7) is satisfied. Hence for every $\alpha$, the function $f(x)=0$ is a solution. If $c \neq 0$ then (7) is satisfied if and only if $\alpha=2$. Hence in the case $\alpha=2$, all functions $f(x)=c x^{2}$ (where $c \neq 0$ ) are also solutions.

solution_match: Solution 2:


problem:
Let $\mathbb{R}^{+}$be the set of all positive real numbers. Find all functions $f: \mathbb{R}^{+} \rightarrow \mathbb{R}^{+}$such that

$$
\frac{f(a)}{1+a+c a}+\frac{f(b)}{1+b+a b}+\frac{f(c)}{1+c+b c}=1
$$

for all $a, b, c \in \mathbb{R}^{+}$that satisfy $a b c=1$.
Answer: $f(x)=k x+1-k$ where $k$ is any real number such that $0 \leq k \leq 1$.

solution:
Note that $\frac{1}{1+a+c a}=b c \cdot \frac{1}{1+c+b c}$ since $a b c=1$. Similarly,

$$
\frac{1}{1+b+a b}=a c \cdot \frac{1}{1+a+c a}=c \cdot \frac{1}{1+c+b c}
$$

So the initial equality becomes $\frac{b c f(a)+c f(b)+f(c)}{1+c+b c}=1$ which yields

$$
b c f\left(\frac{1}{b c}\right)+c f(b)+f(c)=1+c+b c
$$

Taking $a=b=c=1$ in (8) gives $f(1)+f(1)+f(1)=3$ which implies $f(1)=1$. Using this fact after substituting $c=1$ into 8 yields $b f\left(\frac{1}{b}\right)+f(b)=1+b$, so $b f\left(\frac{1}{b}\right)=1+b-f(b)$ for all $b \in \mathbb{R}^{+}$. Applying this in (8) gives $1+b c-f(b c)+c f(b)+f(c)=1+c+b c$, so

$$
c f(b)+f(c)=c+f(b c)
$$

Swapping $b$ and $c$ here gives

$$
b f(c)+f(b)=b+f(b c)
$$

Subtracting the last equality from the second last one and rearranging the terms gives

$$
c f(b)-f(b)+f(c)-b f(c)=c-b
$$

Substituting $c=2$ into (9) gives $f(b)+f(2)-b f(2)=2-b$, so $f(b)=b(f(2)-1)+2-f(2)$. Denoting $f(2)-1=k$, we get $f(b)=k b+1-k$ for all $b \in \mathbb{R}^{+}$.
Note that if $k<0$, then for large enough $b$ the value of $f(b)$ would become negative. If $k>1$, then for small enough $b$ the value of $f(b)$ would become negative. Therefore $k \in[0,1]$. After substituting $f(x)=k x+1-k$ into 8e can see that it is satisfied. Hence this function satisfies the original equality for all $a, b, c \in \mathbb{R}^{+}$such that $a b c=1$.

solution_match: Solution:


problem:
Positive real numbers $a_{1}, a_{2}, \ldots, a_{2024}$ are written on the blackboard. A move consists of choosing two numbers $x$ and $y$ on the blackboard, erasing them and writing the number $\frac{x^{2}+6 x y+y^{2}}{x+y}$ on the blackboard. After 2023 moves, only one number $c$ will remain on the blackboard. Prove that

$$
c<2024\left(a_{1}+a_{2}+\ldots+a_{2024}\right)
$$

solution:
Note that by GM-HM we have

$$
\frac{x^{2}+6 x y+y^{2}}{x+y}=x+y+\frac{4 x y}{x+y}=x+y+2 \cdot \frac{2}{\frac{1}{x}+\frac{1}{y}} \leq x+y+2 \sqrt{x y}=(\sqrt{x}+\sqrt{y})^{2}
$$

which means that

$$
\sqrt{\frac{x^{2}+6 x y+y^{2}}{x+y}} \leq \sqrt{x}+\sqrt{y}
$$

Therefore after each move the sum of square roots of all numbers on the blackboard decreases or stays the same. This implies that

$$
\sqrt{c} \leq \sqrt{a_{1}}+\sqrt{a_{2}}+\ldots+\sqrt{a_{2024}}
$$

By QM-AM we have

$$
\sqrt{a_{1}}+\sqrt{a_{2}}+\ldots+\sqrt{a_{2024}} \leq 2024 \sqrt{\frac{a_{1}+a_{2}+\ldots+a_{2024}}{2024}}
$$

Hence $c \leq 2024\left(a_{1}+a_{2}+\ldots+a_{2024}\right)$.
It remains to show that the equality cannot hold. Suppose, for the sake of contradiction, that

$$
c=2024\left(a_{1}+a_{2}+\ldots+a_{2024}\right)
$$

For this to occur, all the inequalities used must be equalities. Note that the last equality holds if and only if $a_{1}=a_{2}=\cdots=a_{2024}$. Also to reach the equality we must have $x=y$ at each move, so that the sum of square roots of all numbers on the blackboard stays the same all the time. So the square root of the number occurring 2024 times on the blackboard in the beginning is $\frac{\sqrt{c}}{2024}$, and choosing two copies of any number $x$ with square root $\sqrt{x}$ yields a number with square root $2 \sqrt{x}$ after the move. Hence the square root of any number occurring on the blackboard during the process must be of the form $\frac{\sqrt{c}}{2024} \cdot 2^{k}$ for a natural number $k$. But the square root of the number in the blackboard in the end is $\sqrt{c}$ which is not of this form since 2024 is not a power of 2 . The contradiction shows that the equality cannot be achieved and we are done.


problem:
Find the largest real number $\alpha$ such that, for all non-negative real numbers $x, y$ and $z$, the following inequality holds:

$$
(x+y+z)^{3}+\alpha\left(x^{2} z+y^{2} x+z^{2} y\right) \geq \alpha\left(x^{2} y+y^{2} z+z^{2} x\right) .
$$

Answer: $6 \sqrt{3}$.

solution:
Without loss of generality, $x$ is the largest amongst the three variables. By moving $\alpha\left(x^{2} z+y^{2} x+z^{2} y\right)$ to the right-hand side and factoring, we get the equivalent inequality

$$
(x+y+z)^{3} \geq \alpha(x-y)(x-z)(y-z)
$$

If $z>y$, then the right-hand side is non-positive, so we can assume $x \geq y \geq z$.
Note that

$$
\begin{aligned}
x+y+z & \geq x+y-2 z \\
& =\frac{1}{\sqrt{3}}(x-y)+\left(1-\frac{1}{\sqrt{3}}\right)(x-z)+\left(1+\frac{1}{\sqrt{3}}\right)(y-z) \\
& \geq 3 \sqrt[3]{\frac{2}{3 \sqrt{3}}(x-y)(x-z)(y-z)} .
\end{aligned}
$$

Cubing both sides gives $(x+y+z)^{3} \geq 6 \sqrt{3}(x-y)(x-z)(y-z)$. The equality holds when $z=0$ and $x=y(2+\sqrt{3})$. So $\alpha=6 \sqrt{3}$.


problem:
Find all positive real numbers $\lambda$ such that every sequence $a_{1}, a_{2}, \ldots$ of positive real numbers satisfying

$$
a_{n+1}=\lambda \cdot \frac{a_{1}+a_{2}+\ldots+a_{n}}{n}
$$

for all $n \geq 2024^{2024}$ is bounded.
Remark: A sequence $a_{1}, a_{2}, \ldots$ of positive real numbers is bounded if there exists a real number $M$ such that $a_{i}<M$ for all $i=1,2, \ldots$
Answer: All positive real numbers $\lambda \leq 1$.

solution:
First we will show that for all $\lambda>1$ every such sequence is unbounded. Note that $a_{n}=\lambda \cdot \frac{a_{1}+a_{2}+\ldots+a_{n-1}}{n-1}$ implies

$$
\frac{a_{n}(n-1)}{\lambda}=a_{1}+a_{2}+\ldots+a_{n-1}
$$

for all $n>2024^{2024}$. Therefore

$$
\begin{aligned}
a_{n+1} & =\lambda \cdot \frac{a_{1}+a_{2}+\ldots+a_{n}}{n} \\
& =\lambda\left(\frac{a_{1}+a_{2}+\ldots+a_{n-1}}{n}+\frac{a_{n}}{n}\right) \\
& =\lambda\left(\frac{a_{n}(n-1)}{\lambda n}+\frac{a_{n}}{n}\right) \\
& =a_{n}\left(\frac{n-1}{n}+\frac{\lambda}{n}\right) \\
& =a_{n}\left(1+\frac{\lambda-1}{n}\right)
\end{aligned}
$$

Hence for all $n>2024^{2024}$ and positive integers $k$ we have

$$
a_{n+k}=a_{n} \cdot\left(1+\frac{\lambda-1}{n}\right)\left(1+\frac{\lambda-1}{n+1}\right) \ldots\left(1+\frac{\lambda-1}{n+k-1}\right) .
$$

This implies that

$$
\begin{aligned}
\frac{a_{n+k}}{a_{n}} & =\left(1+\frac{\lambda-1}{n}\right)\left(1+\frac{\lambda-1}{n+1}\right) \ldots\left(1+\frac{\lambda-1}{n+k-1}\right) \\
& >\frac{\lambda-1}{n}+\frac{\lambda-1}{n+1}+\ldots+\frac{\lambda-1}{n+k-1} \\
& =(\lambda-1) \cdot\left(\frac{1}{n}+\frac{1}{n+1}+\ldots+\frac{1}{n+k-1}\right) .
\end{aligned}
$$

As the sequence $\left(1+\frac{1}{2}+\frac{1}{3}+\ldots+\frac{1}{m}\right)_{m \geq 1}$ is unbounded and $\lambda-1>0$, the ratio $\frac{a_{n+k}}{a_{n}}$ is unbounded, implying that the sequence $\left(a_{n}\right)_{n \geq 1}$ is also unbounded.
Now it remains to show that for all $\lambda \leq 1$ every such sequence is bounded. To this end, define $M=\max \left(a_{1}, a_{2}, \ldots, a_{20242024}\right)$. We will show by induction on $n$ that $a_{n} \leq M$ for all $n$. This holds trivially for $n=1,2, \ldots, 2024^{2024}$. For the induction step, assume the desired inequality for some $n \geq 2024^{2024}$ and note that

$$
a_{n+1}=\lambda \cdot \frac{a_{1}+a_{2}+\ldots+a_{n}}{n} \leq \frac{a_{1}+a_{2}+\ldots+a_{n}}{n} \leq \max \left(a_{1}, a_{2}, \ldots, a_{n}\right)=M
$$

The required result follows.


problem:
A labyrinth is a system of 2024 caves and 2023 non-intersecting (bidirectional) corridors, each of which connects exactly two caves, where each pair of caves is connected through some sequence of corridors. Initially, Erik is standing in a corridor connecting some two caves. In a move, he can walk through one of the caves to another corridor that connects that cave to a third cave. However, when doing so, the corridor he was just in will magically disappear and get replaced by a new one connecting the end of his new corridor to the beginning of his old one (i.e., if Erik was in a corridor connecting caves $a$ and $b$ and he walked through cave $b$ into a corridor that connects caves $b$ and $c$, then the corridor between caves $a$ and $b$ will disappear and a new corridor between caves $a$ and $c$ will appear).

Since Erik likes designing labyrinths and has a specific layout in mind for his next one, he is wondering whether he can transform the labyrinth into that layout using these moves. Prove that this is in fact possible, regardless of the original layout and his starting position there.

solution:
Throughout the solution, we denote a corridor directly connecting caves $a$ and $b$ by $a b$.
First we show that Erik can reverse his moves. Indeed, consider three caves $a, b, c$ such that $a b$ and $b c$ are corridors, and assume that Erik stands in the corridor $a b$. He can then perform the moves $a b \rightarrow b c \rightarrow c a \rightarrow a b$ in succession (Fig. 1\} note that after each move, the edge he is about to walk to in the sequence has just appeared as a consequence of his last move). But this will take him back to where he started as well as make sure that the layout of the labyrinth has not changed. Hence after performing the first move, he can "undo" it by performing the remaining two moves in this sequence.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-05.jpg?height=163&width=701&top_left_y=2397&top_left_x=729)

Figure 1
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-06.jpg?height=170&width=518&top_left_y=172&top_left_x=820)

Figure 2

This means that it is enough to show that Erik can turn any layout into the star shape (i.e., a layout with one central cave that all the remaining caves are directly connected to), since if he can get from any layout to the star shape he can also get from the star shape to any layout. Let us prove this by induction on the number $n$ of caves.

For $n=3$, any allowed layout has the star shape, so let us assume $n \geq 4$. It is easy to see that there has to exist at least two caves, each of which being connected to only one other cave. These caves cannot be directly connected to each other (otherwise they could not be connected to other caves). Hence one of these two caves, say $v$, is such that Erik is not initially standing in the only corridor adjacent to it. By the induction hypothesis, Erik can then perform some sequence of moves that will transform the labyrinth excluding $v$ into the star shape with $n-1$ caves. Let the central cave of the star be $c$ and assume that Erik is standing in the corridor $c w$. We have to consider three cases for how $v$ is connected to other caves:

- The cave $v$ is directly connected to $c$. In this case we already have the star shape with $n$ caves, and so we are done.
- The cave $v$ is directly connected to $w$. In this case Erik can make the moves $c w \rightarrow w v \rightarrow v c$ (Fig. 2). Then the resulting layout has the star shape.
- The cave $v$ is directly connected to some other non-central cave $u$. In this case Erik can make the moves

$$
w c \rightarrow c u \rightarrow u w \rightarrow u v \rightarrow v w \rightarrow w c \rightarrow w u \rightarrow u c
$$

(Fig. 3). Then the resulting layout has the star shape.
In all cases, we have shown that we can turn the labyrinth into the star shape. So we are done by induction.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-06.jpg?height=230&width=1400&top_left_y=1644&top_left_x=379)

Figure 3

A $45 \times 45$ grid has had the central unit square removed. For which positive integers $n$ is it possible to cut the remaining area into $1 \times n$ and $n \times 1$ rectangles?
Answer: 1, 2, 11, 22, 23.


solution:
Clearly, any $n$ that works must be a divisor of the number $45^{2}-1=2024$ of unit squares. Furthermore, it must not be greater than 45 , or else we cannot fit any $1 \times n$ rectangles in the grid. This leaves the options $n=1, n=2, n=4, n=8, n=11, n=22, n=23$ and $n=44$. Note that any divisor $d$ of a length $n$ that works also works, since we can just divide each of the $1 \times n$ and $n \times 1$ pieces into $1 \times d$ and $d \times 1$ pieces.

For $n=22$, we can cover the grid as in Fig. 4. By the above, this shows that $n=1, n=2$ and $n=11$ all work.

For $n=23$, we can cover the grid as in Fig. 5 .
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-07.jpg?height=689&width=692&top_left_y=175&top_left_x=319)

Figure 4
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-07.jpg?height=689&width=689&top_left_y=175&top_left_x=1140)

Figure 5

The remaining possibilities are $n=4, n=8$ and $n=44$. All of these are divisible by 4 , and hence if any of them work $n=4$ would also have to work. However, $n=4$ does not work. Indeed, color gray all rows with row numbers congruent to 1 or 2 modulo 4 (Fig. 6). Then any $1 \times 4$ or $4 \times 1$ piece will cover an even number of gray squares. But there is an odd number of gray squares in total, since the number of gray rows is odd, as well as the length of any row, and the center square is white as it is in row 23 . So it is impossible to cover all of them.

Consequently, $n=1,2,11,22,23$ are the only values that work.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-07.jpg?height=686&width=692&top_left_y=1390&top_left_x=728)

Figure 6


problem:
Let $a, b, n$ be positive integers such that $a+b \leq n^{2}$. Alice and Bob play a game on an (initially uncoloured) $n \times n$ grid as follows:

- First, Alice paints $a$ cells green.
- Then, Bob paints $b$ other (i.e. uncoloured) cells blue.

Alice wins if she can find a path of non-blue cells starting with the bottom left cell and ending with the top right cell (where a path is a sequence of cells such that any two consecutive ones have a common side), otherwise Bob wins. Determine, in terms of $a, b$ and $n$, who has a winning strategy. Answer: If $a \geq \min (2 b, 2 n-1)$, Alice wins, otherwise Bob wins.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-08.jpg?height=413&width=426&top_left_y=179&top_left_x=501)

Figure 7
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-08.jpg?height=413&width=418&top_left_y=179&top_left_x=1227)

Figure 8

solution:
If $a \geq 2 n-1$, Alice can win, for example by painting all the cells in the leftmost column and the topmost row green, ensuring that there will be a green path (Fig. 77).
If $2 n-1>a \geq 2 b$, Alice can also win. Indeed, note that $n>b$, so Alice can make sure to color (at least) the bottommost $b$ cells in the leftmost column and the rightmost $b$ cells in the topmost row green. There are now $b+1$ disjoint paths from some green square in the leftmost column to some green square in the topmost row (Fig. 8d), so there is no way for Bob to block all of the paths.
If however $a<\min (2 b, 2 n-1)$, Bob wins. Indeed, note that $\min (2 b, 2 n-1)$ is the number of all descending diagonals of length at most $b$. Hence after Alice has made her move, there must still be some of these diagonals with no green cells in it. Bob can color all cells in it blue and win.
Hence Alice wins iff $a \geq \min (2 b, 2 n-1)$.


problem:
Let $S$ be a finite set. For a positive integer $n$, we say that a function $f: S \rightarrow S$ is an $n$-th power if there exists some function $g: S \rightarrow S$ such that

$$
f(x)=\underbrace{g(g(\ldots g(x) \ldots))}_{g \text { applied } n \text { times }}
$$

for each $x \in S$.
Suppose that a function $f: S \rightarrow S$ is an $n$-th power for each positive integer $n$. Is it necessarily true that $f(f(x))=f(x)$ for each $x \in S$ ?
Answer: Yes.

solution:
Since $S$ is finite, there is a finite set of all functions $\left\{g_{1}, g_{2}, \ldots, g_{k}\right\}$ from $S$ to itself. Consider a function $F$ that assigns to each positive integer $n$ one of these functions such that $f$ is the $n$-th power of the function $F(n)$. So $F$ induces a partition of the set of all positive integers into sets $P_{i}$ consisting of all the integers $n$ such that $F(n)=g_{i}$.
For any positive integer $N$, consider the complete graph $K_{N}$ on $N$ vertices labeled 1 through $N$. We will colour the edges of $K_{N}$ in $k$ colours $C_{1}, C_{2}, \ldots, C_{k}$ according to the partition in the following way: If $|x-y|$ lies in $P_{i}$, colour the edge between $x$ and $y$ in the colour $C_{i}$. By Ramsey's theorem we can take $N$ to be large enough that there is a monochromatic triangle in $K_{N}$. This means that there are three integers $x, y$ and $z$ and an index $i$ for which $|x-y|,|y-z|,|z-x| \in P_{i}$. Hence there are three integers $a, b, c \in P_{i}$ such that $a+b=c$.
Therefore, some function $g_{i}: S \rightarrow S$ satisfies $f(x)=g_{i}^{a}(x)=g_{i}^{b}(x)=g_{i}^{a+b}(x)$ for each $x \in S$. Hence, $f(f(x))=g_{i}^{a}\left(g_{i}^{b}(x)\right)=g_{i}^{a+b}(x)=f(x)$ for each $x \in S$.
Remark: The fact that there is an index $i$ for which $P_{i}$ contains three integers $a, b, c$ such that $a+b=c$ is known as Schur's theorem.


solution:
Pick $x \in S$ arbitrarily and denote $y=f(x)$. We need to prove that $f(y)=y$. Let $n=|S|$ and consider the function $g: S \rightarrow S$ such that $f=g^{n!}$. As we must have $g^{n!}(x)=y$, the element $y$ must occur among the first $n$ terms of the sequence $x, g(x), g^{2}(x), \ldots$, i.e., $g^{k}(x)=y$ for
some $k<n$. So $g^{n!-k}(y)=y$, or putting it otherwise, $g^{n!-k-1}(g(y))=y$. Like before, we obtain that $y$ must occur among the first $n$ terms of the sequence $g(y), g^{2}(y), \ldots$, i.e., $g^{l}(y)=y$ for some $l \leq n$. So certainly $g^{n!}(y)=y$ as $l \mid n$ !. This proves the claim.


problem:
A frog is located on a unit square of an infinite grid oriented according to the cardinal directions. The frog makes moves consisting of jumping either one or two squares in the direction it is facing, and then turning according to the following rules:
(i) If the frog jumps one square, it then turns $90^{\circ}$ to the right;
(ii) If the frog jumps two squares, it then turns $90^{\circ}$ to the left.

Is it possible for the frog to reach the square exactly 2024 squares north of the initial square after some finite number of moves if it is initially facing:
(a) North;
(b) East?

Answer: (a) No; (b) Yes.

solution:
(a) We color the grid with 5 colors so that the color of a square is determined by the expression $2 x+y$ modulo 5 , where $(x, y)$ are the coordinates of the square (we assume that the side length of the square is 1 ; see Fig. 9). Without loss of generality, let the color of the target square be 0 , and let the frog be there facing in the positive $y$-direction. Before the move that brought the frog to this position, it must have been either on a square of color 1 , facing in the positive $x$ direction, or on a square of color 2 , facing in the negative $x$-direction. In either case, one move earlier, the frog must have been either on a square of color 3 , facing in the negative $y$-direction, or on a square of color 0 , facing in the positive $y$-direction. If at some point the frog was on a square of color 3 , facing in the negative $y$-direction, then before the move that brought it there, it must have been either on a square of color 1 , facing in the positive $x$-direction, or on a square of color 2 , facing in the negative $x$-direction. This exhausts all possible cases, showing that throughout the entire process, the frog could only be in one of the following four positions:

- On a square of color 0 , facing in the positive $y$-direction;
- On a square of color 1 , facing in the positive $x$-direction;
- On a square of color 2 , facing in the negative $x$-direction;
- On a square of color 3 , facing in the negative $y$-direction.

Based on this, we examine all possibilities:

|  |  |  |  |  |  |  |  |  |  |  |  |  |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|  | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 |  |
|  | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 |  |
|  | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 |  |
|  | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 |  |
|  | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 |  |
|  | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 |  |
|  | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 |  |
|  | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 |  |
|  | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 |  |
|  | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 |  |
|  | 0 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 3 | 0 |  |
|  |  |  |  |  |  |  |  |  |  |  |  |  |

Figure 9
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-09.jpg?height=615&width=615&top_left_y=1940&top_left_x=1166)

Figure 10

- If the positive $y$-direction corresponds to north, then the color of the initial square is 1 , and the frog must have been facing in the positive $x$-direction, that is, east.
- If the positive $y$-direction corresponds to east, then the color of the initial square is 3 , and the frog must have been facing in the negative $y$-direction, that is, west.
- If the positive $y$-direction corresponds to west, then the color of the initial square is 2 , and the frog must have been facing in the negative $x$-direction, that is, south.
- If the positive $y$-direction corresponds to south, then the color of the initial square is 4 , from which the frog could not reach the target square at all.
This demonstrates that if the frog reaches the target square, it cannot have been facing north at the initial square.
(b) Let the frog at some point face east. Then it can make the following moves: east 2 squares, north 2 squares, west 1 square, north 2 squares, west 1 square, north 1 square (Fig. 10). This way, the frog has moved a total of 5 squares north, and after these moves, it is again facing east. Therefore, by repeating this sequence of moves 405 times, the frog can reach a point 2025 squares north of the initial square. By omitting the last move, the frog reaches exactly the square that is 2024 squares north of the initial square.

Remark: Similarly to the solution of part (b), one can show that the frog can reach the desired square also after making its first move to the south or to the west.

Let $A B C D$ be a cyclic quadrilateral with circumcentre $O$ and with $A C$ perpendicular to $B D$. Points $X$ and $Y$ lie on the circumcircle of the triangle $B O D$ such that $\angle A X O=\angle C Y O=90^{\circ}$. Let $M$ be the midpoint of $A C$. Prove that $B D$ is tangent to the circumcircle of the triangle $M X Y$.

solution_match: # Solution:


solution:
Denote the circumradius of $A B C D$ by $r$ and the circumcircle of triangle $B O D$ by $\omega$. Let $T=A C \cap B D$, let $O T$ meet $\omega$ again at $S$, and let $O E$ be a diameter of $\omega$ (Fig. 11). We see that $A C \| O E$ as $A C \perp B D$ and $B D \perp O E$. Furthermore, note that

$$
\measuredangle D S T=\measuredangle D S O=\measuredangle D B O=\measuredangle O D B=\measuredangle O D T
$$

so $O D$ is tangent to the circumcircle of the triangle $D S T$ and thus $O T \cdot O S=O D^{2}=r^{2}$.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-10.jpg?height=914&width=1297&top_left_y=1656&top_left_x=431)

Figure 11

We find $\angle A X O=90^{\circ}=\angle O X E$ so $A, X, E$ are collinear. Since also $\angle A M O=90^{\circ}$, points $A$, $O, X, M$ are concyclic. Next, we can see that points $A, X, T, S$ are concyclic since $\measuredangle X A T=$ $\measuredangle E A C=\measuredangle A E O=\measuredangle X E O=\measuredangle X S O=\measuredangle X S T$. Moreover, $A O$ is tangent to this circle as $O T \cdot O S=r^{2}=O A^{2}$. Hence $\measuredangle M T X=\measuredangle A T X=\measuredangle O A X=\measuredangle O M X$, so $O M$ is tangent to the circumcircle of triangle $X M T$ at $M$.
By interchanging the roles of $A$ and $C$ and the roles of $X$ and $Y$, we can similarly prove that $O M$ is also tangent to the circumcircle of triangle $Y M T$ at $M$. But then these two circles must coincide. Now $O M \perp A C$ implies that $M T$ is a diameter of this one circle, and $A C \perp B D$ implies that $B D$ is tangent to it. The desired result follows.


problem: Let $A B C$ be an acute triangle with circumcircle $\omega$ such that $A B<A C$. Let $M$ be the midpoint of the arc $B C$ of $\omega$ containing the point $A$, and let $X \neq M$ be the other point on $\omega$ such that $A X=A M$. Points $E$ and $F$ are chosen on sides $A C$ and $A B$ of the triangle $A B C$, respectively, such that $E X=E C$ and $F X=F B$. Prove that $A E=A F$.

solution:
Triangles $X F B$ and $X E C$ are isosceles (Fig. 12). Note that $X$ lies on the shorter arc $A B$ of $\omega$ since otherwise the perpendicular bisector of $B X$ could not intersect side $A B$. Hence $\angle X B F=\angle X B A=\angle X C A=\angle X C E$ which implies that triangles $X F B$ and $X E C$ are similar. Therefore $\angle X F A=\angle X E A$. Hence $A E F X$ is a cyclic quadrilateral.
Let $X F$ intersect $\omega$ again at $X^{\prime} \neq X$ (Fig. 13). By $\angle B X X^{\prime}=\angle B X F=\angle X B F=\angle X B A$, arcs $B X^{\prime}$ and $A X$ of $\omega$ are equal, i.e. $B X^{\prime}=A X$. Since $A X=A M$, it follows that $B X^{\prime}=A M$. So $A B X^{\prime} M$ is an isosceles trapezoid which implies also $A X^{\prime}=B M$, i.e. arcs $A X^{\prime}$ and $B M$ of $\omega$ are equal. Therefore

$$
\angle A E F=180^{\circ}-\angle A X F=180^{\circ}-\angle A X X^{\prime}=180^{\circ}-\angle M A B=\angle M C B .
$$

By considering the second intersection point of $X E$ with $\omega$, we can analgously prove the equality $\angle E F A=\angle C B M$. Since arcs $M B$ and $M C$ of $\omega$ are equal, $\angle M C B=\angle C B M$, so $\angle A E F=\angle E F A$. Hence $A E=A F$, as desired.


solution:
Triangles $X F B, X E C$ and $X A M$ are isosceles (Fig. 144. In addition, note that $\measuredangle F B X=\measuredangle A B X=\measuredangle A M X$ and $\measuredangle F B X=\measuredangle A B X=\measuredangle A C X=\measuredangle E C X$, from which it follows that triangles $X F B, X E C$ and $X A M$ are directly similar (i.e., similar with the same orientation).
Denote $\frac{X F}{X B}=\frac{X E}{X C}=\frac{X A}{X M}=k$ and $\measuredangle B X F=\measuredangle C X E=\measuredangle M X A=\alpha$. Then the rotation with center $X$ by angle $\alpha$ along with scaling by ratio $k$ maps points $B, C, M$ to points $F, E, A$, respectively. Thus triangle $A F E$ is similar to triangle $M B C$ by spiral similarity. But $M B=M C$ as $M$ is the midpoint of arc $B C$. Hence also $A E=A F$.
Remark: The problem can be approached using complex numbers, taking $\omega$ as a unit circle.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-11.jpg?height=481&width=484&top_left_y=2078&top_left_x=295)

Figure 12
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-11.jpg?height=529&width=483&top_left_y=2031&top_left_x=838)

Figure 13
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-11.jpg?height=503&width=481&top_left_y=2053&top_left_x=1387)

Figure 14


problem: Let $A B C$ be an acute triangle with orthocentre $H$. Let $D$ be a point outside the circumcircle of triangle $A B C$ such that $\angle A B D=\angle D C A$. The reflection of $A B$ in $B D$ intersects $C D$ at $X$. The reflection of $A C$ in $C D$ intersects $B D$ at $Y$. The lines through $X$ and $Y$ perpendicular to $A C$ and $A B$, respectively, intersect at $P$. Prove that points $D, P$ and $H$ are collinear.

solution:
From the reflections, we have

$$
\angle D B X=180^{\circ}-\angle D B A=180^{\circ}-\angle D C A=\angle D C Y
$$

(Fig. 15), so points $B, C, X, Y$ are concyclic.
Define $Q=X P \cap B D$ and $R=Y P \cap C D$ (Fig. 16). Then due to the right angles, we find $\angle D Y R=\angle D X Q$. Hence points $Q, R, X, Y$ are concyclic, too.
Consequently, $\angle D Q R=\angle D X Y=\angle D B C$, so $B C \| Q R$. Since also $B H \| P Q$ and $C H \| P R$, it follows that triangle $B H C$ is a homothetic image of triangle $Q P R$ with center $D$. Hence $D, P$ and $H$ are collinear.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-12.jpg?height=752&width=672&top_left_y=886&top_left_x=338)

Figure 15
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-12.jpg?height=749&width=680&top_left_y=888&top_left_x=1142)

Figure 16


problem: Let $A B C$ be an acute triangle with circumcircle $\omega$. The altitudes $A D, B E$ and $C F$ of the triangle $A B C$ intersect at point $H$. A point $K$ is chosen on the line $E F$ such that $K H \| B C$. Prove that the reflection of $H$ in $K D$ lies on $\omega$.

solution:
Since $\angle A E H=90^{\circ}=\angle A F H$, we know that $A E H F$ is a cyclic quadrilateral and $A H$ is a diameter of its circumcircle. As $K H \| B C$ and $A H \perp B C$, we have $\angle K H A=90^{\circ}$, so $K H$ is tangent to the circumcircle of $A E H F$.

Denote by $H^{\prime}$ the reflection of $H$ in $K D$ and by $L$ the intersection of lines $K D$ and $H H^{\prime}$ (Fig. 17). Clearly $\angle H L D=90^{\circ}$ and from the equality $\angle K H D=180^{\circ}-\angle H L D$ it follows that $K H$ is also tangent to the circumcircle of $D L H$. From the power of the point $K$ with respect to the circumcircles of $A E H F$ and $D L H$ we obtain $K E \cdot K F=K H^{2}=K L \cdot K D$. Hence points $E, F, D, L$ lie on a common circle.

By a known fact of triangle geometry, reflections of $H$ in the points $D, E$ and $F$ lie on $\omega$. Hence the homothety with center $H$ and ratio 2 maps the circumcircle of triangle $D E F$ to $\omega$. As this homothety maps $L$ to $H^{\prime}$ and $L$ lies on the circumcircle of triangle $D E F$, the point $H^{\prime}$ must lie on $\omega$.

Remark: The problem can be approached using computational methods, namely complex numbers and Cartesian coordinates.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-13.jpg?height=641&width=703&top_left_y=168&top_left_x=731)

Figure 17


problem:
There is a set of $N \geq 3$ points in the plane, such that no three of them are collinear. Three points $A$, $B, C$ in the set are said to form a Baltic triangle if no other point in the set lies on the circumcircle of triangle $A B C$. Assume that there exists at least one Baltic triangle.
Show that there exist at least $\frac{N}{3}$ Baltic triangles.

solution:
If $N=3$, the number of Baltic triangles is 1 which is $\frac{N}{3}$.
To show that there always exist at least $\frac{N}{3}$ Baltic triangles, we prove that every point is a vertex of at least one Baltic triangle. This implies the desired result because every Baltic triangle consists of exactly 3 points.
First we prove a useful lemma: Given $n \geq 2$ points in the plane, either all are collinear or there exists a line passing through exactly 2 points.
Proof: Take a line $l$ going through at least 2 points, and a point $Q$ not on the line $l$ such that the distance from $Q$ to $l$ is minimal over all such pairs. Denote $Q^{\prime}$ as the projection of $Q$ to $l$. If $l$ contains at least 3 points, two of them must be on the same side of $Q^{\prime}$ (or coincide with $Q^{\prime}$ ). Say those points are $X$ and $Y$, with $X$ lying between $Y$ and $Q^{\prime}$ (Fig. 18). But then the distance from $X$ to the line $Q Y$ is smaller than $Q Q^{\prime}$ and this contradicts minimality.
![](https://cdn.mathpix.com/cropped/2024_11_22_358eef26f8d72df36f1eg-13.jpg?height=198&width=783&top_left_y=1866&top_left_x=688)

Figure 18
Now assume $N \geq 4$ and apply an inversion of the plane with center $O$ where $O$ is any point in the given set. Consider the $N-1$ other points after the inversion. By our lemma, there exists a line going through exactly 2 of them, because if they were all collinear, all points would have been concyclic before the inversion, contradicting the assumption about the existence of a Baltic triangle. Denote these points as $P$ and $Q$. The line $P Q$ cannot go through $O$, because this would mean that these 3 points were collinear before the inversion. But then before the inversion, no other point lied on the circumcircle of triangle $O P Q$, meaning that $O, P, Q$ formed a Baltic triangle.
So every single point in the given set is a vertex of at least one Baltic triangle and we are done.
Remark: The lemma proved in the solution is known as the Sylvester-Gallai theorem.


problem:
Determine all composite positive integers $n$ such that, for each positive divisor $d$ of $n$, there are integers $k \geq 0$ and $m \geq 2$ such that $d=k^{m}+1$.

Answer: 10.

solution:
Call a positive integer $n$ powerless if, for each positive divisor $d$ of $n$, there are integers $k \geq 0$ and $m \geq 2$ such that $d=k^{m}+1$. The solution is composed of proofs of three claims.
Claim 1: If $n$ is powerless, then each positive divisor $d$ of $n$ can be written as $k^{2}+1$ for some integer $k$.
Proof: We will prove this by strong induction on the divisors of $n$. First, we have that $1=0^{2}+1$. Now let $d=k^{m}+1>1$ be a divisor of $n$, and assume that all divisors less than $d$ can be written on the desired form. If $m$ is even, we are done, and if $m$ is odd, we have

$$
d=(k+1)\left(k^{m-1}-k^{m-2}+\cdots+1\right) .
$$

Then, either $k+1=d$, meaning that $k^{m}=k$ so $k=1$ and $d=1^{2}+1$, or $k+1$ is a divisor of $n$ stricly less than $d$, so we can write $k+1=l^{2}+1$ for some integer $l$. Hence $d=\left(l^{2}\right)^{m}+1=\left(l^{m}\right)^{2}+1$.
Claim 2: If $n$ is powerless, then $n$ is square-free.
Proof: Suppose for contradiction that there is a prime $p$ such that $p^{2} \mid n$. Then by Claim 1 we may write $p^{2}=l^{2}+1$. As the difference of square numbers are sums of consecutive odd integers, this leaves only the solution $l=0, p=1$, a contradiction.
Claim 3: The only composite powerless positive integer is 10.
We will give two proofs for this claim.
Proof 1: Suppose $n$ is a composite powerless number with prime divisors $p<q$. By Claim 1, we write $p=a^{2}+1, q=b^{2}+1$ and $p q=c^{2}+1$. Then we have $c^{2}<p q<q^{2}$, so $c<q$. However, as $b^{2}+1=q \mid c^{2}+1$, we have $c^{2} \equiv-1 \equiv b^{2}(\bmod q)$, so $c \equiv \pm b(\bmod q)$ and thus either $c=b$ or $c=q-b$. In the first case, we get $p=1$, a contradiction. In the second case, we get

$$
p q=c^{2}+1=(q-b)^{2}+1=q^{2}-2 b q+b^{2}+1=q^{2}-2 b q+q=(q-2 b+1) q
$$

so $p=q-2 b+1$ and thus $p$ is even. Therefore, $p=2$, and so $b^{2}+1=q=2 b+1$, which means $b=2$, and thus $q=5$. By Claim 2, this implies $n=10$, and since $1=0^{2}+1,2=1^{2}+1,5=2^{2}+1$ and $10=3^{2}+1$, this is indeed a powerless number.
Proof 2: Again, let $p \neq q$ be prime divisors of $n$ and write $p=a^{2}+1, q=b^{2}+1$ and $p q=c^{2}+1$. Factorizing in gaussian integers, this yields

$$
(a+\mathrm{i})(a-\mathrm{i})(b+\mathrm{i})(b-\mathrm{i})=(c+\mathrm{i})(c-\mathrm{i})
$$

We note that all the factors on the left, and none of the factors on the right, are gaussian primes. Thus, each factor on the right must be the product of two factors on the left. As $(a+i)(a-i)$ and $(b+i)(b-i)$ both are real, the unique factorization of $\mathbb{Z}[\mathrm{i}]$ leaves us without loss of generality with three cases:

$$
c+\mathrm{i}=(a+\mathrm{i})(b+\mathrm{i}), \quad c+\mathrm{i}=(a-\mathrm{i})(b-\mathrm{i}), \quad c+\mathrm{i}=(a+\mathrm{i})(b-\mathrm{i})
$$

In the first two cases, we have $a+b= \pm 1$, both contradictions. In the third case, we get $b-a=1$, and thus, $q=a^{2}+2 a+2$. As this makes $q-p$ odd, we get $p=2$ meaning $a=1$ so that $q=5$. Now we finish as in proof 1.
Remark: Claim 2 can also be proven independently of Claim 1 with the help of Mihailescu's theorem.

Do there exist infinitely many quadruples $(a, b, c, d)$ of positive integers such that the number $a^{a!}+$ $b^{b!}-c^{c!}-d^{d!}$ is prime and $2 \leq d \leq c \leq b \leq a \leq d^{2024} ?$
Answer: No.


solution:
Assume that there exists a prime $p<d$ such that $p \nmid a b c d$. Then, since $p-1 \mid d$ ! and $p \nmid d$, by Fermat's little theorem $d^{d!} \equiv\left(d^{p-1}\right)^{\frac{d!}{p-1}} \equiv 1(\bmod p)$. By the same argument $a^{a!} \equiv b^{b!} \equiv c^{c!} \equiv 1$ $(\bmod p)$, and therefore $a^{a!}+b^{b!}-c^{c!}-d^{d!} \equiv 1+1-1-1 \equiv 0(\bmod p)$.
Now we prove that for big enough $d$, the product $P$ of primes less than $d$ is at least $d^{10000}$. Assume $d>2^{\frac{10001 \cdot 10002}{2}}$. Notice that by Bertrand's postulate, the biggest prime less than $d$ is at least $\frac{d}{2}$, the second biggest is at least $\frac{d}{4}$ etc., and 10001-th biggest is at least $\frac{d}{2^{10001}}$. So

$$
P \geq \frac{d}{2} \frac{d}{4} \cdots \frac{d}{2^{10001}}=\frac{d^{10001}}{2^{\frac{10001 \cdot 10002}{2}}} \geq d^{10000}
$$

Now note that the number of quadruples where $d<2^{\frac{10001 \cdot 10002}{2}}$ is finite, because all the number are bounded above by $d^{2024}$ and hence by $2^{\frac{10001 \cdot 10002}{2}} \cdot 2024$. When $d \geq 2^{\frac{10001 \cdot 10002}{2}}$ we have $a b c d \leq$ $d^{1+3 \cdot 2024}<d^{7000}$ and since $P \geq d^{10000}$, there exist at least two primes $p$ and $q$, less than $d$, that do not divide $a b c d$. But then by our first result, we have $p q \mid a^{a!}+b^{b!}-c^{c!}-d^{d!}$, so it cannot be prime.
Remark: The solution can be modified as follows. We can proceed in the first paragraph to conclude that $a^{a!}+b^{b!}-c^{c!}-d^{d!}$ is not prime. Indeed, if $a^{a!}+b^{b!}-c^{c!}-d^{d!}=p$ where $p<d$ then definitely $a>d$ (otherwise $a=b=c=d$ and $a^{a!}+b^{b!}-c^{c!}-d^{d!}=0$ ). Hence

$$
\begin{aligned}
d & >p=a^{a!}+b^{b!}-c^{c!}-d^{d!} \geq a^{a!}-d^{d!}=\left(a^{(d+1) \cdot \ldots \cdot a}\right)^{d!}-d^{d!} \\
& \geq\left(a^{d+1}\right)^{d!}-d^{d!} \geq a^{d+1}-d>d^{d+1}-d>d^{2}-d=(d-1) d \geq d
\end{aligned}
$$

contradiction. Then in the last paragraph, there is no need to find two primes less than $d$ that do not divide $a b c d$, one is enough.


problem: An infinite sequence $a_{1}, a_{2}, \ldots$ of positive integers is such that $a_{n} \geq 2$ and $a_{n+2}$ divides $a_{n+1}+a_{n}$ for all $n \geq 1$. Prove that there exists a prime which divides infinitely many terms of the sequence.

solution:
Assume that every prime divides only finitely many terms of the sequence. In particular this means that there exists an integer $N>1$ such that $2 \nmid a_{n}$ for all $n \geq N$. Let $M=\max \left(a_{N}, a_{N+1}\right)$ We will now show by induction that $a_{n} \leq M$ for all $n \geq N$. This is obvious for $n=N$ and $n=N+1$. Now let $n \geq N+2$ be arbitrary and assume that $a_{n-1}, a_{n-2} \leq M$. By the definition of $N$, it is clear that $a_{n-2}, a_{n-1}, a_{n}$ are all odd and so $a_{n} \neq a_{n-1}+a_{n-2}$, but we know that $a_{n} \mid a_{n-1}+a_{n-2}$ and therefore

$$
a_{n} \leq \frac{a_{n-1}+a_{n-2}}{2} \leq \max \left(a_{n-1}, a_{n-2}\right) \leq M
$$

by the induction hypothesis. This completes the induction.
This shows that the sequence is bounded and therefore there are only finitely many primes which divide a term of the sequence. However there are infinitely many terms, that all have a prime divisor, hence some prime must divide infinitely many terms of the sequence.


problem:
Does there exist a positive integer $N$ which is divisible by at least 2024 distinct primes and whose positive divisors $1=d_{1}<d_{2}<\ldots<d_{k}=N$ are such that the number

$$
\frac{d_{2}}{d_{1}}+\frac{d_{3}}{d_{2}}+\ldots+\frac{d_{k}}{d_{k-1}}
$$

is an integer?

Answer: Yes.

solution:
For arbitrary positive integer $N$, we will write $f(N)=\frac{d_{2}}{d_{1}}+\frac{d_{3}}{d_{2}}+\ldots+\frac{d_{k}}{d_{k-1}}$ where $1=d_{1}<d_{2}<\ldots<d_{k}=N$ are all positive divisors of $N$. Let us prove by induction that for any positive integer $M$ there is a positive integer $N$ with exactly $M$ different prime divisors such that $f(N)$ is an integer.

- Base case: If $M=1$, this is clearly true (any prime power $N>1$ works).
- Induction step: Assume that the claim holds for $M$ prime divisors. Let $N$ be a positive integer with exactly $M$ prime divisors such that $f(N)$ is an integer. Pick a prime $p>N$. We claim that there is some choice of $\alpha$ such that $f\left(N \cdot p^{\alpha}\right)$ is an integer. Note that since $p>N$, the divisors of $N \cdot p^{\alpha}$ in the ascending order are

$$
\begin{aligned}
& d_{1}, d_{2}, \ldots, d_{k} \\
& p d_{1}, p d_{2}, \ldots, p d_{k} \\
& \ldots \ldots \ldots \ldots \ldots \ldots \ldots \\
& p^{\alpha} d_{1}, p^{\alpha} d_{2}, \ldots, p^{\alpha} d_{k}
\end{aligned}
$$

Hence we get that

$$
f\left(N \cdot p^{\alpha}\right)=(\alpha+1) f(N)+\alpha \cdot \frac{p d_{1}}{d_{k}}
$$

The term $(\alpha+1) f(N)$ is an integer by the choice of $N$. If we pick $\alpha=N$ then $\alpha \cdot \frac{p d_{1}}{d_{k}}=N \cdot \frac{p}{N}=p$ is an integer, too. Thus $f\left(N \cdot p^{\alpha}\right)$ is an integer and we are done.


problem:
Positive integers $a, b$ and $c$ satisfy the system of equations

$$
\left\{\begin{aligned}
(a b-1)^{2} & =c\left(a^{2}+b^{2}\right)+a b+1 \\
a^{2}+b^{2} & =c^{2}+a b
\end{aligned}\right.
$$

(a) Prove that $c+1$ is a perfect square.
(b) Find all such triples $(a, b, c)$.

Answer: (b) $a=b=c=3$.

solution:
(a) Rearranging terms in the first equation gives

$$
a^{2} b^{2}-2 a b=c\left(a^{2}+b^{2}\right)+a b
$$

By substituting $a b=a^{2}+b^{2}-c^{2}$ into the right-hand side and rearranging the terms we get

$$
a^{2} b^{2}+c^{2}=(c+1)\left(a^{2}+b^{2}\right)+2 a b
$$

By adding $2 a b c$ to both sides and factorizing we get

$$
(a b+c)^{2}=(c+1)(a+b)^{2}
$$

Now it is obvious that $c+1$ has to be a square of an integer.
(b) Let us say $c+1=d^{2}$, where $d>1$ and is an integer. Then substituting this into the equation (10) and taking the square root of both sides (we can do that as all the terms are positive) we get

$$
a b+d^{2}-1=d(a+b)
$$

We can rearrange it to $(a-d)(b-d)=1$, which immediately tells us that either $a=b=d+1$ or $a=b=d-1$. Note that in either case $a=b$. Substituting this into the second equation of the given system we get $a^{2}=c^{2}$, implying $a=c$ (as $\left.a, c>0\right)$.

- If $a=b=d-1$, then $a=c$ gives $d-1=d^{2}-1$, so $d=0$ or $d=1$, neither of which gives a positive $c$, so cannot be a solution.
- If $a=b=d+1$, then $a=c$ gives $d+1=d^{2}-1$, so $d^{2}-d-2=0$. The only positive solution is $d=2$ which gives $a=b=c=3$. Substituting it once again into both equations we indeed get a solution.

solution_match: # Solution 1:


solution:
(a) Substituting $a^{2}+b^{2}$ from the second equation to the first one gives

$$
(a b-1)^{2}=c\left(c^{2}+a b\right)+a b+1
$$

Rearranging terms in the obtained equation gives

$$
(a b)^{2}-(c+3) a b-c^{3}=0
$$

which we can consider as a quadratic equation in $a b$. Its discriminant is

$$
D=(c+3)^{2}+4 c^{3}=4 c^{3}+c^{2}+6 c+9=(c+1)\left(4 c^{2}-3 c+9\right)=(c+1)\left(4(c-1)^{2}+5(c+1)\right)
$$

To have solutions in integers, $D$ must be a perfect square. Note that $c+1$ and $4(c-1)^{2}+5(c+1)$ can have no common odd prime factors. Hence $\operatorname{gcd}\left(c+1,4(c-1)^{2}+5(c+1)\right)$ is a power of 2 , so $c+1$ and $4(c-1)^{2}+5(c+1)$ are either both perfect squares or both twice of some perfect squares. In the first case, we are done. In the second case, note that

$$
4(c-1)^{2}+5(c+1) \equiv 4(c-1)^{2}=(2(c-1))^{2} \quad(\bmod 5)
$$

so $4(c-1)^{2}+5(c+1)$ must be $0,1,4$ modulo 5 . On the other hand, twice of a perfect square is $0,2,3$ modulo 5 . Consequently, $c+1 \equiv 0(\bmod 5)$ and $4(c-1)^{2}+5(c+1) \equiv 0(\bmod 5)$, the latter of which implies $c-1 \equiv 0(\bmod 5)$. This leads to contradiction since $c-1$ and $c+1$ cannot be both divisible by 5 .
(b) By the solution of part (a), both $c+1$ and $4 c^{2}-3 c+9$ are perfect squares. However, due to $c>0$ we have $(2 c-1)^{2}=4 c^{2}-4 c+1<4 c^{2}-3 c+9$, and for $c>3$ we also have $(2 c)^{2}=4 c^{2}>4 c^{2}-3 c+9$. Thus $4 c^{2}-3 c+9$ is located between two consecutive perfect squares, which gives a contradiction with it being a square itself.
Out of $c=1,2,3$, only $c=3$ makes $c+1$ a perfect square. In this case, the quadratic equation $(a b)^{2}-(c+3) a b-c^{3}=0$ yields $a b=9$, so $a=1, b=9$ or $a=3, b=3$ or $a=9, b=1$. Out of those, only $a=3, b=3$ satisfies the equations.
Remark: Part (a) of the problem can be solved yet another way. By substituting $a^{2}+b^{2}$ from the second equation to the first one, we obtain

$$
(a b-1)^{2}=c\left(c^{2}+a b\right)+a b+1=c^{3}+1+a b c+a b=(c+1)\left(c^{2}-c+1+a b\right)
$$

Whenever an integer $n$ divides $c+1$, it also divides $a b-1$. Therefore $c \equiv-1(\bmod n)$ and $a b \equiv 1$ $(\bmod n)$. But then $c^{2}-c+1+a b \equiv 4(\bmod n)$, i.e., $n$ divides $c^{2}-c+1+a b-4$. Thus the greatest common divisor of $c+1$ and $c^{2}-c+1+a b$ divides 4 , i.e., it is either 1,2 or 4 . In the first and third case we are done. If their greatest common divisor is 2 , then clearly all three of $a, b, c$ are odd, so $a^{2} \equiv b^{2} \equiv c^{2} \equiv 1(\bmod 8)$. Thus from the second equation we have $a b=a^{2}+b^{2}-c^{2} \equiv 1$ $(\bmod 8)$, so $(a b-1)^{2}$ is divisible by 64 . Now, if $c \equiv 1(\bmod 4)$, then $c^{2}-c+1+a b \equiv 2(\bmod 4)$, which means that $(c+1)\left(c^{2}-c+1+a b\right) \equiv 4(\bmod 8)$, giving a contradiction with $(a b-1)^{2}$ being divisible by 64 . If instead $c \equiv 3(\bmod 4)$, then $c^{2}-c+1+a b \equiv 0(\bmod 4)$. This means that both $c+1$ and $c^{2}-c+1+a b$ are divisible by 4 , giving a contradiction with the assumption that their greatest common divisor is 2 . Therefore $c+1$ must be a perfect square.

solution_match: # Solution 2: