exam: APMO

problem:
Prove that for each real number $r>2$, there are exactly two or three positive real numbers $x$ satisfying the equation $x^{2}=r\lfloor x\rfloor$.
Note: $\lfloor x\rfloor$ denotes the largest integer less than or equal to $x$

solution:
Let $r>2$ be a real number. Let $x$ be a positive real number such that $x^{2}=r\lfloor x\rfloor$ with $\lfloor x\rfloor=k$. Since $x>0$ and $x^{2}=r k$, we also have $k>0$. From $k \leq x<k+1$, we get $k^{2} \leq x^{2}=r k<$ $k^{2}+2 k+1 \leq k^{2}+3 k$, hence $k \leq r<k+3$, or $r-3<k \leq r$. There are at most three positive integers in the interval $(r-3, r]$. Thus there are at most three possible values for $k$. Consequently, there are at most three positive solutions to the given equation.
Now suppose that $k$ is a positive integer in the interval $[r-2, r]$. There are at least two such positive integer. Observe that $k \leq \sqrt{r k} \leq \sqrt{(k+2) k}<k+1$ and so $r k=r\lfloor\sqrt{r k}\rfloor$. We conclude that the equation $x^{2}=r\lfloor x\rfloor$ has at least two positive solutions, namely $x=\sqrt{r k}$ with $k \in[r-2, r]$.

problem_match: Problem 1.

solution_match: Solution


problem:
For a polynomial $P$ and a positive integer $n$, define $P_{n}$ as the number of positive integer pairs $(a, b)$ such that $a<b \leq n$ and $|P(a)|-|P(b)|$ is divisible by $n$.
Determine all polynomial $P$ with integer coefficients such that for all positive integers $n, P_{n} \leq 2021$.

solution:
There are two possible families of solutions:

- $P(x)=x+d$, for some integer $d \geq-2022$.
- $P(x)=-x+d$, for some integer $d \leq 2022$.

Suppose $P$ satisfies the problem conditions. Clearly $P$ cannot be a constant polynomial. Notice that a polynomial $P$ satifies the conditions if and only if $-P$ also satisfies them. Hence, we may assume the leading coefficient of $P$ is positive. Then, there exists positive integer $M$ such that $P(x)>0$ for $x \geq M$.

Lemma 1. For any positive integer $n$, the integers $P(1), P(2), \ldots, P(n)$ leave pairwise distinct remainders upon division by $n$.

Proof. Assume for contradiction that this is not the case. Then, for some $1 \leq y<z \leq n$, there exists $0 \leq r \leq n-1$ such that $P(y) \equiv P(z) \equiv r(\bmod n)$. Since $P(a n+b) \equiv P(b)(\bmod n)$ for all $a, b$ integers, we have $P(a n+y) \equiv P(a n+z) \equiv r(\bmod n)$ for any integer $a$. Let $A$ be a positive integer such that $A n \geq M$, and let $k$ be a positive integer such that $k>2 A+2021$. Each of the $2(k-A)$ integers $P(A n+y), P(A n+z), P((A+1) n+y), P((A+1) n+z), \ldots, P((k-1) n+y), P((k-1) n+z)$ leaves one of the $k$ remainders

$$
r, n+r, 2 n+r, \ldots,(k-1) n+r
$$

upon division by $k n$. This implies that at least $2(k-A)-k=k-2 A$ (possibly overlapping) pairs leave the same remainder upon division by $k n$. Since $k-2 A>2021$ and all of the $2(k-A)$ integers are positive, we find more than 2021 pairs $a, b$ with $a<b \leq k n$ for which $|P(b)|-|P(a)|$ is divisible by $k n$-hence, $P_{k n}>2021$, a contradiction.

Next, we show that $P$ is linear. Assume that this is not the case, i.e., $\operatorname{deg} P \geq 2$. Then we can find a positive integer $k$ such that $P(k)-P(1) \geq k$. This means that among the integers $P(1), P(2), \ldots, P(P(k)-P(1))$, two of them, namely $P(k)$ and $P(1)$, leave the same remainder upon division by $P(k)-P(1)$ - contradicting the lemma (by taking $n=P(k)-P(1)$ ). Hence, $P$ must be linear.
We can now write $P(x)=c x+d$ with $c>0$. We prove that $c=1$ by two ways.

problem_match: Problem 2.


solution: If $c \geq 2$, then $P(1)$ and $P(2)$ leave the same remainder upon division by $c$, contradicting the Lemma. Hence $c=1$.

solution_match: Solution 1


solution:
Suppose $c \geq 2$. Let $n$ be a positive integer such that $n>2 c M, n\left(1-\frac{3}{2 c}\right)>2022$ and $2 c \mid n$. Notice that for any positive integers $i$ such that $\frac{3 n}{2 c}+i<n, P\left(\frac{3 n}{2 c}+i\right)-P\left(\frac{n}{2 c}+i\right)=n$. Hence, $\left(\frac{n}{2 c}+i, \frac{3 n}{2 c}+i\right)$ satifies the condition in the question for all positive integers $i$ such that $\frac{3 n}{2 c}+i<n$. Hence, $P_{n}>2021$, a contradiction. Then, $c=1$.

If $d \leq-2023$, then there are at least 2022 pairs $a<b$ such that $P(a)=P(b)$, namely $(a, b)=$ $(1,-2 d-1),(2,-2 d-2), \ldots,(-d-1,-d+1)$. This implies that $d \geq-2022$.
Finally, we verify that $P(x)=x+d$ satisfies the condition for any $d \geq-2022$. Fix a positive integer $n$. Note that $\| P(b)|-|P(a)||<n$ for all positive integers $a<b \leq n$, so the only pairs $a, b$ for which $|P(b)|-|P(a)|$ could be divisible by $n$ are those for which $|P(a)|=|P(b)|$. When $d \geq-2022$, there are indeed at most 2021 such pairs.

solution_match: Solution 2


problem: Let $A B C D$ be a cyclic convex quadrilateral and $\Gamma$ be its circumcircle. Let $E$ be the intersection of the diagonals $A C$ and $B D$, let $L$ be the center of the circle tangent to sides $A B, B C$, and $C D$, and let $M$ be the midpoint of the arc $B C$ of $\Gamma$ not containing $A$ and $D$. Prove that the excenter of triangle $B C E$ opposite $E$ lies on the line $L M$.

solution:
Let $L$ be the intersection of the bisectors of $\angle A B C$ and $\angle B C D$. Let $N$ be the $E$-excenter of $\triangle B C E$. Let $\angle B A C=\angle B D C=\alpha, \angle D B C=\beta$ and $\angle A C B=\gamma$.
We have the following:

$$
\begin{array}{r}
\angle C B L=\frac{1}{2} \angle A B C=90^{\circ}-\frac{1}{2} \alpha-\frac{1}{2} \gamma \text { and } \angle B C L=90^{\circ}-\frac{1}{2} \alpha-\frac{1}{2} \beta, \\
\angle C B N=90^{\circ}-\frac{1}{2} \beta \text { and } \angle B C N=90^{\circ}-\frac{1}{2} \gamma, \\
\angle M B L=\angle M B C+\angle C B L=90^{\circ}-\frac{1}{2} \gamma \text { and } \angle M C L=90^{\circ}-\frac{1}{2} \beta, \\
\angle L C N=\angle L B N=180^{\circ}-\frac{1}{2}(\alpha+\beta+\gamma) .
\end{array}
$$

Applying the sine rule to $\triangle M B L$ and $\triangle M C L$ we obtain

$$
\frac{M B}{M L}=\frac{M C}{M L}=\frac{\sin \angle B L M}{\sin \angle M B L}=\frac{\sin \angle C L M}{\sin \angle M C L}
$$

It follows that

$$
\frac{\sin \angle B L M}{\sin \angle C L M}=\frac{\sin \angle M B L}{\sin \angle M C L}=\frac{\cos (\gamma / 2)}{\cos (\beta / 2)}
$$

Now

$$
\frac{\sin \angle B L M}{\sin \angle M L C} \cdot \frac{\sin \angle L C N}{\sin \angle N C B} \cdot \frac{\sin \angle N B C}{\sin \angle N B L}=\frac{\cos (\gamma / 2)}{\cos (\beta / 2)} \cdot \frac{\sin \left(90^{\circ}-\frac{1}{2} \beta\right)}{\sin \left(90^{\circ}-\frac{1}{2} \gamma\right)}=1
$$

Hence $L M, B N, C N$ are concurrent and therefore $L, M, N$ are collinear.

## Alternative proof

We proceed similarly as above until the equation (1).
We use the following lemma.
Lemma: If $\pi>\alpha, \beta, \gamma, \delta>0, \alpha+\beta=\gamma+\delta<\pi$, and $\frac{\sin \alpha}{\sin \beta}=\frac{\sin \gamma}{\sin \delta}$, then $\alpha=\gamma$ and $\beta=\delta$.
Proof of Lemma: Let $\theta=\alpha+\beta=\gamma+\delta$. Then $\frac{\sin (\theta-\beta)}{\sin \beta}=\frac{\sin (\theta-\delta)}{\sin \delta}$.

$$
\begin{gathered}
\Longleftrightarrow \sin (\theta-\beta) \sin \delta=\sin (\theta-\delta) \sin \beta \\
\Longleftrightarrow(\sin \theta \cos \beta-\sin \beta \cos \theta) \sin \delta=(\sin \theta \cos \delta-\sin \delta \cos \theta) \sin \beta \\
\Longleftrightarrow \sin \theta \cos \beta \sin \delta=\sin \theta \cos \delta \sin \beta \\
\Longleftrightarrow \sin \theta \sin (\beta-\delta)=0
\end{gathered}
$$

Since $0<\theta<\pi$, then $\sin \theta \neq 0$. Therefore, $\sin (\beta-\delta)=0$, and we must have $\beta=\delta$.
Applying the sine rule to $\triangle N B L$ and $\triangle N C L$ we obtain

$$
\begin{aligned}
& \frac{N B}{N L}=\frac{\sin \angle B L N}{\sin \angle L B N} \\
& \frac{N C}{N L}=\frac{\sin \angle C L N}{\sin \angle L C N}
\end{aligned}
$$

Since $\angle L B N=\angle L C N$, it follows that

$$
\frac{\sin \angle B L N}{\sin \angle C L N}=\frac{N B}{N C}=\frac{\sin \angle B C N}{\sin \angle C B N}=\frac{\cos (\gamma / 2)}{\cos (\beta / 2)}=\frac{\sin \angle B L M}{\sin \angle C L M}
$$

By the lemma, it is concluded that $\angle B L M=\angle B L N$ and $\angle C L M=\angle C L N$. Therefore, $L, M, N$ are collinear.

problem_match: Problem 3.

solution_match: # Solution 1


solution:
Denote by $N$ the excenter of triangle $B C E$ opposite $E$. Since $B L$ bisects $\angle A B C$, we have $\angle C B L=$ $\frac{\angle A B C}{2}$. Since $M$ is the midpoint of arc $B C$, we have $\angle M B C=\frac{1}{2}(\angle M B C+\angle M C B)$ It follows by angle chasing that

$$
\begin{aligned}
\angle M B L & =\angle M B C+\angle C B L=\frac{1}{2}(\angle M B C+\angle M C B+\angle A B C) \\
& =\frac{1}{2}(\angle M B A+\angle M C B)=90^{\circ}-\frac{\angle B C E}{2}=\angle B C N .
\end{aligned}
$$

Denote by $X$ and $Y$ the second intersections of lines $B M$ and $C M$ with the circumcircle of $B C L$, respectively. Since $\angle M B C=\angle M C B$, we have $B C \| X Y$. It suffices to show that $B N \| X L$ and $C N \| Y L$. Indeed, from this it follows that $\triangle B C N \sim \triangle X Y L$, and therefore a homothety with center $M$ that maps $B$ to $X$ and $C$ to $Y$ also maps $N$ to $L$, implying that $N$ lies on the line $L M$.
By symmetry, it suffices to show that $C N \| Y L$, which is equivalent to showing that $\angle B C N=\angle X Y L$. But we have $\angle B C N=\angle M B L=\angle X B L=\angle X Y L$, completing the proof.

solution_match: # Solution 2


problem:
Given a $32 \times 32$ table, we put a mouse (facing up) at the bottom left cell and a piece of cheese at several other cells. The mouse then starts moving. It moves forward except that when it reaches a piece of cheese, it eats a part of it, turns right, and continues moving forward. We say that a subset of cells containing cheese is good if, during this process, the mouse tastes each piece of cheese exactly once and then falls off the table. Show that:
(a) No good subset consists of 888 cells.
(b) There exists a good subset consisting of at least 666 cells.

solution:
(a) For the sake of contradiction, assume a good subset consisting of 888 cells exists. We call those cheese-cells and the other ones gap-cells. Observe that since each cheese-cell is visited once, each gap-cell is visited at most twice (once vertically and once horizontally). Define a finite sequence $s$ whose $i$-th element is $C$ if the $i$-th step of the mouse was onto a cheese-cell, and $G$ if it was onto a gap-cell. By assumption, $s$ contains $888 C$ 's. Note that $s$ does not contain a contiguous block of 4 (or more) $C$ 's. Hence $s$ contains at least $888 / 3=296$ such $C$-blocks and thus at least $295 G^{\prime}$ 's. But since each gap-cell is traversed at most twice, this implies there are at least $\lceil 295 / 2\rceil=148$ gap-cells, for a total of $888+148=1036>32^{2}$ cells, a contradiction.
(b) Let $L_{i}, X_{i}$ be two $2^{i} \times 2^{i}$ tiles that allow the mouse to "turn left" and "cross", respectively. In detail, the "turn left" tiles allow the mouse to enter at its bottom left cell facing up and to leave at its bottom left cell facing left. The "cross" tiles allow the mouse to enter at its top right facing down and leave at its bottom left facing left, while also to enter at its bottom left facing up and leave at its top right facing right.
(a) Basic tiles
(b) Inductive construction
(c) $16 \times 16$
![](https://cdn.mathpix.com/cropped/2024_11_22_5e137eeb9eefa8d28dceg-4.jpg?height=373&width=1633&top_left_y=1078&top_left_x=249)

Note that given two $2^{i} \times 2^{i}$ tiles $L_{i}, X_{i}$ we can construct larger $2^{i+1} \times 2^{i+1}$ tiles $L_{i+1}, X_{i+1}$ inductively as shown on in (b). The construction works because the path intersects itself (or the other path) only inside the smaller $X$-tiles where it works by induction.
For a tile $T$, let $|T|$ be the number of pieces of cheese in it. By straightforward induction, $\left|L_{i}\right|=\left|X_{i}\right|+1$ and $\left|L_{i+1}\right|=4 \cdot\left|L_{i}\right|-1$. From the initial condition $\left|L_{1}\right|=3$. We now easily compute $\left|L_{2}\right|=11,\left|L_{3}\right|=43,\left|L_{4}\right|=171$, and $\left|L_{5}\right|=683$. Hence we get the desired subset.

## Another proof of (a).

Let $X_{N}$ be the largest possible density of cheese-cells in a good subset on an $N \times N$ table. We will show that $X_{N} \leq 4 / 5+o(1)$. Specifically, this gives $X_{32} \leq 817 / 1024$. We look at the (discrete analogue) of the winding number of the trajectory of the mouse. Since the mouse enters and leaves the table, for every 4 right turns in its trajectory there has to be a self-crossing. But each self-crossing requires a different empty square, hence $X_{N} \leq 4 / 5$.

problem_match: Problem 4.

solution_match: # Solution.


problem: Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that $f(f(a)-b)+b f(2 a)$ is a perfect square for all integers $a$ and $b$.

solution:
.

There are two families of functions which satisfy the condition:
(1) $f(n)= \begin{cases}0 & \text { if } n \text { is even, and } \\ \text { any perfect square } & \text { if } n \text { is odd }\end{cases}$
(2) $f(n)=n^{2}$, for every integer $n$.

It is straightforward to verify that the two families of functions are indeed solutions. Now, suppose that f is any function which satisfies the condition that $f(f(a)-b)+b f(2 a)$ is a perfect square for every pair $(a, b)$ of integers. We denote this condition by $\left(^{*}\right)$. We will show that $f$ must belong to either Family (1) or Family (2).
Claim 1. $f(0)=0$ and $f(n)$ is a perfect square for every integer $n$.
Proof. Plugging $(a, b) \rightarrow(0, f(0))$ in $\left(^{*}\right)$ shows that $f(0)(f(0)+1)=z^{2}$ for some integer $z$. Thus, $(2 f(0)+1-2 z)(2 f(0)+1+2 z)=1$. Therefore, $f(0)$ is either -1 or 0.
Suppose, for sake of contradiction, that $f(0)=-1$. For any integer $a$, plugging $(a, b) \rightarrow(a, f(a))$ implies that $f(a) f(2 a)-1$ is a square. Thus, for each $a \in \mathbb{Z}$, there exists $x \in \mathbb{Z}$ such that $f(a) f(2 a)=x^{2}+1$ This implies that any prime divisor of $f(a)$ is either 2 or is congruent to $1(\bmod 4)$, and that $4 \nmid f(a)$, for every $a \in \mathbb{Z}$.
Plugging $(a, b) \rightarrow(0,3)$ in $\left(^{*}\right)$ shows that $f(-4)-3$ is a square. Thus, there is $y \in \mathbb{Z}$ such that $f(-4)=y^{2}+3$. Since $4 \nmid f(-4)$, we note that $f(-4)$ is a positive integer congruent to $3(\bmod 4)$, but any prime dividing $f(-4)$ is either 2 or is congruent to $1(\bmod 4)$. This gives a contradiction. Therefore, $f(0)$ must be 0 .
For every integer $n$, plugging $(a, b) \rightarrow(0,-n)$ in $\left(^{*}\right)$ shows that $f(n)$ is a square.
Replacing $b$ with $f(a)-b$, we find that for all integers $a$ and $b$,

$$
f(b)+(f(a)-b) f(2 a) \text { is a square. }
$$

Now, let $S$ be the set of all integers $n$ such that $f(n)=0$. We have two cases:

- Case 1: $S$ is unbounded from above.

We claim that $f(2 n)=0$ for any integer $n$. Fix some integer $n$, and let $k \in S$ with $k>f(n)$. Then, plugging $(a, b) \mapsto(n, k)$ in $\left({ }^{* *}\right)$ gives us that $f(k)+(f(n)-k) f(2 n)=(f(n)-k) f(2 n)$ is a square. But $f(n)-k<0$ and $f(2 n)$ is a square by Claim 1. This is possible only if $f(2 n)=0$. In summary, $f(n)=0$ whenever $n$ is even and Claim 1 shows that $f(n)$ is a square whenever $n$ is odd.

- Case 2: $S$ is bounded from above.

Let $T$ be the set of all integers $n$ such that $f(n)=n^{2}$. We show that $T$ is unbounded from above. In fact, we show that $\frac{p+1}{2} \in T$ for all primes $p$ big enough.
Fix a prime number $p$ big enough, and let $n=\frac{p+1}{2}$. Plugging $(a, b) \mapsto(n, 2 n)$ in ( $\left.{ }^{* *}\right)$ shows us that $f(2 n)(f(n)-2 n+1)$ is a square for any integer $n$. For $p$ big enough, we have $2 n \notin S$, so $f(2 n)$ is a non-zero square. As a result, when $p$ is big enough, $f(n)$ and $f(n)-2 n+1=f(n)-p$ are both squares. Writing $f(n)=k^{2}$ and $f(n)-p=m^{2}$ for some $k, m \geq 0$, we have

$$
(k+m)(k-m)=k^{2}-m^{2}=p \Longrightarrow k+m=p, k-m=1 \Longrightarrow k=n, m=n-1
$$

Thus, $f(n)=k^{2}=n^{2}$, giving us $n=\frac{p+1}{2} \in T$.
Next, for all $k \in T$ and $n \in \mathbb{Z}$, plugging $(a, b) \mapsto(n, k)$ in $(* *)$ shows us that $k^{2}+(f(n)-k) f(2 n)$ is a square. But that means $(2 k-f(2 n))^{2}-\left(f(2 n)^{2}-4 f(n) f(2 n)\right)=4\left(k^{2}+(f(n)-k) f(2 n)\right)$ is also a square. When $k$ is large enough, we have $\left|f(2 n)^{2}-4 f(n) f(2 n)\right|+1<|2 k-f(2 n)|$. As a result, we must have $f(2 n)^{2}=4 f(n) f(2 n)$ and thus $f(2 n) \in\{0,4 f(n)\}$ for all integers $n$.
Finally, we prove that $f(n)=n^{2}$ for all integers $n$. Fix $n$, and take $k \in T$ big enough such that $2 k \notin S$. Then, we have $f(k)=k^{2}$ and $f(2 k)=4 f(k)=4 k^{2}$. Plugging $(a, b) \mapsto(k, n)$ to $(* *)$ shows us that $f(n)+\left(k^{2}-n\right) 4 k^{2}=\left(2 k^{2}-n\right)^{2}+\left(f(n)-n^{2}\right)$ is a square. Since $T$ is unbounded from above, we can take $k \in T$ such that $2 k \notin S$ and also $\left|2 k^{2}-n\right|>\left|f(n)-n^{2}\right|$. This forces $f(n)=n^{2}$, giving us the second family of solution.

## Another approach of Case 1.

Claim 2. One of the following is true.
(i) For every integer $n, f(2 n)=0$.
(ii) There exists an integer $K>0$ such that for every integer $n \geq K, f(n)>0$.

Proof. Suppose that there exists an integer $\alpha \neq 0$ such that $f(2 \alpha)>0$. We claim that for every integer $n \geq f(\alpha)+1$, we have $f(n)>0$.
For every $n \geq f(\alpha)+1$, plugging $(a, b) \rightarrow(\alpha, f(\alpha)-n)$ in $\left(^{*}\right)$ shows that $f(n)+(f(\alpha)-n) f(2 \alpha)$ is a square, and in particular, is non-negative. Hence, $f(n) \geq(n-f(\alpha)) f(2 \alpha)>0$, as desired.
If $f$ belongs to Case (i), Claim 1 shows that $f$ belongs to Family (1).
If $f$ belongs to Case (ii), then $S$ is bounded from above. From Case 2 we get $f(n)=n^{2}$.

problem_match: Problem 5.