# EGMO2022 Problems ## DAY 1 ## Problem 1. Let $A B C$ be an acute-angled triangle in which $B Cq$, and let $p^{t}=a q+b$ with $0 \leq bp^{t-1}$, so $a1$ and $f(q)>1$, and these are the two smallest such primes. $11$ and $f(q)>1$ are equal, so $f(q)=f(p)=a$. If $p^{2}1$ for some $m \in \mathbb{N}$, then there are less than $m$ different prime numbers $p_{i}$ with $f\left(p_{i}\right)>1$. Proof. On the one hand, if $f(m)=c>1$, then for any $n \in \mathbb{N}$, there is some $k \in\{n+1, n+2 \ldots, n+m\}$ such that $f(k) \in\{1, c\}$. To show this, it is enough to see that condition (2) implies that for any $n \in \mathbb{N}$ - if $f(n)=c$, then $f(n+1) \in\{1, c\}$; - if $f(n)=1$, then $f(n+m) \in\{1, c\}$. On the other hand, if we suppose that there are $m$ different prime numbers $p_{1}, p_{2}, \ldots, p_{m}$, then we know (by the Chinese Remainder Theorem) that for any number $t \in \mathbb{N}$, there exists a number $n_{t} \in \mathbb{N}$ such that $p_{k}^{t} \mid n_{t}+k$ for each $k \in\{1,2, \ldots, m\}$. Hence for each $k$, we have $$ f\left(n_{t}+k\right) \geq f\left(p_{i}^{t}\right)=f\left(p_{i}\right)^{t} \geq 2^{t} . $$ If $2^{t}>c$, then it means that $f(k)>c$ for all $k \in\left\{n_{t}+1, n_{t}+2 \ldots, n_{t}+m\right\}$. Now we can suppose that for some $m \geq 2$, the set of primes with $f(p)>1$ is $S=\left\{p_{1}, p_{2}, \ldots, p_{m}\right\}$. Now let $S_{1}$ and $S_{2}$ be two disjoint nonempty subsets such that $S_{1} \cup S_{2}=S$. Let $a=\prod_{p_{i} \in S_{1}} p_{i}$ and $b=\prod_{p_{j} \in S_{2}} p_{j}$. Now for any $k, \ell \in \mathbb{N}, a^{k}+b^{\ell}$ is coprime to all primes in $S$, hence $f\left(a^{k}+b^{\ell}\right)=1$. It is easy to see that we can choose $k$ and $\ell$ such that $f\left(a^{k}\right) \neq f\left(b^{\ell}\right)$, which contradicts condition (2). Solution 4 (for the main part). Let $p$ the minimal (prime) number with $f(p)=c>1$. Claim 4.1. For any $k \in \mathbb{N}, f\left(1+p+p^{2}+\ldots+p^{k}\right) \in\left\{1, c, c^{2}, \ldots, c^{k}\right\}$. Proof of the claim. Use condition (2) recursively. Now suppose that there exists some prime $q>p$ with $f(q)>1$, and consider the following three values of $f$ : - $f(1)=1$. - $f\left(p^{q-1}-1\right)=f(p-1) f\left(p^{q-2}+p^{q-3}+\ldots+p+1\right) \in\left\{1, c, c^{2}, \ldots, c^{q-2}\right\}$ using our claim, (note that we know $f(p-1)=1$ by the minimality of $p$ ). But we also know (by Fermat's little theorem) that $q \mid p^{q-1}-1$, hence $f(q) \mid f\left(p^{q-1}-1\right)$. Therefore we have that: $f\left(p^{q-1}-1\right) \in\left\{c, c^{2}, \ldots, c^{q-2}\right\}$. - $f\left(p^{q-1}\right)=c^{q-1}$. These are three different values, hence we have a contradiction by condition (2). Solution 4B (for the main part). Let $p$ the minimal (prime) number with $f(p)=c>1$. Lemma 4B.1. For any $k \in \mathbb{N}, f\left(1+p+p^{2}+\ldots+p^{k}\right)=1$. Proof of the Lemma, by induction. $k=0$ is trivial. $k=1$ is also easy, as $p+1$ cannot be a prime, except in the case of $p=2$, which is also easy. (If $f(2)=c>1$, then $f(3) \in\{1, c\}$ by $3=1+2$ and $f(3) \in\left\{1, c^{2}\right\}$ by $2^{2}=1+3$.) From now we suppose $k \geq 2$ and $f\left(1+p+\ldots+p^{k-1}\right)=1$. By condition (2), we have that: - As $f\left(1+p+\ldots+p^{k-1}\right)=1$ and $f\left(p^{k}\right)=c^{k}$, we have that $f\left(1+p+\ldots+p^{k-1}\right) \in\left\{1, c^{k}\right\}$ - As $f(1)=1$ and $f\left(p+\ldots+p^{k}\right)=f(p) f\left(1+p+\ldots+p^{k-1}\right)=c$, we also have that $f\left(1+p+\ldots+p^{k-1}\right) \in\{1, c\}$. If $k>1, c \neq c^{k}$, therefore $f\left(1+p+\ldots+p^{k}\right)=1$. Now suppose that there exists some prime $q>p$ with $f(q)>1$. Then by condition (1), $$ f\left(p^{q-1}-1\right)=f(p-1) f\left(1+p+\ldots+p^{q-2}\right) $$ here $f(p-1)=1$ (by the minimality of $p$ ) and $f\left(1+p+\ldots+p^{q-2}\right)=1$ by the lemma. But we also know (by Fermat's little theorem) that $q \mid p^{q-1}-1$, hence $1m \in \mathbb{N}$ ). Proof of the Lemma. By condition (2), $\{f(n+m), f(n-m)\} \subseteq\{f(n), f(m)\}$. We also have that: $$ f(n-m) f(n+m)=f\left(n^{2}-m^{2}\right) \in\left\{f(n)^{2}, f(m)^{2}\right\} $$ which is only possible if $f(n-m)=f(n+m)=f(n)$ or $f(n-m)=f(n+m)=f(m)$. Now let $p$ be the smallest (prime) number with $f(p)>1$. Claim 5.2. If $p$ does not divide $n$, then $f(n)=1$. Proof of the Claim. Let $n$ be the minimal counterexample, and and let $n=d p+r$ with $0b_{n-1}=c_{n-1}-c_{n-2} $$ Factoring, $$ \left(m_{n}-m_{n-1}\right)\left(m_{n}+m_{n-1}\right)>\left(m_{n-1}-m_{n-2}\right)\left(m_{n-1}+m_{n-2}\right) $$ In the case that $m_{n}-m_{n-1}=m_{n-1}-m_{n-2}$, this inequality clearly holds, as $m_{n}+m_{n-1}>m_{n-1}+m_{n-2}$. Thus, the minimal possible value of $m_{n}$ satisfies the claimed inequality. Proof 2. Denote $c_{n-1}=x^{2}, c_{n-2}=(x-d)^{2}$. Then $$ 2 c_{n-1}-c_{n-2}=2 x^{2}-(x-d)^{2}=x^{2}+2 d x-d^{2}=(x+d)^{2}-2 d^{2}<(x+d)^{2} $$ It follows that $c_{n} \leq(x+d)^{2}$. And so the sequence of positive integers $\sqrt{c_{n}}-\sqrt{c_{n-1}}$ is decreasing. Any such sequence is eventually constant. As a corollary, $c_{n}=(x+n d)^{2}$ for sufficiently large $n$, with fixed integers $x$ and $d$. Along the lines above, it becomes clear that $a_{n}=c_{n}-2 c_{n-1}+c_{n-2}=2 d^{2}$, so the sequence $\left(a_{n}\right)$ is constant. Solution. We write: $$ s_{n}^{2}=S_{n}=a_{1}+\left(a_{1}+a_{2}\right)+\ldots+\left(a_{1}+\ldots+a_{n}\right) $$ So, setting $b_{n}:=a_{1}+\ldots+a_{n}$, we have $S_{n}=b_{1}+b_{2}+\ldots+b_{n}$ and, in particular $S_{n+1}=S_{n}+b_{n+1}$. Now, we study the quantity $S_{n} b_{n}=+b_{1}+b_{2}+\ldots+b_{n}+b_{n}$ in two different ways. Since $b_{n+1}$ is the smallest integer strictly greater than $b_{n}$ such that $b_{1}+\ldots+b_{n}+b_{n+1}$ is a perfect square, we must have $$ b_{1}+b_{2}+\ldots+b_{n}+b_{n} \geq\left(s_{n+1}-1\right)^{2} $$ However, we also have $$ b_{1}+b_{2}+\ldots+b_{n}+b_{n}=S_{n}+b_{n}=2 S_{n}-S_{n-1} $$ Combining, we obtain $$ s_{n}^{2} \geq \frac{s_{n-1}^{2}+\left(s_{n+1}-1\right)^{2}}{2}>\left(\frac{s_{n-1}+s_{n+1}-1}{2}\right)^{2} $$ where the final inequality is strict since the sequence $\left(s_{k}\right)$ is strictly increasing. Taking a square root, and noting that all the $\left(s_{n}\right)$ are integers, one obtains $s_{n+1}-s_{n} \leq s_{n}-s_{n-1}$. Now we focus on the sequence $d_{n}=s_{n+1}-s_{n} .\left(s_{k}\right)$ is strictly increasing thus $\left(d_{k}\right)$ is positive. However we proved that $d_{n+1} \leq d_{n}$, so the sequence $\left(d_{k}\right)$ is eventually constant, so eventually $s_{n}=b n+c$ and $S_{n}=(b n+c)^{2}$ with some numbers $b, c$; then $$ a_{n+2}=S_{n+2}-2 S_{n+1}+S_{n}=(b(n+2)+c)^{2}-2(b(n+1)+c)^{2}+(b n+c)^{2}=2 b^{2} $$ Remark. The key idea is to use the $D$ difference operator on the space of sequences. That is a function which takes a sequence as an input and outputs another sequence the following way: if $(x)$ is the input sequence, then $$ D(x)=D\left(\left(x_{1}, x_{2}, x_{3}, x_{4}, \ldots\right)\right)=\left(x_{2}-x_{1}, x_{3}-x_{2}, x_{4}-x_{3}, \ldots\right) $$ Here $D D(S)=(a)$ (with some shift), $D(s)=(d)$. This $D$ operator has some nice properties; if someone studied calculus, these properties will be familiar. $D(x+y)=D(x)+D(y) ; D(\lambda x)=\lambda D(x) ;(x)$ constant iff $D x$ zero ; $(x)$ is linear iff $D x$ constant ; in general $(x)$ is a polynomial with degree $l+1$ iff $D(x)$ is a polynomial with degree $l$. First we proved that sequence $(d)$ is eventually constant, thus $D(d)=D D(s)$ is eventually zero. Therefore the sequence $(s)$ is eventually a linear function, hence $s^{2}=S$ is eventually a quadratic polynomial, therefore $0=D D D(S)=D(a)$, so $(a)$ is constant eventually. ## Problem 4. Given a positive integer $n \geq 2$, determine the largest positive integer $N$ for which there exist $N+1$ real numbers $a_{0}, a_{1}, \ldots, a_{N}$ such that (1) $a_{0}+a_{1}=-\frac{1}{n}$, and (2) $\left(a_{k}+a_{k-1}\right)\left(a_{k}+a_{k+1}\right)=a_{k-1}-a_{k+1}$ for $1 \leq k \leq N-1$. Proposed by: Romania Solution 1. $\left(a_{k}+a_{k-1}\right)\left(a_{k}+a_{k+1}\right)=a_{k-1}-a_{k+1}$ is equivalent to $\left(a_{k}+a_{k-1}+1\right)\left(a_{k}+a_{k+1}-1\right)=-1$. Let $b_{k}=a_{k}+a_{k+1}$. Thus we need $b_{0}, b_{1}, \ldots$ the following way: $b_{0}=-\frac{1}{n}$ and $\left(b_{k-1}+1\right)\left(b_{k}-1\right)=-1$. There is a proper sequence $b_{0}, b_{1}, \ldots, b_{N-1}$ if and only if there is proper sequence $a_{0}, a_{1}, \ldots, a_{N}$, because from a a proper $\left(a_{k}\right)$ sequence we can get a proper $\left(b_{k}\right)$ sequence with $b_{k}=a_{k}+a_{k+1}$ for $k=0,1, \ldots, N-1$ and from a proper $\left(b_{k}\right)$ sequence we can get a proper $\left(a_{k}\right)$ sequence by arbitrarily setting $a_{0}$ and then inductively defining $a_{k}=b_{k-1}-a_{k-1}$ for $k=1,2, \ldots, N$. We prove by induction that $b_{k}=-\frac{1}{n-k}$ for $k