exam: APMO

problem: Find all pairs $(a, b)$ of positive integers such that $a^{3}$ is a multiple of $b^{2}$ and $b-1$ is a multiple of $a-1$. Note: An integer $n$ is said to be a multiple of an integer $m$ if there is an integer $k$ such that $n=k m$.

solution:
.1

By inspection, we see that the pairs $(a, b)$ with $a=b$ are solutions, and so too are the pairs $(a, 1)$. We will see that these are the only solutions.

- Case 1. Consider the case $b<a$. Since $b-1$ is a multiple of $a-1$, it follows that $b=1$. This yields the second set of solutions described above.
- Case 2. This leaves the case $b \geq a$. Since the positive integer $a^{3}$ is a multiple of $b^{2}$, there is a positive integer $c$ such that $a^{3}=b^{2} c$.
Note that $a \equiv b \equiv 1$ modulo $a-1$. So we have

$$
1 \equiv a^{3}=b^{2} c \equiv c \quad(\bmod a-1) .
$$

If $c<a$, then we must have $c=1$, hence, $a^{3}=b^{2}$. So there is a positive integer $d$ such that $a=d^{2}$ and $b=d^{3}$. Now $a-1 \mid b-1$ yields $d^{2}-1 \mid d^{3}-1$. This implies that $d+1 \mid d(d+1)+1$, which is impossible.
If $c \geq a$, then $b^{2} c \geq b^{2} a \geq a^{3}=b^{2} c$. So there's equality throughout, implying $a=c=b$. This yields the first set of solutions described above.
Therefore, the solutions described above are the only solutions.

problem_match: Problem 1.

solution_match: # Solution 1


solution:
.2

We will start by showing that there are positive integers $x, c, d$ such that $a=x^{2} c d$ and $b=x^{3} c$. Let $g=\operatorname{gcd}(a, b)$ so that $a=g d$ and $b=g x$ for some coprime $d$ and $x$. Then, $b^{2} \mid a^{3}$ is equivalent to $g^{2} x^{2} \mid g^{3} d^{3}$, which is equivalent to $x^{2} \mid g d^{3}$. Since $x$ and $d$ are coprime, this implies $x^{2} \mid g$. Hence, $g=x^{2} c$ for some $c$, giving $a=x^{2} c d$ and $b=x^{3} c$ as required.
Now, it remains to find all positive integers $x, c, d$ satisfying

$$
x^{2} c d-1 \mid x^{3} c-1
$$

That is, $x^{3} c \equiv 1\left(\bmod x^{2} c d-1\right)$. Assuming that this congruence holds, it follows that $d \equiv x^{3} c d \equiv x$ $\left(\bmod x^{2} c d-1\right)$. Then, either $x=d$ or $x-d \geq x^{2} c d-1$ or $d-x \geq x^{2} c d-1$.

- If $x=d$ then $b=a$.
- If $x-d \geq x^{2} c d-1$, then $x-d \geq x^{2} c d-1 \geq x-1 \geq x-d$. Hence, each of these inequalities must in fact be an equality. This implies that $x=c=d=1$, which implies that $a=b=1$.
- If $d-x \geq x^{2} c d-1$, then $d-x \geq x^{2} c d-1 \geq d-1 \geq d-x$. Hence, each of these inequalities must in fact be an equality. This implies that $x=c=1$, which implies that $b=1$.
Hence the only solutions are the pairs $(a, b)$ such that $a=b$ or $b=1$. These pairs can be checked to satisfy the given conditions.


solution:
.3

All answers are $(n, n)$ and $(n, 1)$ where $n$ is any positive integer. They all clearly work.
To show that these are all solutions, note that we can easily eliminate the case $a=1$ or $b=1$. Thus, assume that $a, b \neq 1$ and $a \neq b$. By the second divisibility, we see that $a-1 \mid b-a$. However, $\operatorname{gcd}(a, b) \mid b-a$ and $a-1$ is relatively prime to $\operatorname{gcd}(a, b)$. This implies that $(a-1) \operatorname{gcd}(a, b) \mid b-a$, which implies $\operatorname{gcd}(a, b) \left\lvert\, \frac{b-1}{a-1}-1\right.$.
The last relation implies that $\operatorname{gcd}(a, b)<\frac{b-1}{a-1}$, since the right-hand side are positive. However, due to the first divisibility,

$$
\operatorname{gcd}(a, b)^{3}=\operatorname{gcd}\left(a^{3}, b^{3}\right) \geq \operatorname{gcd}\left(b^{2}, b^{3}\right)=b^{2} .
$$

Combining these two inequalities, we get that

$$
b^{\frac{2}{3}}<\frac{b-1}{a-1}<2 \frac{b}{a}
$$

This implies $a<2 b^{\frac{1}{3}}$. However, $b^{2} \mid a^{3}$ gives $b \leq a^{\frac{3}{2}}$. This forces

$$
a<2\left(a^{\frac{3}{2}}\right)^{\frac{1}{3}}=2 \sqrt{a} \Longrightarrow a<4 .
$$

Extracting $a=2,3$ by hand yields no additional solution.


problem:
Let $A B C$ be a right triangle with $\angle B=90^{\circ}$. Point $D$ lies on the line $C B$ such that $B$ is between $D$ and $C$. Let $E$ be the midpoint of $A D$ and let $F$ be the second intersection point of the circumcircle of $\triangle A C D$ and the circumcircle of $\triangle B D E$. Prove that as $D$ varies, the line $E F$ passes through a fixed point.
![](https://cdn.mathpix.com/cropped/2024_11_22_59f4362abe92b4f1e49cg-2.jpg?height=909&width=1292&top_left_y=1492&top_left_x=449)

solution:
.1

Let the line $E F$ intersect the line $B C$ at $P$ and the circumcircle of $\triangle A C D$ at $G$ distinct from $F$. We will prove that $P$ is the fixed point.
First, notice that $\triangle B E D$ is isosceles with $E B=E D$. This implies $\angle E B C=\angle E D P$.
Then, $\angle D A G=\angle D F G=\angle E B C=\angle E D P$ which implies $A G \| D C$. Hence, $A G C D$ is an isosceles trapezoid.
Also, $A G \| D C$ and $A E=E D$. This implies $\triangle A E G \cong \triangle D E P$ and $A G=D P$.
Since $B$ is the foot of the perpendicular from $A$ onto the side $C D$ of the isosceles trapezoid $A G C D$, we have $P B=P D+D B=A G+D B=B C$, which does not depend on the choice of $D$. Hence, the initial statement is proven.

problem_match: Problem 2.

solution_match: # Solution 2


solution:
.2

Set up a coordinate system where $B C$ is along the positive $x$-axis, $B A$ is along the positive $y$-axis, and $B$ is the origin. Take $A=(0, a), B=(0,0), C=(c, 0), D=(-d, 0)$ where $a, b, c, d>0$. Then $E=\left(-\frac{d}{2}, \frac{a}{2}\right)$. The general equation of a circle is

$$
x^{2}+y^{2}+2 f x+2 g y+h=0
$$

Substituting the coordinates of $A, D, C$ into (1) and solving for $f, g, h$, we find that the equation of the circumcircle of $\triangle A D C$ is

$$
x^{2}+y^{2}+(d-c) x+\left(\frac{c d}{a}-a\right) y-c d=0
$$

Similarly, the equation of the circumcircle of $\triangle B D E$ is

$$
x^{2}+y^{2}+d x+\left(\frac{d^{2}}{2 a}-\frac{a}{2}\right) y=0
$$

Then (3)-(2) gives the equation of the line $D F$ which is

$$
c x+\frac{a^{2}+d^{2}-2 c d}{2 a} y+c d=0
$$

Solving (3) and (4) simultaneously, we get

$$
F=\left(\frac{c\left(d^{2}-a^{2}-2 c d\right)}{a^{2}+(d-2 c)^{2}}, \frac{2 a c(c-d)}{a^{2}+(d-2 c)^{2}}\right)
$$

and the other solution $D=(-d, 0)$.
From this we obtain the equation of the line $E F$ which is $a x+(d-2 c) y+a c=0$. It passes through $P(-c, 0)$ which is independent of $d$.


problem:
Find all positive integers $k<202$ for which there exists a positive integer $n$ such that

$$
\left\{\frac{n}{202}\right\}+\left\{\frac{2 n}{202}\right\}+\cdots+\left\{\frac{k n}{202}\right\}=\frac{k}{2}
$$

where $\{x\}$ denote the fractional part of $x$.
Note: $\{x\}$ denotes the real number $k$ with $0 \leq k<1$ such that $x-k$ is an integer.

solution:
Denote the equation in the problem statement as $\left(^{*}\right)$, and note that it is equivalent to the condition that the average of the remainders when dividing $n, 2 n, \ldots, k n$ by 202 is 101 . Since $\left\{\frac{i n}{202}\right\}$ is invariant in each residue class modulo 202 for each $1 \leq i \leq k$, it suffices to consider $0 \leq n<202$.

If $n=0$, so is $\left\{\frac{i n}{202}\right\}$, meaning that $(*)$ does not hold for any $k$. If $n=101$, then it can be checked that $\left(^{*}\right)$ is satisfied if and only if $k=1$. From now on, we will assume that $101 \nmid n$.
For each $1 \leq i \leq k$, let $a_{i}=\left\lfloor\frac{i n}{202}\right\rfloor=\frac{i n}{202}-\left\{\frac{i n}{202}\right\}$. Rewriting $\left(^{*}\right)$ and multiplying the equation by 202, we find that

$$
n(1+2+\ldots+k)-202\left(a_{1}+a_{2}+\ldots+a_{k}\right)=101 k
$$

Equivalently, letting $z=a_{1}+a_{2}+\ldots+a_{k}$,

$$
n k(k+1)-404 z=202 k
$$

Since $n$ is not divisible by 101 , which is prime, it follows that $101 \mid k(k+1)$. In particular, $101 \mid k$ or $101 \mid k+1$. This means that $k \in\{100,101,201\}$. We claim that all these values of $k$ work.

- If $k=201$, we may choose $n=1$. The remainders when dividing $n, 2 n, \ldots, k n$ by 202 are 1,2 , ..., 201, which have an average of 101 .
- If $k=100$, we may choose $n=2$. The remainders when dividing $n, 2 n, \ldots, k n$ by 202 are 2,4 , ..., 200, which have an average of 101.
- If $k=101$, we may choose $n=51$. To see this, note that the first four remainders are $51,102,153$, 2 , which have an average of 77 . The next four remainders $(53,104,155,4)$ are shifted upwards from the first four remainders by 2 each, and so on, until the 25 th set of the remainders ( 99 , $150,201,50)$ which have an average of 125 . Hence, the first 100 remainders have an average of $\frac{77+125}{2}=101$. The 101th remainder is also 101 , meaning that the average of all 101 remainders is 101 .

In conclusion, all values $k \in\{1,100,101,201\}$ satisfy the initial condition.

problem_match: Problem 3.

solution_match: # Solution


problem:
Let $n$ and $k$ be positive integers. Cathy is playing the following game. There are $n$ marbles and $k$ boxes, with the marbles labelled 1 to $n$. Initially, all marbles are placed inside one box. Each turn, Cathy chooses a box and then moves the marbles with the smallest label, say $i$, to either any empty box or the box containing marble $i+1$. Cathy wins if at any point there is a box containing only marble $n$.
Determine all pairs of integers $(n, k)$ such that Cathy can win this game.

solution:
We claim Cathy can win if and only if $n \leq 2^{k-1}$.

First, note that each non-empty box always contains a consecutive sequence of labeled marbles. This is true since Cathy is always either removing from or placing in the lowest marble in a box. As a consequence, every move made is reversible.

Next, we prove by induction that Cathy can win if $n=2^{k-1}$. The base case of $n=k=1$ is trivial. Assume a victory can be obtained for $m$ boxes and $2^{m-1}$ marbles. Consider the case of $m+1$ boxes and $2^{m}$ marbles. Cathy can first perform a sequence of moves so that only marbles $2^{m-1}, \ldots, 2^{m}$ are left in the starting box, while keeping one box, say $B$, empty. Now move the marble $2^{m-1}$ to box $B$, then reverse all of the initial moves while treating $B$ as the starting box. At the end of that, we will have marbles $2^{m-1}+1, \ldots, 2^{m}$ in the starting box, marbles $1,2, \ldots, 2^{m-1}$ in box $B$, and $m-1$ empty boxes. By repeating the original sequence of moves on marbles $2^{m-1}+1, \ldots, 2^{m}$, using the $m$ boxes that are not box $B$, we can reach a state where only marble $2^{m}$ remains in the starting box. Therefore
a victory is possible if $n=2^{k-1}$ or smaller.

We now prove by induction that Cathy loses if $n=2^{k-1}+1$. The base case of $n=2$ and $k=1$ is trivial. Assume a victory is impossible for $m$ boxes and $2^{m-1}+1$ marbles. For the sake of contradiction, suppose that victory is possible for $m+1$ boxes and $2^{m}+1$ marbles. In a winning sequence of moves, consider the last time a marble $2^{m-1}+1$ leaves the starting box, call this move $X$. After $X$, there cannot be a time when marbles $1, \ldots, 2^{m-1}+1$ are all in the same box. Otherwise, by reversing these moves after $X$ and deleting marbles greater than $2^{m-1}+1$, it gives us a winning sequence of moves for $2^{m-1}+1$ marbles and $m$ boxes (as the original starting box is not used here), contradicting the inductive hypothesis. Hence starting from $X$, marbles 1 will never be in the same box as any marbles greater than or equal to $2^{m-1}+1$.

Now delete marbles $2, \ldots, 2^{m-1}$ and consider the winning moves starting from $X$. Marble 1 would only move from one empty box to another, while blocking other marbles from entering its box. Thus we effectively have a sequence of moves for $2^{m-1}+1$ marbles, while only able to use $m$ boxes. This again contradicts the inductive hypothesis. Therefore, a victory is not possible if $n=2^{k-1}+1$ or greater.

problem_match: Problem 4.


problem: Let $a, b, c, d$ be real numbers such that $a^{2}+b^{2}+c^{2}+d^{2}=1$. Determine the minimum value of $(a-b)(b-c)(c-d)(d-a)$ and determine all values of $(a, b, c, d)$ such that the minimum value is achieved.

solution:
The minimum value is $-\frac{1}{8}$. There are eight equality cases in total. The first one is

$$
\left(\frac{1}{4}+\frac{\sqrt{3}}{4},-\frac{1}{4}-\frac{\sqrt{3}}{4}, \frac{1}{4}-\frac{\sqrt{3}}{4},-\frac{1}{4}+\frac{\sqrt{3}}{4}\right) .
$$

Cyclic shifting all the entries give three more quadruples. Moreover, flipping the sign $((a, b, c, d) \rightarrow$ $(-a,-b,-c,-d))$ all four entries in each of the four quadruples give four more equality cases.

problem_match: Problem 5.


solution:
.1

Since the expression is cyclic, we could WLOG $a=\max \{a, b, c, d\}$. Let

$$
S(a, b, c, d)=(a-b)(b-c)(c-d)(d-a)
$$

Note that we have given $(a, b, c, d)$ such that $S(a, b, c, d)=-\frac{1}{8}$. Therefore, to prove that $S(a, b, c, d) \geq$ $-\frac{1}{8}$, we just need to consider the case where $S(a, b, c, d)<0$.

- Exactly 1 of $a-b, b-c, c-d, d-a$ is negative.

Since $a=\max \{a, b, c, d\}$, then we must have $d-a<0$. This forces $a>b>c>d$. Now, let us write

$$
S(a, b, c, d)=-(a-b)(b-c)(c-d)(a-d)
$$

Write $a-b=y, b-c=x, c-d=w$ for some positive reals $w, x, y>0$. Plugging to the original condition, we have

$$
(d+w+x+y)^{2}+(d+w+x)^{2}+(d+w)^{2}+d^{2}-1=0(*)
$$

and we want to prove that $w x y(w+x+y) \leq \frac{1}{8}$. Consider the expression $(*)$ as a quadratic in $d$ :

$$
4 d^{2}+d(6 w+4 x+2 y)+\left((w+x+y)^{2}+(w+x)^{2}+w^{2}-1\right)=0
$$

Since $d$ is a real number, then the discriminant of the given equation has to be non-negative, i.e. we must have

$$
\begin{aligned}
4 & \geq 4\left((w+x+y)^{2}+(w+x)^{2}+w^{2}\right)-(3 w+2 x+y)^{2} \\
& =\left(3 w^{2}+2 w y+3 y^{2}\right)+4 x(w+x+y) \\
& \geq 8 w y+4 x(w+x+y) \\
& =4(x(w+x+y)+2 w y)
\end{aligned}
$$

However, AM-GM gives us

$$
w x y(w+x+y) \leq \frac{1}{2}\left(\frac{x(w+x+y)+2 w y}{2}\right)^{2} \leq \frac{1}{8}
$$

This proves $S(a, b, c, d) \geq-\frac{1}{8}$ for any $a, b, c, d \in \mathbb{R}$ such that $a>b>c>d$. Equality holds if and only if $w=y, x(w+x+y)=2 w y$ and $w x y(w+x+y)=\frac{1}{8}$. Solving these equations gives us $w^{4}=\frac{1}{16}$ which forces $w=\frac{1}{2}$ since $w>0$. Solving for $x$ gives us $x(x+1)=\frac{1}{2}$, and we will get $x=-\frac{1}{2}+\frac{\sqrt{3}}{2}$ as $x>0$. Plugging back gives us $d=-\frac{1}{4}-\frac{\sqrt{3}}{4}$, and this gives us

$$
(a, b, c, d)=\left(\frac{1}{4}+\frac{\sqrt{3}}{4},-\frac{1}{4}+\frac{\sqrt{3}}{4}, \frac{1}{4}-\frac{\sqrt{3}}{4},-\frac{1}{4}-\frac{\sqrt{3}}{4}\right)
$$

Thus, any cyclic permutation of the above solution will achieve the minimum equality.

- Exactly 3 of $a-b, b-c, c-d, d-a$ are negative Since $a=\max \{a, b, c, d\}$, then $a-b$ has to be positive. So we must have $b<c<d<a$. Now, note that

$$
\begin{aligned}
S(a, b, c, d) & =(a-b)(b-c)(c-d)(d-a) \\
& =(a-d)(d-c)(c-b)(b-a) \\
& =S(a, d, c, b)
\end{aligned}
$$

Now, note that $a>d>c>b$. By the previous case, $S(a, d, c, b) \geq-\frac{1}{8}$, which implies that

$$
S(a, b, c, d)=S(a, d, c, b) \geq-\frac{1}{8}
$$

as well. Equality holds if and only if

$$
(a, b, c, d)=\left(\frac{1}{4}+\frac{\sqrt{3}}{4},-\frac{1}{4}-\frac{\sqrt{3}}{4}, \frac{1}{4}-\frac{\sqrt{3}}{4},-\frac{1}{4}+\frac{\sqrt{3}}{4}\right)
$$

and its cyclic permutation.

solution_match: # Solution 5


solution:
.2

The minimum value is $-\frac{1}{8}$. There are eight equality cases in total. The first one is

$$
\left(\frac{1}{4}+\frac{\sqrt{3}}{4},-\frac{1}{4}-\frac{\sqrt{3}}{4}, \frac{1}{4}-\frac{\sqrt{3}}{4},-\frac{1}{4}+\frac{\sqrt{3}}{4}\right) .
$$

Cyclic shifting all the entries give three more quadruples. Moreover, flipping the sign $((a, b, c, d) \rightarrow$ $(-a,-b,-c,-d)$ ) all four entries in each of the four quadruples give four more equality cases. We then begin the proof by the following optimization:

Claim 1. In order to get the minimum value, we must have $a+b+c+d=0$.

Proof. Assume not, let $\delta=\frac{a+b+c+d}{4}$ and note that

$$
(a-\delta)^{2}+(b-\delta)^{2}+(c-\delta)^{2}+(d-\delta)^{2}<a^{2}+b^{2}+c^{2}+d^{2}
$$

so by shifting by $\delta$ and scaling, we get an even smaller value of $(a-b)(b-c)(c-d)(d-a)$.

The key idea is to substitute the variables

$$
\begin{aligned}
& x=a c+b d \\
& y=a b+c d \\
& z=a d+b c
\end{aligned}
$$

so that the original expression is just $(x-y)(x-z)$. We also have the conditions $x, y, z \geq-0.5$ because of:

$$
2 x+\left(a^{2}+b^{2}+c^{2}+d^{2}\right)=(a+c)^{2}+(b+d)^{2} \geq 0
$$

Moreover, notice that

$$
0=(a+b+c+d)^{2}=a^{2}+b^{2}+c^{2}+d^{2}+2(x+y+z) \Longrightarrow x+y+z=\frac{-1}{2}
$$

Now, we reduce to the following optimization problem.
Claim 2. Let $x, y, z \geq-0.5$ such that $x+y+z=-0.5$. Then, the minimum value of

$$
(x-y)(x-z)
$$

is $-1 / 8$. Moreover, the equality case occurs when $x=-1 / 4$ and $\{y, z\}=\{1 / 4,-1 / 2\}$.
Proof. We notice that

$$
\begin{aligned}
(x-y)(x-z)+\frac{1}{8} & =\left(2 y+z+\frac{1}{2}\right)\left(2 z+y+\frac{1}{2}\right)+\frac{1}{8} \\
& =\frac{1}{8}(4 y+4 z+1)^{2}+\left(y+\frac{1}{2}\right)\left(z+\frac{1}{2}\right) \geq 0
\end{aligned}
$$

The last inequality is true since both $y+\frac{1}{2}$ and $z+\frac{1}{2}$ are not less than zero.
The equality in the last inequality is attained when either $y+\frac{1}{2}=0$ or $z+\frac{1}{2}=0$, and $4 y+4 z+1=0$. This system of equations give $(y, z)=(1 / 4,-1 / 2)$ or $(y, z)=(-1 / 2,1 / 4)$ as the desired equality cases.

Note: We can also prove (the weakened) Claim 2 by using Lagrange Multiplier, as follows. We first prove that, in fact, $x, y, z \in[-0.5,0.5]$. This can be proved by considering that

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

We will prove the Claim 2, only that in this case, $x, y, z \in[-0.5,0.5]$. This is already sufficient to prove the original question. We already have the bounded domain $[-0.5,0.5]^{3}$, so the global minimum must occur somewhere. Thus, it suffices to consider two cases:

- If the global minimum lies on the boundary of $[-0.5,0.5]^{3}$. Then, one of $x, y, z$ must be -0.5 or 0.5 . By symmetry between $y$ and $z$, we split to a few more cases.
- If $x=0.5$, then $y=z=-0.5$, so $(x-y)(x-z)=1$, not the minimum.
- If $x=-0.5$, then both $y$ and $z$ must be greater or equal to $x$, so $(x-y)(x-z) \geq 0$, not the minimum.
- If $y=0.5$, then $x=z=-0.5$, so $(x-y)(x-z)=0$, not the minimum.
- If $y=-0.5$, then $z=-x$, so

$$
(x-y)(x-z)=2 x(x+0.5)
$$

which obtain the minimum at $x=-1 / 4$. This gives the desired equality case.

- If the global minimum lies in the interior $(-0.5,0.5)^{3}$, then we apply Lagrange multiplier:

$$
\begin{aligned}
& \frac{\partial}{\partial x}(x-y)(x-z)=\lambda \frac{\partial}{\partial x}(x+y+z) \\
& \frac{\partial}{\partial y}(x-y)(x-z)=\lambda \frac{\partial}{\partial y}(x+y+z) \\
& \frac{\partial}{\partial z}(x-y)(x-z) \Longrightarrow z-x=\lambda \frac{\partial}{\partial z}(x+y+z) \\
& \Longrightarrow y-x=\lambda .
\end{aligned}
$$

Adding the last two equations gives $\lambda=0$, or $x=y=z$. This gives $(x-y)(x-z)=0$, not the minimum.

Having exhausted all cases, we are done.