exam: EGMO

problem:
Problem. Two different integers $u$ and $v$ are written on a board. We perform a sequence of steps. At each step we do one of the following two operations:
(i) If $a$ and $b$ are different integers on the board, then we can write $a+b$ on the board, if it is not already there.
(ii) If $a, b$ and $c$ are three different integers on the board, and if an integer $x$ satisfies $a x^{2}+b x+c=0$, then we can write $x$ on the board, if it is not already there.

Determine all pairs of starting numbers $(u, v)$ from which any integer can eventually be written on the board after a finite sequence of steps.

solution:
We will show that the answer are the integer pairs $(u, v)$ such that $u \neq 0$, $v \neq 0,\{u, v\} \neq\{-1,1\}$ and $u>0$ or $v>0$.

If $u=0$ or $v=0$, then (i) will never yield a new number and we cannot use (ii) with only two numbers. Hence, if $u=0$ or $v=0$, we cannot reach every possible $y$. From now on, assume $u \neq 0$ and $v \neq 0$.

If both numbers $u, v$ were negative, we will show that there can only be negative numbers on the board. With negative numbers $a, b$, operation (i) will only yield a negative number. The same holds for operation (ii), because for a non-negative $x$ and negative $a, b, c$, we have $a x^{2}+b x+c<0$. Hence, if both $u<0$ and $v<0$, then we cannot reach every possible $y$. From now on, assume that at least one of $u, v$ is positive. Without loss of generality take $u<v$, and so $v>0$.

After one step, we can have the numbers $u, v, u+v$, which are mutually distinct due to $u, v$ being nonzero. Notice that the equation $u x^{2}+(u+v) x+v=0$ has a root -1 , and so we can have -1 on the board.

We now check two cases: case $v=1$, and case $v>1$.
If $v=1$, then $u<0$. Further split the case of $v=1$ based on whether $u=-1$ or $u<-1$.

If $v=1$ and $u=-1$, we can only additionally write number 0 on the board using operation (i); and no additional numbers using (ii) because setting $\{a, b, c\}$ to $\{-1,0,1\}$ in any order only has solutions for $x$ in $\{-1,0,1\}$. Hence, if $\{u, v\}=\{-1,1\}$, then we cannot reach every possible $y$.

If $v=1$ and $u<-1$, we can use operation (i) on numbers $u,-1$ (and then repeat choosing the obtained result and -1 ) to get any negative number smaller than $u$, and operation (i) on numbers $(u, 1)$ (and then repeat choosing the obtained result and 1 ) to get any negative number larger than $u$, as well as 0 . Then, we set $(a, b, c)=(0,1,-2)$ and apply operation (ii) to additionally get number 2. Applying (i) on $(2,1)$ (and then repeat choosing the obtained result and 1), we can get all the remaining integers too.

From now on, assume $v>1$. Recall that we can make $u+v$ and -1 .
We will now apply operation (i). First, $(v,-1)$ gives $v-1$. Next, $(v, v-1)$ gives $2 v-1$. Since $v>1$, we know $v \neq 2 v-1$, so we can apply operation (i) on $(v, 2 v-1)$ to get $3 v-1$, and then continue adding $(v, k v-1)$ to get $(k+1) v-1$ for any positive $k$. Since $v>1$, we can get an arbitrarily large integer by repeating this.

If $a$ is any positive number on the board, applying (i) to $(a,-1)$ gives $a-1$. By repeating this, we have that we can get all numbers smaller than $a$ and larger than or equal to -1 . Together with previously having found a way to get an arbitrarily large integer, we have that we can get any integer $l \geq-1$ on the board.

Now, we set $(a, b, c)=(0,1,2)$ and apply operation (ii) to additionally get number -2 . Then we can repeat operation (i) on ( $-1,-2$ ) (and afterwards on -1 and the obtained result) to get any negative number.

Therefore, if $u \neq 0, v \neq 0,\{u, v\} \neq\{-1,1\}$ and $u>0$ or $v>0$, we can write every integer on the board.

Remark. There are of course many other ways to create all integers in case of $(u, v)$ that satisfies all the requirements. Basically you will always use (i) to create arbitrarily large numbers and then (ii) to create a number in a range that you didn't have before.

problem_match: # Problem 1 (SVK)

solution_match: Solution 1.


solution:
If $u=0$ or $v=0$ then we can only get $\{u, v\}$.

Proof. If $u=0$ or $v=0$, then (i) will never yield a new number and we cannot use (ii) with only two numbers.

If $\max (u, v)<0$, we cannot get non-negative numbers.

Proof. For $a, b, c<0$ :
(i) cannot generate a non-negative number as $a+b<0$.
(ii) cannot generate a non-negative number as for $x \geq 0$ : $a x^{2}+b x+c \leq c<0$.

If $u+v \neq 0, u, v \neq 0$ and $\max (u, v)>0$, we can get every number.

Proof. $u \neq v \rightarrow u+v$ can be written. $u \neq 0$, so $u+v \neq v \rightarrow u+2 v$ can be written. $v \neq 0$, so $u+2 v \neq u$, meaning that $2 u+2 v$ can be written. If for $n>1, n(u+v)$ can be written then $(n+1)(u+v)=n(u+v)+(u+v)$ can also be written, because $u+v \neq 0$, so $n(u+v) \neq(u+v)$. Therefore, by induction for all $n>0$ the number $n(u+v)$ can be written.

Taking $n=2,3, \ldots$ and $(u+v)(x+1)(x+n)=(u+v) x^{2}+(u+v)(n+1) x+(u+v) n=0$ gives $x=-1$ and $x=-n \rightarrow$ for all $n>0$ we can get $-n$ (we can get all the negative numbers). Additionally, we can get $u+(-u)=0$.

For $n \geq 1$ we can take $0 \cdot x^{2}+u x+(-u n)=0$ as $u \neq 0 \rightarrow u,-n u, 0$ are all distinct, therefore we can get $n$. Thus, we can get all the numbers.

If $u+v=0$ and $\max (u, v)>1$ we can get all the numbers.

Proof. We can get $0=u+v$ as $u \neq v$. Take $0 \cdot x^{2}+u x-u=0$ so we can get 1 written on the board. Take $\left(u^{\prime}, v^{\prime}\right)=(1, \max (u, v))$ and then use the result from claim 3. As $0<u^{\prime}=1<\max (u, v)=v^{\prime}$ and $u^{\prime}+v^{\prime}>0$ we can get all the numbers.

Remaining case: If $v=1$ and $u=-1$, we can only additionally write number 0 on the board using operation (i); and no additional numbers using (ii) because setting $\{a, b, c\}$ to $\{-1,0,1\}$ in any order only has solutions for $x$ in $\{-1,0,1\}$. Hence, if $\{u, v\}=\{-1,1\}$, then we cannot reach every possible $y$.

solution_match: Solution 2.


solution:
We show none of the initial number can be 0 , as in Solution 1. Then, we split into three cases: initial numbers having different signs, both being positive, and both being negative.

Case 1. Suppose we have two numbers $u, v$ with different signs such that $\operatorname{gcd}(u, v)=k$ for some $k \in \mathbb{Z}^{+}$. Without loss of generality assume that $u>0$ and $v<0$.

Case 1.1. $v<-k$ :
We can generate all numbers $y$ such that $k \mid y$ and $y \leq u$.

Proof. Define $u^{\prime}=\frac{u}{k}, v^{\prime}=\frac{v}{k}$. Note that by definition, $\operatorname{gcd}\left(u^{\prime}, v^{\prime}\right)=1$. If starting with numbers $u^{\prime}, v^{\prime}$, we can make a sequence of applications of only the (i) rule to write a number $y=p \cdot u^{\prime}+q \cdot v^{\prime}$ on the board, then we can apply the same sequence of moves to $u, v$ to write $k \cdot y=p \cdot u+q \cdot v$ on the board.

Therefore, we will prove instead that if $v^{\prime}<-1$, we can write all numbers $y<u^{\prime}$ on the board, which is equivalent to the lemma.

We attempt to write numbers $u^{\prime}+q \cdot v^{\prime}$ for $q \in \mathbb{Z}^{+}$on the board by repeatedly adding $v^{\prime}$ to $u^{\prime}$. This process can only ever halt if we reach a point where $u^{\prime}+q \cdot v^{\prime}=v^{\prime}$. That cannot occur, as it would imply $u^{\prime}=(1-q) \cdot v^{\prime}$. Taking into account that $u^{\prime}, v^{\prime} \neq 0$, that implies $\operatorname{gcd}\left(u^{\prime}, v^{\prime}\right)=\left|v^{\prime}\right|$. That is a contradiction, as $\left|v^{\prime}\right|>1$.

Therefore, we can write all numbers of the form $u^{\prime}+q \cdot v^{\prime}$ on the board for $q \in \mathbb{Z}^{+}$. We will use these numbers to construct an arbitrary integer $y$.

If we want to write a number $y<u^{\prime}$ on the board, and we already have a number $n<y$ on the board such that $y \equiv n\left(\bmod u^{\prime}\right)$, then we can construct $y$ by repeatedly adding $u^{\prime}$ to $n$ until we reach $y$, skipping all numbers that are already on the board. As $y<u^{\prime}$, none of the numbers we attempt to add $u^{\prime}$ to will be equal to $u^{\prime}$.

Suppose we fix any number $y<u^{\prime}$. As $\operatorname{gcd}\left(u^{\prime}, v^{\prime}\right)=1, q \cdot v^{\prime}$ takes all residues modulo $u^{\prime}$ as $q$ runs through the positive integers. Therefore, we will always be able to find a number $n$ of the form $u^{\prime}+q \cdot v^{\prime}$ such that $y \equiv n \bmod u^{\prime}$. We can generate an arbitrarily small $n^{\prime}$ by taking $n^{\prime}=n+l \cdot u^{\prime} \cdot v^{\prime}=u^{\prime}+\left(q+l \cdot u^{\prime}\right) \cdot v^{\prime}$ for large enough $l$, making both $n^{\prime}<y$ and $n^{\prime} \equiv y \bmod u^{\prime}$ true.

Therefore, we can write all numbers $y<u^{\prime}$ on the board. Thus, starting from $u$ and $v$, we can get all numbers $y \leq u$ s.t. $k \mid y$.

The numbers $k, 0$ and all negative multiples of $k$ are a subset of the integers $y \leq u$ s.t. $k \mid y$. Therefore, we have all of those numbers on the board.

We can now get an arbitrary nonzero number by applying (ii) to the polynomial $k \cdot(x-$ $n)(x+n)=k \cdot x^{2}+0 \cdot x-n^{2} \cdot k$. The coefficients of this polynomial are distinct for all integers $n \neq 0$, and they are from the set $\{k, 0\} \cup\{q \cdot k \mid q<0\}$, which we have on the board. Therefore the rule application is valid.

As this works for all integers $n \in \mathbb{Z} \backslash\{0\}$, and 0 is already on the board, we have proven that we can write all integers on the board.

Case 1.2.: $v=-k$ :
Case 1.2.1.: $k \neq 1$.
If $k \neq 1$, we can generate -1 from the polynomial $u \cdot x^{2}+(u+v) x+v$. We can now repeatedly add -1 to $v=-k$ until we reach $-2 k$ on the board. Now, we can appeal to Case 1.1.

Case 1.2.2. $k=1$.
To restate the conditions of this sub-case, $v=-k=-1$, and $u$ is an arbitrary positive number.

Case 1.2.2.1. $u=1$.
If $u=1$, we are only ever able to construct the numbers $-1,0,1$, no matter how we apply the rules.

Case 1.2.2.2. $u \neq 1$.
We can subtract 1 from $u$ until we reach 0 . This procedure also generates 1 . We now add 1 to $u$ until we get all positive numbers.

Now, we find an arbitrary polynomial with different positive coefficients that have a negative root smaller than -1 . An example is $(x+3)^{2}$.

We will now keep adding -1 to -3 to get all the negative numbers $y \leq-3$. To get -2 , we can add -3 to 1 , generating all integers.

Case 2 Suppose that both of $u, v$ are positive.
We can now use any method from the previous solutions to generate a negative number, and then appeal to Case 1.

Case 3 Suppose $u<0, v<0$.
Then there can only be negative numbers on the board. With negative numbers $a, b$, operation (i) will only yield a negative number. The same holds for operation (ii), because for a non-negative $x$ and negative $a, b, c$, we have $a x^{2}+b x+c<0$. Hence, if both $u<0$ and $v<0$, then we cannot reach every possible $y$.

solution_match: Solution 3.


problem: Problem. Let $A B C$ be a triangle with $A C>A B$, and denote its circumcircle by $\Omega$ and incentre by $I$. Let its incircle meet sides $B C, C A, A B$ at $D, E, F$ respectively. Let $X$ and $Y$ be two points on minor arcs $\overparen{D F}$ and $\overparen{D E}$ of the incircle, respectively, such that $\angle B X D=\angle D Y C$. Let line $X Y$ meet line $B C$ at $K$. Let $T$ be the point on $\Omega$ such that $K T$ is tangent to $\Omega$ and $T$ is on the same side of line $B C$ as $A$. Prove that lines $T D$ and $A I$ meet on $\Omega$.

solution:
By the alternate segment theorem we have that:

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

Therefore opposite angle of $B X Y C$ are supplementary and so $C Y X B$ cyclic.
One can apply power of a point at $K$ :

$$
K T^{2}=K B \cdot K C=K X \cdot K Y=K D^{2} \Longrightarrow K T=K D .
$$

![](https://cdn.mathpix.com/cropped/2024_11_22_13e9df587c690fb1bee9g-07.jpg?height=927&width=1412&top_left_y=279&top_left_x=305)

Figure 1: The proposer's solution using a new point $Q$
(Alternatively you can sidestep power of a point by observing that $K$ is the radical centre of the incircle $D E F$, the circumcircle $\Gamma$ and the circle $C Y X B$ and so $K T^{2}=K D^{2}$.)

Now let $A I$ meet $\Omega$ at $M$, the midpoint of $\widehat{B C}$ not containing $A$. Let the tangent at $M$ meet $K T$ at $Q$. Observe that $Q M \| K D$ so $\angle T K D=\angle T Q M$ and also $K T=K D$, $Q T=Q M$ hence $\triangle T K D \sim \triangle T Q M$. As $T, K, Q$ are collinear, this means that $T, D, M$ are collinear so $T D$ and $A I$ meet at $M$ which lies on $\Omega$.

problem_match: # Problem 2 (UNK)


solution:
The role of $X$ and $Y$ in this problem is secondary. Draw any circle through $B$ and $C$ which meets the incircle at $X$ and $Y$ and you determine the same point $K$. This is because $K$ is the radical centre of the three circles in play. Therefore $K$ is the intersection of $B C$ with the radical axis of the circumcircle $\Omega$ and the incircle $D E F$, and so is independent of the choice of circle through $B$ and $C$ which gives rise to $X$ and $Y$. In the problem as posed, this is disguised, with angle properties of $X$ and $Y$ giving rise the the circle $B X Y C$.

You can now work with the simplified diagram shown in Figure 2.

Somehow we must use a characterization of $M$ in order to finish. In the proposer's solution, we used the tangent to the circumcircle $\Omega$ at $M$ being parallel to $B C$. In this alternative, we use the fact that the internal angle bisector of angle $\angle C T B$ meets $\Omega$ again at $M$.

Triangle $T K D$ is isosceles with apex $K$ so

$$
\angle K D T=\angle D T K=\angle D T B+\angle B T K .
$$

![](https://cdn.mathpix.com/cropped/2024_11_22_13e9df587c690fb1bee9g-08.jpg?height=915&width=1329&top_left_y=436&top_left_x=386)

Figure 2: Illustration of an angle chase

By the alternate segment theorem, $\angle B T K=\angle B C T=\angle D C T$. Now angle $\angle K D T$ is an exterior angle of triangle $D C T$ so $\angle C T D=\angle D T B$.

Therefore the line $T D$ is the internal angle bisector of angle $\angle C T B$ and so must pass through $M$, the midpoint of the arc $\widehat{B C}$ of $\Omega$ which does not contain $T$.

Observation This affords a construction of the radical axis of the incircle and circumcircle of triangle $A B C: M$ and $D$ determine $T$ and the tangent at $T$ meets $B C$ at a point on the required radical axis. See Figure 3. Now do a cyclic change of letters of $A B C$ and find a point on $C A$ which is also on the radical axis (the dashed magenta line).


solution:
The centre of direct enlargement from the incircle to the circumcircle gives another way to finish the proof. This enlargement carries $D$ to $M$ since the tangent lines to their associated circles are parallel. The centre of enlargement therefore lies on the line $M D$. Let $M D$ meet the incircle again at $U$ and the circumcircle again at $V$. Draw the tangent to the incircle at $U$ to meet $B C$ at $W$ so triangle $W D U$ is isosceles with apex $W$ and has equal base angles $\angle W D U$ and $\angle D U W$. The enlargement carries the line $W U$ to the tangent line to the circumcircle at $V$ which meets $B C$ at $S$. Enlargements carry lines to parallel lines, so $\angle D V K^{\prime}=\angle D U W=\angle W D U=\angle K^{\prime} D V$. Therefore triangle $K^{\prime} D V$ is isosceles with apex $K^{\prime}$.
![](https://cdn.mathpix.com/cropped/2024_11_22_13e9df587c690fb1bee9g-09.jpg?height=1295&width=1686&top_left_y=760&top_left_x=219)

Figure 3: The three points $K$ on the radical axis.
![](https://cdn.mathpix.com/cropped/2024_11_22_13e9df587c690fb1bee9g-10.jpg?height=920&width=1335&top_left_y=291&top_left_x=286)

Figure 4: The enlargement of $W$ gives $K^{\prime}$.

This identifies $S$ as the intersection of the radical axis of the two circles with $B C$, so $K^{\prime}=K$ and $V=T$ and the proof is complete.


solution:
Let $\phi$ be the inversion with center $K$ and radius $K D$. Note that this inversion maps incirlce of $A B C$ to itself and $K, X, Y$ are collinear, hence $\phi(X)=Y$. Also $\phi(D)=D$, so $\phi$ maps circle $X B D$ to cicle $Y D B^{\prime}$, where $B^{\prime}:=\phi(B)$ is the point on $B C$ different from $B$ such that $\angle B X D=\angle D Y B^{\prime}$, hence $\phi(B)=C$. From $\phi(B)=C$ we get that $K D=K T$ as $K D^{2}=K B \cdot K C=K T^{2}$ since $K D$ is the radius of inversion.

The rest of the solutions is the same as in the other solutions.

solution_match: Solution 4.


problem:
Problem. For a sequence $a_{1}<a_{2}<\cdots<a_{n}$ of integers, a pair $\left(a_{i}, a_{j}\right)$ with $1 \leq i<j \leq n$ is called interesting if there exists a pair $\left(a_{k}, a_{l}\right)$ of integers with $1 \leq k<l \leq n$ such that

$$
\frac{a_{l}-a_{k}}{a_{j}-a_{i}}=2
$$

For each $n \geq 3$, find the largest possible number of interesting pairs in a sequence of length $n$.

Answer. $\frac{1}{2}(n-1)(n-2)+1$.

solution:
Consider the numbers $a_{i}=2^{i}$ for $2 \leq i \leq n$ and $a_{1}=0$, and choose any pair $(i, j)$ with $1 \leq i<j \leq n$.

If $i=1$, the pair $(1, j)$ is interesting for all $2 \leq j \leq n-1$, as $\frac{a_{j+1}-a_{1}}{a_{j}-a_{1}}=\frac{2^{j+1}}{2^{j}}=2$.
If $i \geq 2$, the pair $(i, j)$ is also interesting for all $j$ such that $i+1 \leq j \leq n-1$, since $\frac{a_{j+1}-a_{i+1}}{a_{j}-a_{i}}=\frac{2^{j+1}-2^{i+1}}{2^{j}-2^{i}}=2$.

In addition, the pair $(n-1, n)$ is interesting, as $\frac{a_{n}-a_{0}}{a_{n}-a_{n-1}}=2$.
Hence, all pairs in which $j \leq n-1$, and additionally the pair $(n-1, n)$, are interesting, giving $\frac{1}{2}(n-1)(n-2)+1$ pairs in total.

Now, let's show that there can't be more interesting pairs. To this end we show that at least $\frac{1}{2} n(n-1)-\left(\frac{1}{2}(n-1)(n-2)+1\right)=n-2$ pairs are not interesting. Clearly, the pair $(1, n)$ is not interesting.

Let's make the following observation: if a pair $(i, j)$ is interesting and it's not $(1, n)$, then $a_{j}-a_{i}$ can't exceed $\frac{1}{2}\left(a_{n}-a_{1}\right)$. (Since, if $(i, j)$ is interesting then $a_{l}-a_{k}=2\left(a_{j}-a_{i}\right)$ for some pair $(k, l)$. If then $2\left(a_{j}-a_{i}\right)>a_{n}-a_{1}$ we would have $a_{l}-a_{k}>a_{n}-a_{1}$, which is not possible.)

Finally, for any $2 \leq i \leq n-1$ consider pairs $(1, i)$ and $(i, n)$. If both of them are interesting, then, following the observation above, the only possibility is $a_{i}-a_{1}=a_{n}-a_{i}=\frac{a_{n}-a_{1}}{2}$. Clearly, this is possible for at most one $i$, so for all other $n-3$ values of $i$, at least one of pairs $(1, i)$ and $(i, n)$ is not interesting. Combining with the pair $(1, n)$, we get at least $n-2$ not interesting pairs in total, as desired.

Comment: The originally proposed formulation considered a sequence $a_{1}<a_{2}<\cdots<$ $a_{n}$ of $n$ real numbers, rather than integers. The conclusion is however the same and the solution is identical.

problem_match: # Problem 4 (UKR)

solution_match: Solution.


problem:
Problem. Let $\mathbb{N}$ denote the set of positive integers. Find all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that the following assertions are true for every pair of positive integers $(x, y)$ :

- $x$ and $f(x)$ have the same number of positive divisors.
- If $x$ does not divide $y$ and $y$ does not divide $x$, then

$$
\operatorname{gcd}(f(x), f(y))>f(\operatorname{gcd}(x, y))
$$

Here $\operatorname{gcd}(m, n)$ is the largest positive integer that divides both $m$ and $n$.

solution:
Throughout this proof, when we write divisors we mean positive divisors.
Let $f$ be a function satisfying these properties. From the first one, it follows that $f(1)=1$ and for each prime number $p, f(p)=q_{p}$ for some prime number $q_{p}$. Assume $p \neq 2$, the pair $(2, p)$ in property 2 gives

$$
\operatorname{gcd}\left(q_{2}, q_{p}\right)=\operatorname{gcd}(f(2), f(p))>f(\operatorname{gcd}(2, p))=f(1)=1
$$

so $q_{p}=q_{2}$ for all $p$. Set $q=q_{2}$.
Denote by $d(n)$ the number of divisors of a positive integer $n$.
We will prove the following claim by induction on $k \geq 0$, the number of distinct prime divisors of $n$ : For a positive integer $n, f(n)$ is a power of $q$.

The claim, together with the first property, imply that $f(n)=q^{d(n)-1}$.
For $k=0$ the claim is already proved.
For $k=1$, we need to prove that $f\left(p^{m}\right)$ is a power of $q$ for all positive $m$. The case $m=1$ was already proved. Assume now the result being proved for all positive integers $\leq m$. As $d\left(p^{t}\right)=t+1$, we then know $f\left(p^{t}\right)=q^{t}$ for all $t \leq m$. Now we consider $t=m+1$.

Let $r \neq p$ be a prime. Plug the pair $\left(p^{m-1} r, p^{m}\right)$ into the second property:

$$
\operatorname{gcd}\left(f\left(p^{m-1} r\right), q^{m}\right)=\operatorname{gcd}\left(f\left(p^{m-1} r\right), f\left(p^{m}\right)\right)>f\left(p^{m-1}\right)=q^{m-1}
$$

This implies $q^{m}$ divides $f\left(p^{m-1} r\right)$. Since $f\left(p^{m-1} r\right)$ has $2 m$ divisors, and $v_{q}\left(f\left(p^{m-1} r\right)\right) \geq m$, it follows that $f\left(p^{m-1} r\right)$ does not have prime divisors other than $q$, since it would then have at least $2 \cdot\left(v_{q}\left(f\left(p^{m-1} r\right)\right)+1\right)>2 m$ divisors. Thus, $f\left(p^{m-1} r\right)$ is a power of $q$. And since it has $2 m$ divisors, we must have $f\left(p^{m-1} r\right)=q^{2 m-1}$.

Now, plug the pair $\left(p^{m+1}, p^{m-1} r\right)$ into the second property. We have

$$
\operatorname{gcd}\left(f\left(p^{m+1}\right), q^{2 m-1}\right)=\operatorname{gcd}\left(f\left(p^{m+1}\right), f\left(p^{m-1} r\right)\right)>f\left(p^{m-1}\right)=q^{m-1} .
$$

Then $f\left(p^{m+1}\right)$ is divisible by $q^{m}$. If $f\left(p^{m+1}\right)$ had a prime factor other than $q$, it would have at least $2(m+1)$ divisors, but it has $m+2$ divisors and $2(m+1)>m+2$ since $m \geq 1$. Hence, $f\left(p^{m+1}\right)$ must also be a power of $q$. By induction, the proof is finished for $k=1$.

Suppose the claim is true for all integers $n$ with at most $k$ distinct prime factors, for some $k \geq 1$. In order to prove the claim for integers with $k+1$ distinct prime factors, it suffices
to show that for every positive integer $N$ with $k$ distinct prime factors, every positive integer $m$ and every prime $p$ which does not divide $N$, the number $f\left(N p^{m}\right)$ is a power of $q$. We will prove this by induction on $m$. The case $m=0$ follows from the previous induction hypothesis. Now suppose it has already been proved for a certain $m \geq 0$.

Let $s$ be a prime divisor of $N$. Consider the numbers $\left(N p^{m+1}, N s p^{m}\right)$. By the second property,

$$
\operatorname{gcd}\left(f\left(N p^{m+1}\right), q^{d\left(N s p^{m}\right)-1}\right)=\operatorname{gcd}\left(f\left(N p^{m+1}\right), f\left(N s p^{m}\right)\right)>f\left(N p^{m}\right)=q^{d\left(N p^{m}\right)-1}
$$

Then $q^{d\left(N p^{m}\right)}$ divides $f\left(N p^{m+1}\right)$. If $f\left(N p^{m+1}\right)$ has a prime factor other than $q$, it would have at least $2\left(d\left(N p^{m}\right)+1\right)=2((m+1) d(N)+1)=(2 m+2) d(N)+2$ divisors, but it has only $(m+2) d(N)$ divisors. Hence, $f\left(N p^{m+1}\right)$ must also be a power of $q$.

Finally, let us check that the function $f(n)=q^{d(n)-1}$ does satisfy the properties of the problem for any prime number $q$. The first property obviously holds. To check the second one, note that

$$
\operatorname{gcd}(f(x), f(y))=q^{\min (d(x), d(y))}>q^{d(\operatorname{gcd}(x, y))}=f(\operatorname{gcd}(x, y))
$$

whenever $x \nmid y$ and $y \nmid x$.

problem_match: # Problem 5 (HRV)


solution:
Firstly, one can prove that for any prime $p$ and any $m \geq 0, f\left(p^{m}\right)=q^{m}$, in the same way as in the first solution.

We will prove the claim this time by induction on $k=d(n)$. We notice again that the claim implies that $f(n)=q^{d(n)-1}$.

The cases $k=1,2,3$ are then already proved. Now suppose that for some $k \geq 3$ we have proved the claim for all positive integers $n$ with at most $k$ divisors.

Consider a positive integer $n$ with $k+1$ divisors. If $n$ is a power of a prime, then it is already proved that $f(n)$ is a power of $q$. Suppose $n$ is not a power of a prime. Consider distinct prime numbers $p_{1}$ and $p_{2}$ which divide $n$, such that $v_{p_{1}}(n) \leq v_{p_{2}}(n)$. Consider the number $\frac{n p_{2}}{p_{1}}$ : its number of divisors is $\frac{v_{p_{1}}(n)\left(v_{p_{2}}(n)+2\right)}{\left(v_{p_{1}}(n)+1\right)\left(v_{p_{2}}(n)+1\right)} d(n)$, which is strictly less than the number of divisors of $n$. Thus, by induction hypothesis, $f\left(\frac{n p_{2}}{p_{1}}\right)$ is a power of $q$.

By applying the second property to the pair $\left(n, \frac{n p_{2}}{p_{1}}\right)$, we have

$$
\operatorname{gcd}\left(f(n), q^{d\left(\frac{n p_{2}}{p_{1}}\right)-1}\right)=\operatorname{gcd}\left(f(n), f\left(\frac{n p_{2}}{p_{1}}\right)\right)>f\left(\frac{n}{p_{1}}\right)=q^{d\left(\frac{n}{p_{1}}\right)-1}
$$

This implies that $q^{d\left(\frac{n}{p_{1}}\right)}$ divides $f(n)$. Again, if other primes than $q$ divided $f(n)$, it would have at least $2\left(d\left(\frac{n}{p_{1}}\right)+1\right)$ divisors. But $2\left(d\left(\frac{n}{p_{1}}\right)+1\right)=2\left(\frac{v_{p_{1}}(n)}{v_{p_{1}}(n)+1} d(n)+1\right)>d(n)$. So $f(n)$ is a power of $q$ and the Claim is proved.

We finally check as in the first solution that $f(n)=q^{d(n)-1}$ satisfies the 2 properties for all prime $q$.


problem:
Problem. Find all positive integers $d$ for which there exists a degree $d$ polynomial $P$ with real coefficients such that there are at most $d$ different values among $P(0), P(1), \ldots, P\left(d^{2}-\right.$ d).

Remark 1 You can add a constant to a polynomial satisfying the conditions and obtain another polynomial satisfying the conditions.

Remark 2 This problem is equivalent to: Find all positive integers $d$ for which there exists a polynomial $P$ of degree $d$ that takes at most $d$ different values at members of a an arithmetic progression with $d^{2}-d+1$ (different) terms.
The answer to this EGMO problem implies a solution to this more general problem by scaling and translating, and the general result solves the EGMO problem as a special case. This means that instead of working with $0,1, \ldots, d^{2}-d$ we have the option of working with a region that is symmetric about the origin. Irrespective of the parity of $d$ we can use the $d^{2}-d+1$ integers which run from $-\left(d^{2}-d\right) / 2$ to $\left(d^{2}-d\right) / 2$ inclusive.

The advantage of using an arithmetic progression which is symmetric about the 0 is that $P(X)$ is a polynomial which works for the problem if, and only if, $P(-X)$ is a polynomial which works for the problem. This means that working at one end of the run of integers is the reflection of the activity at the other end. T Remarks dismissing the cases at the other end of the run as similar now become obviously correct rather than having to be studied separately.

solution:
We claim that such polynomials exist if and only if $d \leq 3$. The following examples show that such polynomials do exist for $d \leq 3$ :

$$
\left.\begin{array}{lll}
d=1: & d^{2}-d=0, & P_{1}(x)=x,
\end{array} \begin{array}{ll}
& P(0)=0 ;
\end{array}\right\}
$$

We can make more examples by adding constants.
Now we will show that there are no examples of degree greater than 3.
From now on we assume (without loss of generality) that the leading coefficient of our polynomial $P$ is positive and that all values $P(i)$ are positive (by adding a constant if necessary) for integers $i$ in the range $0 \leq i \leq d^{2}-d+1$.

Assume (for contradiction) that $P$ is a polynomial of degree $d \geq 4$ that satisfies the conditions of the problem and let $P(0), \ldots, P\left(d^{2}-d\right)$ take values among $p_{1}<\cdots<p_{d}$. For $i=1, \ldots, d$, let $n_{i} \geq 0$ be the number of appearances of $p_{i}$ among $P(0), \ldots, P\left(d^{2}-d\right)$.

By definition $n_{1}+\cdots+n_{d}=d^{2}-d+1$. Since $P$ has degree $d, n_{i} \leq d$. The key observation is now the following.

Claim 1 Make the convention that $n_{0}=n_{d+1}=0$. If $n_{i}=d$ for some $i$ in the range $1 \leq i \leq d$, then $n_{i \pm 1} \leq d-2$.

Proof. Up to scaling and hence without loss of generality, $P$ has leading coefficient +1 . $\overline{\text { Since }} n_{i}=d$, there exist non-negative integers $a_{1, i}<\cdots<a_{d, i} \leq d^{2}-d$ such that

$$
P(X)=\left(X-a_{1, i}\right) \cdots\left(X-a_{d, i}\right)+p_{i} .
$$

By construction, each of the $d-1$ intervals $I_{j}=\left[a_{j, i}, a_{j+1, i}\right]$ contains at least one local extremum of $P$, so contains exactly one such extremum because $P$, having degree $d$, has at most $d-1$ such extrema. Suppose that $i \leq d-1$ and that $P(m)=p_{i+1}>p_{i}$ for some $m \in\left\{0, \ldots, d^{2}-d\right\}$. Since $P$ has positive leading coefficient,

$$
m \in\left(a_{d, i}, \infty\right) \cup\left(a_{d-2, i}, a_{d-1, i}\right) \cup \cdots \cup\left(a_{i, 1}, a_{2, i}\right)
$$

if $d$ is odd or

$$
m \in\left(a_{d, i}, \infty\right) \cup\left(a_{d-2, i}, a_{d-1, i}\right) \cup \cdots \cup\left(-\infty, a_{1, i}\right)
$$

if $d$ is even.
Suppose that $a_{j, i}<m<a_{j+1, i}$, for some $j \in\{1, \ldots, d-1\}$. If $a_{j, i}+1<m<a_{j+1, i}-1$, then, because $I_{j}$ contains exactly one local extremum (which is a maximum),

Either $p_{i+1}=P(m)>P\left(a_{j, i}+1\right)$ or $p_{i+1}=P(m)>P\left(a_{j+1, i}-1\right)$. Since $P\left(a_{j, i}+1\right)>$ $P\left(a_{j, i}\right)=p_{i}$ and $P\left(a_{j, i}-1\right)>P\left(a_{j+1, i}\right)=p_{i}$, this contradicts the requirement that $P\left(a_{j, i}+1\right), P\left(a_{j+1, i}-1\right) \in\left\{p_{1}, \ldots, p_{d}\right\}$. Hence $m=a_{j, i}+1$ or $m=a_{j, i}-1$. Similarly, if $m>a_{d, i}$, then $m=a_{d, i}+1$, but if $m<a_{i, 1}$ (which may arise when $d$ is even), then $m=a_{i, 1}-1$. This shows that $m$ belongs to this list:

$$
a_{d, i}+1, a_{d-1, i}-1, \ldots, a_{2, i}+(-1)^{d}, a_{1, i}-(-1)^{d}
$$

This list contains at most $d$ different integers. It follows in particular that, if $n_{i+1}>d-2$, then either

$$
P\left(a_{d, i}+1\right)=p_{i+1}=P\left(a_{d-1, i}-1\right)
$$

or

$$
P\left(a_{2, i}+(-1)^{d}\right)=p_{i+1}=P\left(a_{1, i}-(-1)^{d}\right)
$$

with, additionally, $a_{2, i}+(-1)^{d} \neq a_{1, i}-(-1)^{d}$.
We have

$$
\left|P\left(a_{1, i} \pm 1\right)-p_{i}\right|=1 \cdot\left|a_{1, i} \pm 1-a_{2, i}\right| \cdot \prod_{j=3}^{d}\left|a_{1, i} \pm 1-a_{j, i}\right|
$$

and

$$
\left|P\left(a_{2, i} \mp 1\right)-p_{i}\right|=\left|a_{2, i} \mp 1-a_{1, i}\right| \cdot 1 \cdot \prod_{j=3}^{d}\left|a_{2, i} \mp 1-a_{j, i}\right| .
$$

As $a_{1, i}<a_{2, i}<a_{3, i}<\ldots<a_{d, i}$ we have $\left|a_{1, i} \pm 1-a_{j, i}\right| \geq\left|a_{2, i} \mp 1-a_{j, i}\right|$ with equality possible only if $a_{1, i}+1=a_{2, i}-1$. We also have $\left|a_{1, i} \pm 1-a_{2, i}\right|=\left|a_{2, i} \mp 1-a_{1, i}\right|$, which can be zero only if $a_{1, i}+1=a_{2, i}-1$. We conclude that $\left|P\left(a_{1, i} \pm 1\right)-p_{i}\right|>\left|P\left(a_{2, i} \mp 1\right)-p_{i}\right|$ or $a_{1, i}+1=a_{2, i}-1$.

Looking at the other end of the list of $\left(a_{j, i}\right)$ as $j$ varies, we have

$$
\left|P\left(a_{d-1, i}-1\right)-p_{i}\right|=1 \cdot\left|a_{d-1, i}-1-a_{d, i}\right| \cdot \prod_{j=1}^{d-2}\left|a_{d-1, i}-1-a_{j, i}\right|
$$

and

$$
\left|P\left(a_{d, i}+1\right)-p_{i}\right|=\left|a_{d, i}+1-a_{d-1, i}\right| \cdot 1 \cdot \prod_{j=1}^{d-2}\left|a_{d, i}+1-a_{j, i}\right|
$$

In these two formulas the shared factor outside the product is at least 2 and so is not 0 . Now look at the factors behind the product symbols. As $a_{1, i}<a_{2, i}<a_{3, i}<\ldots<a_{d, i}$, for $j \leq d-2$ we have $\left|a_{d, i}+1-a_{j, i}\right|>\left|a_{d-1, i}-1-a_{j, i}\right|$. We conclude that $\left|P\left(a_{d, i}+1\right)-p_{i}\right|>$ $\left|P\left(a_{d-1, i}-1\right)-p_{i}\right|$. Claim 1 is proved.

For each $i \in\{1, \ldots, d-1\}$, there are three possibilities:

- $n_{i}, n_{i+1} \leq d-1$
- $n_{i}=d$ and $n_{i+1} \leq d-2$
- $n_{i+1}=d$ and $n_{i} \leq d-2$.

In all three cases, $n_{i}+n_{i+1} \leq 2(d-1)$. If $n$ is even, this leads to the contradiction

$$
d^{2}-d+1=\left(n_{1}+n_{2}\right)+\cdots+\left(n_{d-1}+n_{d}\right) \leq(d / 2)[2(d-1)]=d^{2}-d
$$

This is an important staging point in the argument because we have eliminated the possibility of a polynomial of even degree $d$ satisfying the conditions of the problem if $d \geq 4$.

From now on we assume that $d \geq 5$ is odd, and
$d^{2}-d+1=\left(n_{1}+n_{2}\right)+\cdots+\left(n_{d-2}+n_{d-1}\right)+n_{d} \leq[(d-1) / 2][2(d-1)]+d=d^{2}-d+1$.
Equality must therefore hold throughout. Since the sum can also be grouped as

$$
n_{1}+\left(n_{2}+n_{3}\right)+\cdots+\left(n_{d-1}+n_{d}\right)
$$

this requires $n_{1}=n_{d}=d, n_{i}+n_{i+1}=2(d-1)$ for $i=1,2, \ldots, d-1$ i.e. $n_{i}=d$ for odd $i$ and $n_{i}=d-2$ for even $i$.

We are interested in the degree of $P$ being $d \geq 5$ and odd, and showing that no polynomial $P$ satisfying the conditions of the problem can exist. There are $d-1 \geq 4$ extremal points points which alternate between local maxima and minima (in that order) as you read from left to right (we normalize so that $P$ is monic). For any $p_{i}$ with $i$ odd, the line $y=p_{i}$ (with
$i$ odd) crosses the graph of $P$ in $d$ places with $x$-coordinates in the real closed interval $\left[0, d^{2}-d\right]$ at points $\left(z, p_{i}\right)$ so each $z$ must be an integer. Suppose that $J$ is a real interval on the $x$-axis ending at adjacent local extrema. The function defined by $P$ is monotonic on each $J$. The line $y=p_{i}$ ( $i$ odd) meets the graph at most once on $J$. Therefore it meets the graph of $P$ exactly once in the interior of each $J$ (there are $d-2$ such intervals) and at the only two possible places outside the union of these intervals.

Now consider $p_{j}$ when $j$ is even (so $n_{j}=d-2$ ). These $d-2$ intervals $J$ afford $d-2$ real values at which $P$ will take $p_{j}$ as a value where $j$ is fixed and even. The question is, are the corresponding arguments integers? The proof of Claim 1 tells us that in the middle of the run $\left\{0,1, \ldots, d^{2}-d+1\right\}$ all is well: the polynomial is assuming the value $p_{j}$ at an integer where the polynomial assumes the values $p_{j-1}$ and $p_{j+1}$ at adjacent integers in some order. The problem is at the ends of the run where $\left|P\left(a_{1, i}+1\right)-p_{i}\right|>\left|P\left(a_{2, i}-1\right)-p_{i}\right|$ and $\left|P\left(a_{d, i}+1\right)-p_{i}\right|>\left|P\left(a_{d-1, i}-1\right)-p_{i}\right|$. When $j$ is even, two of the roots of $P(x)-p_{j}$ are not integers, and we now know approximately where this trouble is happening (at the ends).

At this point we could finish if $d \geq 7$, because the run of regular behaviour in the middle is sufficiently long that we could obtain a contradiction. However we have to work a little harder to include the case $d=5$. We now show that the run of regular behaviour is slightly longer than we have currently established. We do this using Claim 2.

Claim 2. If $d$ is odd, and $n_{i}=d, n_{i \pm 1}=d-2$ for some $i$, then $P$ attains $p_{i \pm 1}$ precisely at the $d-2$ integers

$$
a_{2, i}-1, a_{3, i}+1, \cdots, a_{d-2, i}-1, a_{d-1, i}+1
$$

Proof Suppose (for contradiction) $a_{1, i}+1 \neq a_{2, i}-1$ and $P\left(a_{1, i}+1\right)=p_{i+1}$. Now $a_{1, i}<a_{2, i}$ so either $a_{1, i}+1<a_{2, i}-1$ or $a_{1, i}=a_{2, i}-1$. In the latter case, $P\left(a_{1, i}+1\right)=P\left(a_{2, i}\right)=p_{i}$, a contradiction. In the former case, the proof of Claim 1 shows that

$$
\left|P\left(a_{2, i}-1\right)-p_{i}\right|<\left|P\left(a_{1, i}+1\right)-p_{i}\right|=\left|p_{i+1}-p_{i}\right|=p_{i+1}-p_{i}
$$

so $P\left(a_{2, i}-1\right)<p_{i+1}$. The polynomial is decreasing on the interval $\left(a_{2, d}, a_{2,1}\right)$ so $p_{i}<P\left(a_{2, i}-1\right)<p_{i+1}$ which is absurd because $P\left(a_{2, i}-1\right)=p_{j}$ for some $j$. Therefore $P\left(a_{2, i}-1\right)=p_{i+1}$ for all odd $i$. A similar argument shows that $P\left(a_{d-1, i}+1\right)=p_{i+1}$ so Claim 2 is established.

Now we have n sequence of alternating falling then rising then falling etc. full runs starting at $\left(a_{2, d}, p_{d}\right)$ and ending at $\left(a_{d-1,1}, p_{1}\right)$ so the initial run of $3 d+1$ terms of this run of values is

$$
p_{d}, p_{d-1}, \cdots p_{1}, p_{1}, p_{2}, \ldots, p_{d}, p_{d}, p_{d-1}, \cdots p_{1}, p_{1}
$$

which starts at $\left(a_{2, d}, p_{d}\right)$ and ends at $\left(a_{4,1}+1, p_{1}\right)$ which is fine because $4 \leq d-1$.
There are now various ways we can finish.
(a) Consider the run of length $2 d$ consecutive values

$$
p_{d}, p_{d-1}, \cdots p_{1}, p_{1}, p_{2}, \ldots, p_{d}
$$

The first $d+1$ points determine $P(x)$. The last $d+1$ values also determine $P$ but the values are in the reverse order, so $P(X)=P(c-X)$ for some constant $c$. However, the coefficients of $X^{d}$ are have opposite signs ( $d$ is odd) so this is absurd.
(b) The idea in (a) can be expressed in terms of Lagrange interpolation to obtain essentially the same contradiction. Construct $P$ in two ways using Lagrange interpolation on both the first $d+1$ and the last $d+1$ points. The symmetry in the data forces the graph of $P$ to have a vertical axis of symmetry. This is absurd because the degree of $P$ is odd.
(c) The initial fragment length $3 d+1$ mentioned above at $(*)$ includes two identical runs of values of $P$ (in the same order) of length $d+1$. The polynomial $P$ is determined by each of them and so $P(X)=P(X+c)$ for some constant $c$ and so the polynomial defines a bounded function which is absurd.

problem_match: # Problem 6 (LUX+BEL)