olympiads / IMO /md /en-IMO2019SL.md
mavi88's picture
add data for IMO, USA_TST, USA_TSTST, USAJMO, USAMO
eebb93b
|
Raw
History Blame
262 kB

60TH INTERNATIONAL MATHEMATICAL OLYMPIAD

July 11 1h - July 22 ${ }^{\text {nd }}$, Bath, United Kingdom

SHORTLISTED PROBLEMS WITH SOLUTIONS

IMO 2019

Shortlisted Problems (with solutions)

60 ${ }^{\text {th }}$ International Mathematical Olympiad Bath — UK, 11th-22nd July 2019

The Shortlist has to be kept strictly confidential until the conclusion of the following International Mathematical Olympiad.

IMO General Regulations §6.6

Contributing Countries

The Organising Committee and the Problem Selection Committee of IMO 2019 thank the following 58 countries for contributing 204 problem proposals:

Albania, Armenia, Australia, Austria, Belarus, Belgium, Brazil, Bulgaria, Canada, China, Croatia, Cuba, Cyprus, Czech Republic, Denmark, Ecuador, El Salvador, Estonia, Finland, France, Georgia, Germany, Greece, Hong Kong, Hungary, India, Indonesia, Iran, Ireland, Israel, Italy, Japan, Kazakhstan, Kosovo, Luxembourg, Mexico, Netherlands, New Zealand, Nicaragua, Nigeria, North Macedonia, Philippines, Poland, Russia, Serbia, Singapore, Slovakia, Slovenia, South Africa, South Korea, Sweden, Switzerland, Taiwan, Tanzania, Thailand, Ukraine, USA, Vietnam.

Problem Selection Committee

Tony Gardiner, Edward Crane, Alexander Betts, James Cranch, Joseph Myers (chair), James Aaronson, Andrew Carlotti, Géza Kós, Ilya I. Bogdanov, Jack Shotton

Problems

Algebra

A1. Let $\mathbb{Z}$ be the set of integers. Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that, for all integers $a$ and $b$,

f(2a)+2f(b)=f(f(a+b)) f(2 a)+2 f(b)=f(f(a+b))

(South Africa) A2. Let $u_{1}, u_{2}, \ldots, u_{2019}$ be real numbers satisfying

u1+u2++u2019=0 and u12+u22++u20192=1. u_{1}+u_{2}+\cdots+u_{2019}=0 \quad \text { and } \quad u_{1}^{2}+u_{2}^{2}+\cdots+u_{2019}^{2}=1 .

Let $a=\min \left(u_{1}, u_{2}, \ldots, u_{2019}\right)$ and $b=\max \left(u_{1}, u_{2}, \ldots, u_{2019}\right)$. Prove that

ab12019 a b \leqslant-\frac{1}{2019}

(Germany) A3. Let $n \geqslant 3$ be a positive integer and let $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ be a strictly increasing sequence of $n$ positive real numbers with sum equal to 2 . Let $X$ be a subset of ${1,2, \ldots, n}$ such that the value of

1iXai \left|1-\sum_{i \in X} a_{i}\right|

is minimised. Prove that there exists a strictly increasing sequence of $n$ positive real numbers $\left(b_{1}, b_{2}, \ldots, b_{n}\right)$ with sum equal to 2 such that

iXbi=1 \sum_{i \in X} b_{i}=1

(New Zealand) A4. Let $n \geqslant 2$ be a positive integer and $a_{1}, a_{2}, \ldots, a_{n}$ be real numbers such that

a1+a2++an=0 a_{1}+a_{2}+\cdots+a_{n}=0

Define the set $A$ by

A={(i,j)1i<jn,aiaj1}. A=\left\{(i, j)\left|1 \leqslant i<j \leqslant n,\left|a_{i}-a_{j}\right| \geqslant 1\right\} .\right.

Prove that, if $A$ is not empty, then

(i,j)Aaiaj<0 \sum_{(i, j) \in A} a_{i} a_{j}<0

(China) A5. Let $x_{1}, x_{2}, \ldots, x_{n}$ be different real numbers. Prove that

1inji1xixjxixj={0, if n is even 1, if n is odd  \sum_{1 \leqslant i \leqslant n} \prod_{j \neq i} \frac{1-x_{i} x_{j}}{x_{i}-x_{j}}= \begin{cases}0, & \text { if } n \text { is even } \\ 1, & \text { if } n \text { is odd }\end{cases}

A6. A polynomial $P(x, y, z)$ in three variables with real coefficients satisfies the identities

P(x,y,z)=P(x,y,xyz)=P(x,zxy,z)=P(yzx,y,z). P(x, y, z)=P(x, y, x y-z)=P(x, z x-y, z)=P(y z-x, y, z) .

Prove that there exists a polynomial $F(t)$ in one variable such that

P(x,y,z)=F(x2+y2+z2xyz). P(x, y, z)=F\left(x^{2}+y^{2}+z^{2}-x y z\right) .

A7. Let $\mathbb{Z}$ be the set of integers. We consider functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ satisfying

f(f(x+y)+y)=f(f(x)+y) f(f(x+y)+y)=f(f(x)+y)

for all integers $x$ and $y$. For such a function, we say that an integer $v$ is $f$-rare if the set

Xv={xZ:f(x)=v} X_{v}=\{x \in \mathbb{Z}: f(x)=v\}

is finite and nonempty. (a) Prove that there exists such a function $f$ for which there is an $f$-rare integer. (b) Prove that no such function $f$ can have more than one $f$-rare integer.

Combinatorics

C1. The infinite sequence $a_{0}, a_{1}, a_{2}, \ldots$ of (not necessarily different) integers has the following properties: $0 \leqslant a_{i} \leqslant i$ for all integers $i \geqslant 0$, and

(ka0)+(ka1)++(kak)=2k \binom{k}{a_{0}}+\binom{k}{a_{1}}+\cdots+\binom{k}{a_{k}}=2^{k}

for all integers $k \geqslant 0$. Prove that all integers $N \geqslant 0$ occur in the sequence (that is, for all $N \geqslant 0$, there exists $i \geqslant 0$ with $a_{i}=N$ ).

(Netherlands)

C2. You are given a set of $n$ blocks, each weighing at least 1 ; their total weight is $2 n$. Prove that for every real number $r$ with $0 \leqslant r \leqslant 2 n-2$ you can choose a subset of the blocks whose total weight is at least $r$ but at most $r+2$. (Thailand)

C3. Let $n$ be a positive integer. Harry has $n$ coins lined up on his desk, each showing

heads or tails. He repeatedly does the following operation: if there are $k$ coins showing heads and $k>0$, then he flips the $k^{\text {th }}$ coin over; otherwise he stops the process. (For example, the process starting with THT would be THT $\rightarrow H H T \rightarrow H T T \rightarrow T T T$, which takes three steps.)

Letting $C$ denote the initial configuration (a sequence of $n H$ 's and $T$ 's), write $\ell(C)$ for the number of steps needed before all coins show $T$. Show that this number $\ell(C)$ is finite, and determine its average value over all $2^{n}$ possible initial configurations $C$.

C4. On a flat plane in Camelot, King Arthur builds a labyrinth $\mathfrak{L}$ consisting of $n$ walls, each of which is an infinite straight line. No two walls are parallel, and no three walls have a common point. Merlin then paints one side of each wall entirely red and the other side entirely blue.

At the intersection of two walls there are four corners: two diagonally opposite corners where a red side and a blue side meet, one corner where two red sides meet, and one corner where two blue sides meet. At each such intersection, there is a two-way door connecting the two diagonally opposite corners at which sides of different colours meet.

After Merlin paints the walls, Morgana then places some knights in the labyrinth. The knights can walk through doors, but cannot walk through walls.

Let $k(\mathfrak{L})$ be the largest number $k$ such that, no matter how Merlin paints the labyrinth $\mathfrak{L}$, Morgana can always place at least $k$ knights such that no two of them can ever meet. For each $n$, what are all possible values for $k(\mathfrak{L})$, where $\mathfrak{L}$ is a labyrinth with $n$ walls? (Canada) C5. On a certain social network, there are 2019 users, some pairs of which are friends, where friendship is a symmetric relation. Initially, there are 1010 people with 1009 friends each and 1009 people with 1010 friends each. However, the friendships are rather unstable, so events of the following kind may happen repeatedly, one at a time:

Let $A, B$, and $C$ be people such that $A$ is friends with both $B$ and $C$, but $B$ and $C$ are not friends; then $B$ and $C$ become friends, but $A$ is no longer friends with them. Prove that, regardless of the initial friendships, there exists a sequence of such events after which each user is friends with at most one other user. (Croatia)

C6. Let $n>1$ be an integer. Suppose we are given $2 n$ points in a plane such that no three of them are collinear. The points are to be labelled $A_{1}, A_{2}, \ldots, A_{2 n}$ in some order. We then consider the $2 n$ angles $\angle A_{1} A_{2} A_{3}, \angle A_{2} A_{3} A_{4}, \ldots, \angle A_{2 n-2} A_{2 n-1} A_{2 n}, \angle A_{2 n-1} A_{2 n} A_{1}$, $\angle A_{2 n} A_{1} A_{2}$. We measure each angle in the way that gives the smallest positive value (i.e. between $0^{\circ}$ and $180^{\circ}$ ). Prove that there exists an ordering of the given points such that the resulting $2 n$ angles can be separated into two groups with the sum of one group of angles equal to the sum of the other group.

C7. There are 60 empty boxes $B_{1}, \ldots, B_{60}$ in a row on a table and an unlimited supply of pebbles. Given a positive integer $n$, Alice and Bob play the following game.

In the first round, Alice takes $n$ pebbles and distributes them into the 60 boxes as she wishes. Each subsequent round consists of two steps: (a) Bob chooses an integer $k$ with $1 \leqslant k \leqslant 59$ and splits the boxes into the two groups $B_{1}, \ldots, B_{k}$ and $B_{k+1}, \ldots, B_{60}$. (b) Alice picks one of these two groups, adds one pebble to each box in that group, and removes one pebble from each box in the other group.

Bob wins if, at the end of any round, some box contains no pebbles. Find the smallest $n$ such that Alice can prevent Bob from winning. (Czech Republic)

C8.

Alice has a map of Wonderland, a country consisting of $n \geqslant 2$ towns. For every pair of towns, there is a narrow road going from one town to the other. One day, all the roads are declared to be "one way" only. Alice has no information on the direction of the roads, but the King of Hearts has offered to help her. She is allowed to ask him a number of questions. For each question in turn, Alice chooses a pair of towns and the King of Hearts tells her the direction of the road connecting those two towns.

Alice wants to know whether there is at least one town in Wonderland with at most one outgoing road. Prove that she can always find out by asking at most $4 n$ questions.

Comment. This problem could be posed with an explicit statement about points being awarded for weaker bounds $c n$ for some $c>4$, in the style of IMO 2014 Problem 6. (Thailand)

C9.

For any two different real numbers $x$ and $y$, we define $D(x, y)$ to be the unique integer $d$ satisfying $2^{d} \leqslant|x-y|<2^{d+1}$. Given a set of reals $\mathcal{F}$, and an element $x \in \mathcal{F}$, we say that the scales of $x$ in $\mathcal{F}$ are the values of $D(x, y)$ for $y \in \mathcal{F}$ with $x \neq y$.

Let $k$ be a given positive integer. Suppose that each member $x$ of $\mathcal{F}$ has at most $k$ different scales in $\mathcal{F}$ (note that these scales may depend on $x$ ). What is the maximum possible size of $\mathcal{F}$ ? (Italy)

Geometry

G1. Let $A B C$ be a triangle. Circle $\Gamma$ passes through $A$, meets segments $A B$ and $A C$

again at points $D$ and $E$ respectively, and intersects segment $B C$ at $F$ and $G$ such that $F$ lies between $B$ and $G$. The tangent to circle $B D F$ at $F$ and the tangent to circle $C E G$ at $G$ meet at point $T$. Suppose that points $A$ and $T$ are distinct. Prove that line $A T$ is parallel to $B C$. (Nigeria) G2. Let $A B C$ be an acute-angled triangle and let $D, E$, and $F$ be the feet of altitudes from $A, B$, and $C$ to sides $B C, C A$, and $A B$, respectively. Denote by $\omega_{B}$ and $\omega_{C}$ the incircles of triangles $B D F$ and $C D E$, and let these circles be tangent to segments $D F$ and $D E$ at $M$ and $N$, respectively. Let line $M N$ meet circles $\omega_{B}$ and $\omega_{C}$ again at $P \neq M$ and $Q \neq N$, respectively. Prove that $M P=N Q$. (Vietnam) G3. In triangle $A B C$, let $A_{1}$ and $B_{1}$ be two points on sides $B C$ and $A C$, and let $P$ and $Q$ be two points on segments $A A_{1}$ and $B B_{1}$, respectively, so that line $P Q$ is parallel to $A B$. On ray $P B_{1}$, beyond $B_{1}$, let $P_{1}$ be a point so that $\angle P P_{1} C=\angle B A C$. Similarly, on ray $Q A_{1}$, beyond $A_{1}$, let $Q_{1}$ be a point so that $\angle C Q_{1} Q=\angle C B A$. Show that points $P, Q, P_{1}$, and $Q_{1}$ are concyclic. (Ukraine) G4. Let $P$ be a point inside triangle $A B C$. Let $A P$ meet $B C$ at $A_{1}$, let $B P$ meet $C A$ at $B_{1}$, and let $C P$ meet $A B$ at $C_{1}$. Let $A_{2}$ be the point such that $A_{1}$ is the midpoint of $P A_{2}$, let $B_{2}$ be the point such that $B_{1}$ is the midpoint of $P B_{2}$, and let $C_{2}$ be the point such that $C_{1}$ is the midpoint of $P C_{2}$. Prove that points $A_{2}, B_{2}$, and $C_{2}$ cannot all lie strictly inside the circumcircle of triangle $A B C$. (Australia) G5. Let $A B C D E$ be a convex pentagon with $C D=D E$ and $\angle E D C \neq 2 \cdot \angle A D B$. Suppose that a point $P$ is located in the interior of the pentagon such that $A P=A E$ and $B P=B C$. Prove that $P$ lies on the diagonal $C E$ if and only if $\operatorname{area}(B C D)+\operatorname{area}(A D E)=$ $\operatorname{area}(A B D)+\operatorname{area}(A B P)$. (Hungary) G6. Let $I$ be the incentre of acute-angled triangle $A B C$. Let the incircle meet $B C, C A$, and $A B$ at $D, E$, and $F$, respectively. Let line $E F$ intersect the circumcircle of the triangle at $P$ and $Q$, such that $F$ lies between $E$ and $P$. Prove that $\angle D P A+\angle A Q D=\angle Q I P$. (Slovakia) G7. The incircle $\omega$ of acute-angled scalene triangle $A B C$ has centre $I$ and meets sides $B C$, $C A$, and $A B$ at $D, E$, and $F$, respectively. The line through $D$ perpendicular to $E F$ meets $\omega$ again at $R$. Line $A R$ meets $\omega$ again at $P$. The circumcircles of triangles $P C E$ and $P B F$ meet again at $Q \neq P$. Prove that lines $D I$ and $P Q$ meet on the external bisector of angle $B A C$. (India) G8. Let $\mathcal{L}$ be the set of all lines in the plane and let $f$ be a function that assigns to each line $\ell \in \mathcal{L}$ a point $f(\ell)$ on $\ell$. Suppose that for any point $X$, and for any three lines $\ell_{1}, \ell_{2}, \ell_{3}$ passing through $X$, the points $f\left(\ell_{1}\right), f\left(\ell_{2}\right), f\left(\ell_{3}\right)$ and $X$ lie on a circle.

Prove that there is a unique point $P$ such that $f(\ell)=P$ for any line $\ell$ passing through $P$. (Australia)

Number Theory

N1. Find all pairs $(m, n)$ of positive integers satisfying the equation

(2n1)(2n2)(2n4)(2n2n1)=m! \left(2^{n}-1\right)\left(2^{n}-2\right)\left(2^{n}-4\right) \cdots\left(2^{n}-2^{n-1}\right)=m!

(El Salvador) N2. Find all triples $(a, b, c)$ of positive integers such that $a^{3}+b^{3}+c^{3}=(a b c)^{2}$. (Nigeria) N3. We say that a set $S$ of integers is rootiful if, for any positive integer $n$ and any $a_{0}, a_{1}, \ldots, a_{n} \in S$, all integer roots of the polynomial $a_{0}+a_{1} x+\cdots+a_{n} x^{n}$ are also in $S$. Find all rootiful sets of integers that contain all numbers of the form $2^{a}-2^{b}$ for positive integers $a$ and $b$. (Czech Republic) N4. Let $\mathbb{Z}{>0}$ be the set of positive integers. A positive integer constant $C$ is given. Find all functions $f: \mathbb{Z}{>0} \rightarrow \mathbb{Z}_{>0}$ such that, for all positive integers $a$ and $b$ satisfying $a+b>C$,

a+f(b)a2+bf(a) a+f(b) \mid a^{2}+b f(a)

(Croatia) N5. Let $a$ be a positive integer. We say that a positive integer $b$ is $a$-good if $\binom{a n}{b}-1$ is divisible by $a n+1$ for all positive integers $n$ with $a n \geqslant b$. Suppose $b$ is a positive integer such that $b$ is $a$-good, but $b+2$ is not $a$-good. Prove that $b+1$ is prime. (Netherlands) N6. Let $H=\left{\lfloor i \sqrt{2}\rfloor: i \in \mathbb{Z}{>0}\right}={1,2,4,5,7, \ldots}$, and let $n$ be a positive integer. Prove that there exists a constant $C$ such that, if $A \subset{1,2, \ldots, n}$ satisfies $|A| \geqslant C \sqrt{n}$, then there exist $a, b \in A$ such that $a-b \in H$. (Here $\mathbb{Z}{>0}$ is the set of positive integers, and $\lfloor z\rfloor$ denotes the greatest integer less than or equal to $z$.) (Brazil) N7. Prove that there is a constant $c>0$ and infinitely many positive integers $n$ with the following property: there are infinitely many positive integers that cannot be expressed as the sum of fewer than $c n \log (n)$ pairwise coprime $n^{\text {th }}$ powers. (Canada)

N8.

Let $a$ and $b$ be two positive integers. Prove that the integer

a2+4a2b a^{2}+\left\lceil\frac{4 a^{2}}{b}\right\rceil

is not a square. (Here $\lceil z\rceil$ denotes the least integer greater than or equal to $z$.)

Solutions

Algebra

A1. Let $\mathbb{Z}$ be the set of integers. Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that, for all integers $a$ and $b$,

f(2a)+2f(b)=f(f(a+b)) f(2 a)+2 f(b)=f(f(a+b))

(South Africa) Answer: The solutions are $f(n)=0$ and $f(n)=2 n+K$ for any constant $K \in \mathbb{Z}$. Common remarks. Most solutions to this problem first prove that $f$ must be linear, before determining all linear functions satisfying (1).

Solution 1. Substituting $a=0, b=n+1$ gives $f(f(n+1))=f(0)+2 f(n+1)$. Substituting $a=1, b=n$ gives $f(f(n+1))=f(2)+2 f(n)$.

In particular, $f(0)+2 f(n+1)=f(2)+2 f(n)$, and so $f(n+1)-f(n)=\frac{1}{2}(f(2)-f(0))$. Thus $f(n+1)-f(n)$ must be constant. Since $f$ is defined only on $\mathbb{Z}$, this tells us that $f$ must be a linear function; write $f(n)=M n+K$ for arbitrary constants $M$ and $K$, and we need only determine which choices of $M$ and $K$ work.

Now, (1) becomes

2Ma+K+2(Mb+K)=M(M(a+b)+K)+K 2 M a+K+2(M b+K)=M(M(a+b)+K)+K

which we may rearrange to form

(M2)(M(a+b)+K)=0 (M-2)(M(a+b)+K)=0

Thus, either $M=2$, or $M(a+b)+K=0$ for all values of $a+b$. In particular, the only possible solutions are $f(n)=0$ and $f(n)=2 n+K$ for any constant $K \in \mathbb{Z}$, and these are easily seen to work.

Solution 2. Let $K=f(0)$. First, put $a=0$ in (1); this gives

f(f(b))=2f(b)+K f(f(b))=2 f(b)+K

for all $b \in \mathbb{Z}$. Now put $b=0$ in (1); this gives

f(2a)+2K=f(f(a))=2f(a)+K f(2 a)+2 K=f(f(a))=2 f(a)+K

where the second equality follows from (2). Consequently,

f(2a)=2f(a)K f(2 a)=2 f(a)-K

for all $a \in \mathbb{Z}$. Substituting (2) and (3) into (1), we obtain

f(2a)+2f(b)=f(f(a+b))2f(a)K+2f(b)=2f(a+b)+Kf(a)+f(b)=f(a+b)+K \begin{aligned} f(2 a)+2 f(b) & =f(f(a+b)) \\ 2 f(a)-K+2 f(b) & =2 f(a+b)+K \\ f(a)+f(b) & =f(a+b)+K \end{aligned}

Thus, if we set $g(n)=f(n)-K$ we see that $g$ satisfies the Cauchy equation $g(a+b)=$ $g(a)+g(b)$. The solution to the Cauchy equation over $\mathbb{Z}$ is well-known; indeed, it may be proven by an easy induction that $g(n)=M n$ for each $n \in \mathbb{Z}$, where $M=g(1)$ is a constant.

Therefore, $f(n)=M n+K$, and we may proceed as in Solution 1 . Comment 1. Instead of deriving (3) by substituting $b=0$ into (1), we could instead have observed that the right hand side of (1) is symmetric in $a$ and $b$, and thus

f(2a)+2f(b)=f(2b)+2f(a) f(2 a)+2 f(b)=f(2 b)+2 f(a)

Thus, $f(2 a)-2 f(a)=f(2 b)-2 f(b)$ for any $a, b \in \mathbb{Z}$, and in particular $f(2 a)-2 f(a)$ is constant. Setting $a=0$ shows that this constant is equal to $-K$, and so we obtain (3).

Comment 2. Some solutions initially prove that $f(f(n))$ is linear (sometimes via proving that $f(f(n))-3 K$ satisfies the Cauchy equation). However, one can immediately prove that $f$ is linear by substituting something of the form $f(f(n))=M^{\prime} n+K^{\prime}$ into (2).

A2. Let $u_{1}, u_{2}, \ldots, u_{2019}$ be real numbers satisfying

u1+u2++u2019=0 and u12+u22++u20192=1 u_{1}+u_{2}+\cdots+u_{2019}=0 \quad \text { and } \quad u_{1}^{2}+u_{2}^{2}+\cdots+u_{2019}^{2}=1

Let $a=\min \left(u_{1}, u_{2}, \ldots, u_{2019}\right)$ and $b=\max \left(u_{1}, u_{2}, \ldots, u_{2019}\right)$. Prove that

ab12019 a b \leqslant-\frac{1}{2019}

(Germany) Solution 1. Notice first that $b>0$ and $a<0$. Indeed, since $\sum_{i=1}^{2019} u_{i}^{2}=1$, the variables $u_{i}$ cannot be all zero, and, since $\sum_{i=1}^{2019} u_{i}=0$, the nonzero elements cannot be all positive or all negative.

Let $P=\left{i: u_{i}>0\right}$ and $N=\left{i: u_{i} \leqslant 0\right}$ be the indices of positive and nonpositive elements in the sequence, and let $p=|P|$ and $n=|N|$ be the sizes of these sets; then $p+n=2019$. By the condition $\sum_{i=1}^{2019} u_{i}=0$ we have $0=\sum_{i=1}^{2019} u_{i}=\sum_{i \in P} u_{i}-\sum_{i \in N}\left|u_{i}\right|$, so

iPui=iNui. \sum_{i \in P} u_{i}=\sum_{i \in N}\left|u_{i}\right| .

After this preparation, estimate the sum of squares of the positive and nonpositive elements as follows:

iPui2iPbui=biPui=biNuibiNa=nab;iNui2iNaui=aiNui=aiPuiaiPb=pab. \begin{aligned} & \sum_{i \in P} u_{i}^{2} \leqslant \sum_{i \in P} b u_{i}=b \sum_{i \in P} u_{i}=b \sum_{i \in N}\left|u_{i}\right| \leqslant b \sum_{i \in N}|a|=-n a b ; \\ & \sum_{i \in N} u_{i}^{2} \leqslant \sum_{i \in N}|a| \cdot\left|u_{i}\right|=|a| \sum_{i \in N}\left|u_{i}\right|=|a| \sum_{i \in P} u_{i} \leqslant|a| \sum_{i \in P} b=-p a b . \end{aligned}

The sum of these estimates is

1=i=12019ui2=iPui2+iNui2(p+n)ab=2019ab; 1=\sum_{i=1}^{2019} u_{i}^{2}=\sum_{i \in P} u_{i}^{2}+\sum_{i \in N} u_{i}^{2} \leqslant-(p+n) a b=-2019 a b ;

that proves $a b \leqslant \frac{-1}{2019}$. Comment 1. After observing $\sum_{i \in P} u_{i}^{2} \leqslant b \sum_{i \in P} u_{i}$ and $\sum_{i \in N} u_{i}^{2} \leqslant|a| \sum_{i \in P}\left|u_{i}\right|$, instead of $(2,3)$ an alternative continuation is

abiPui2iPuiiNui2iNui=iPui2(iPui)2iNui21piNui2 |a b| \geqslant \frac{\sum_{i \in P} u_{i}^{2}}{\sum_{i \in P} u_{i}} \cdot \frac{\sum_{i \in N} u_{i}^{2}}{\sum_{i \in N}\left|u_{i}\right|}=\frac{\sum_{i \in P} u_{i}^{2}}{\left(\sum_{i \in P} u_{i}\right)^{2}} \sum_{i \in N} u_{i}^{2} \geqslant \frac{1}{p} \sum_{i \in N} u_{i}^{2}

(by the AM-QM or the Cauchy-Schwarz inequality) and similarly $|a b| \geqslant \frac{1}{n} \sum_{i \in P} u_{i}^{2}$. Solution 2. As in the previous solution we conclude that $a<0$ and $b>0$. For every index $i$, the number $u_{i}$ is a convex combination of $a$ and $b$, so

ui=xia+yib with some weights 0xi,yi1, with xi+yi=1 u_{i}=x_{i} a+y_{i} b \quad \text { with some weights } 0 \leqslant x_{i}, y_{i} \leqslant 1, \text { with } x_{i}+y_{i}=1 \text {. }

Let $X=\sum_{i=1}^{2019} x_{i}$ and $Y=\sum_{i=1}^{2019} y_{i}$. From $0=\sum_{i=1}^{2019} u_{i}=\sum_{i=1}^{2019}\left(x_{i} a+y_{i} b\right)=-|a| X+b Y$, we get

aX=bY |a| X=b Y

From $\sum_{i=1}^{2019}\left(x_{i}+y_{i}\right)=2019$ we have

X+Y=2019 X+Y=2019

The system of linear equations $(4,5)$ has a unique solution:

X=2019ba+b,Y=2019aa+b X=\frac{2019 b}{|a|+b}, \quad Y=\frac{2019|a|}{|a|+b}

Now apply the following estimate to every $u_{i}^{2}$ in their sum:

ui2=xi2a2+2xiyiab+yi2b2xia2+yib2 u_{i}^{2}=x_{i}^{2} a^{2}+2 x_{i} y_{i} a b+y_{i}^{2} b^{2} \leqslant x_{i} a^{2}+y_{i} b^{2}

we obtain that

1=i=12019ui2i=12019(xia2+yib2)=Xa2+Yb2=2019ba+ba2+2019aa+bb2=2019ab=2019ab. 1=\sum_{i=1}^{2019} u_{i}^{2} \leqslant \sum_{i=1}^{2019}\left(x_{i} a^{2}+y_{i} b^{2}\right)=X a^{2}+Y b^{2}=\frac{2019 b}{|a|+b}|a|^{2}+\frac{2019|a|}{|a|+b} b^{2}=2019|a| b=-2019 a b .

Hence, $a b \leqslant \frac{-1}{2019}$. Comment 2. The idea behind Solution 2 is the following thought. Suppose we fix $a<0$ and $b>0$, fix $\sum u_{i}=0$ and vary the $u_{i}$ to achieve the maximum value of $\sum u_{i}^{2}$. Considering varying any two of the $u_{i}$ while preserving their sum: the maximum value of $\sum u_{i}^{2}$ is achieved when those two are as far apart as possible, so all but at most one of the $u_{i}$ are equal to $a$ or $b$. Considering a weighted version of the problem, we see the maximum (with fractional numbers of $u_{i}$ having each value) is achieved when $\frac{2019 b}{|a|+b}$ of them are $a$ and $\frac{2019|a|}{|a|+b}$ are $b$.

In fact, this happens in the solution: the number $u_{i}$ is replaced by $x_{i}$ copies of $a$ and $y_{i}$ copies of $b$.

A3. Let $n \geqslant 3$ be a positive integer and let $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ be a strictly increasing sequence of $n$ positive real numbers with sum equal to 2 . Let $X$ be a subset of ${1,2, \ldots, n}$ such that the value of

1iXai \left|1-\sum_{i \in X} a_{i}\right|

is minimised. Prove that there exists a strictly increasing sequence of $n$ positive real numbers $\left(b_{1}, b_{2}, \ldots, b_{n}\right)$ with sum equal to 2 such that

iXbi=1 \sum_{i \in X} b_{i}=1

(New Zealand) Common remarks. In all solutions, we say an index set $X$ is $\left(a_{i}\right)$-minimising if it has the property in the problem for the given sequence $\left(a_{i}\right)$. Write $X^{c}$ for the complement of $X$, and $[a, b]$ for the interval of integers $k$ such that $a \leqslant k \leqslant b$. Note that

1iXai=1iXcai, \left|1-\sum_{i \in X} a_{i}\right|=\left|1-\sum_{i \in X^{c}} a_{i}\right|,

so we may exchange $X$ and $X^{c}$ where convenient. Let

Δ=iXcaiiXai \Delta=\sum_{i \in X^{c}} a_{i}-\sum_{i \in X} a_{i}

and note that $X$ is $\left(a_{i}\right)$-minimising if and only if it minimises $|\Delta|$, and that $\sum_{i \in X} a_{i}=1$ if and only if $\Delta=0$.

In some solutions, a scaling process is used. If we have a strictly increasing sequence of positive real numbers $c_{i}$ (typically obtained by perturbing the $a_{i}$ in some way) such that

iXci=iXcci \sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}

then we may put $b_{i}=2 c_{i} / \sum_{j=1}^{n} c_{j}$. So it suffices to construct such a sequence without needing its sum to be 2 .

The solutions below show various possible approaches to the problem. Solutions 1 and 2 perturb a few of the $a_{i}$ to form the $b_{i}$ (with scaling in the case of Solution 1, without scaling in the case of Solution 2). Solutions 3 and 4 look at properties of the index set $X$. Solution 3 then perturbs many of the $a_{i}$ to form the $b_{i}$, together with scaling. Rather than using such perturbations, Solution 4 constructs a sequence $\left(b_{i}\right)$ directly from the set $X$ with the required properties. Solution 4 can be used to give a complete description of sets $X$ that are $\left(a_{i}\right)$-minimising for some $\left(a_{i}\right)$.

Solution 1. Without loss of generality, assume $\sum_{i \in X} a_{i} \leqslant 1$, and we may assume strict inequality as otherwise $b_{i}=a_{i}$ works. Also, $X$ clearly cannot be empty.

If $n \in X$, add $\Delta$ to $a_{n}$, producing a sequence of $c_{i}$ with $\sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}$, and then scale as described above to make the sum equal to 2 . Otherwise, there is some $k$ with $k \in X$ and $k+1 \in X^{c}$. Let $\delta=a_{k+1}-a_{k}$.

  • If $\delta>\Delta$, add $\Delta$ to $a_{k}$ and then scale.
  • If $\delta<\Delta$, then considering $X \cup{k+1} \backslash{k}$ contradicts $X$ being $\left(a_{i}\right)$-minimising.
  • If $\delta=\Delta$, choose any $j \neq k, k+1$ (possible since $n \geqslant 3$ ), and any $\epsilon$ less than the least of $a_{1}$ and all the differences $a_{i+1}-a_{i}$. If $j \in X$ then add $\Delta-\epsilon$ to $a_{k}$ and $\epsilon$ to $a_{j}$, then scale; otherwise, add $\Delta$ to $a_{k}$ and $\epsilon / 2$ to $a_{k+1}$, and subtract $\epsilon / 2$ from $a_{j}$, then scale.

Solution 2. This is similar to Solution 1, but without scaling. As in that solution, without loss of generality, assume $\sum_{i \in X} a_{i}<1$.

Suppose there exists $1 \leqslant j \leqslant n-1$ such that $j \in X$ but $j+1 \in X^{c}$. Then $a_{j+1}-a_{j} \geqslant \Delta$, because otherwise considering $X \cup{j+1} \backslash{j}$ contradicts $X$ being $\left(a_{i}\right)$-minimising.

If $a_{j+1}-a_{j}>\Delta$, put

bi={aj+Δ/2, if i=jaj+1Δ/2, if i=j+1ai, otherwise  b_{i}= \begin{cases}a_{j}+\Delta / 2, & \text { if } i=j \\ a_{j+1}-\Delta / 2, & \text { if } i=j+1 \\ a_{i}, & \text { otherwise }\end{cases}

If $a_{j+1}-a_{j}=\Delta$, choose any $\epsilon$ less than the least of $\Delta / 2, a_{1}$ and all the differences $a_{i+1}-a_{i}$. If $|X| \geqslant 2$, choose $k \in X$ with $k \neq j$, and put

bi={aj+Δ/2ϵ, if i=jaj+1Δ/2, if i=j+1ak+ϵ, if i=kai, otherwise  b_{i}= \begin{cases}a_{j}+\Delta / 2-\epsilon, & \text { if } i=j \\ a_{j+1}-\Delta / 2, & \text { if } i=j+1 \\ a_{k}+\epsilon, & \text { if } i=k \\ a_{i}, & \text { otherwise }\end{cases}

Otherwise, $\left|X^{c}\right| \geqslant 2$, so choose $k \in X^{c}$ with $k \neq j+1$, and put

bi={aj+Δ/2, if i=jaj+1Δ/2+ϵ, if i=j+1akϵ, if i=kai, otherwise  b_{i}= \begin{cases}a_{j}+\Delta / 2, & \text { if } i=j \\ a_{j+1}-\Delta / 2+\epsilon, & \text { if } i=j+1 \\ a_{k}-\epsilon, & \text { if } i=k \\ a_{i}, & \text { otherwise }\end{cases}

If there is no $1 \leqslant j \leqslant n$ such that $j \in X$ but $j+1 \in X^{c}$, there must be some $1<k \leqslant n$ such that $X=[k, n]$ (certainly $X$ cannot be empty). We must have $a_{1}>\Delta$, as otherwise considering $X \cup{1}$ contradicts $X$ being $\left(a_{i}\right)$-minimising. Now put

bi={a1Δ/2, if i=1an+Δ/2, if i=nai, otherwise  b_{i}= \begin{cases}a_{1}-\Delta / 2, & \text { if } i=1 \\ a_{n}+\Delta / 2, & \text { if } i=n \\ a_{i}, & \text { otherwise }\end{cases}

Solution 3. Without loss of generality, assume $\sum_{i \in X} a_{i} \leqslant 1$, so $\Delta \geqslant 0$. If $\Delta=0$ we can take $b_{i}=a_{i}$, so now assume that $\Delta>0$.

Suppose that there is some $k \leqslant n$ such that $|X \cap[k, n]|>\left|X^{c} \cap[k, n]\right|$. If we choose the largest such $k$ then $|X \cap[k, n]|-\left|X^{c} \cap[k, n]\right|=1$. We can now find the required sequence $\left(b_{i}\right)$ by starting with $c_{i}=a_{i}$ for $i<k$ and $c_{i}=a_{i}+\Delta$ for $i \geqslant k$, and then scaling as described above.

If no such $k$ exists, we will derive a contradiction. For each $i \in X$ we can choose $i<j_{i} \leqslant n$ in such a way that $j_{i} \in X^{c}$ and all the $j_{i}$ are different. (For instance, note that necessarily $n \in X^{c}$ and now just work downwards; each time an $i \in X$ is considered, let $j_{i}$ be the least element of $X^{c}$ greater than $i$ and not yet used.) Let $Y$ be the (possibly empty) subset of $[1, n]$ consisting of those elements in $X^{c}$ that are also not one of the $j_{i}$. In any case

Δ=iX(ajiai)+jYaj \Delta=\sum_{i \in X}\left(a_{j_{i}}-a_{i}\right)+\sum_{j \in Y} a_{j}

where each term in the sums is positive. Since $n \geqslant 3$ the total number of terms above is at least two. Take a least such term and its corresponding index $i$ and consider the set $Z$ which we form from $X$ by removing $i$ and adding $j_{i}$ (if it is a term of the first type) or just by adding $j$ if it is a term of the second type. The corresponding expression of $\Delta$ for $Z$ has the sign of its least term changed, meaning that the sum is still nonnegative but strictly less than $\Delta$, which contradicts $X$ being $\left(a_{i}\right)$-minimising.

Solution 4. This uses some similar ideas to Solution 3, but describes properties of the index sets $X$ that are sufficient to describe a corresponding sequence $\left(b_{i}\right)$ that is not derived from $\left(a_{i}\right)$.

Note that, for two subsets $X, Y$ of $[1, n]$, the following are equivalent:

  • $|X \cap[i, n]| \leqslant|Y \cap[i, n]|$ for all $1 \leqslant i \leqslant n$;
  • $Y$ is at least as large as $X$, and for all $1 \leqslant j \leqslant|Y|$, the $j^{\text {th }}$ largest element of $Y$ is at least as big as the $j^{\text {th }}$ largest element of $X$;
  • there is an injective function $f: X \rightarrow Y$ such that $f(i) \geqslant i$ for all $i \in X$.

If these equivalent conditions are satisfied, we write $X \leq Y$. We write $X<Y$ if $X \leq Y$ and $X \neq Y$.

Note that if $X<Y$, then $\sum_{i \in X} a_{i}<\sum_{i \in Y} a_{i}$ (the second description above makes this clear). We claim first that, if $n \geqslant 3$ and $X \prec X^{c}$, then there exists $Y$ with $X \prec Y<X^{c}$. Indeed, as $|X| \leqslant\left|X^{c}\right|$, we have $\left|X^{c}\right| \geqslant 2$. Define $Y$ to consist of the largest element of $X^{c}$, together with all but the largest element of $X$; it is clear both that $Y$ is distinct from $X$ and $X^{c}$, and that $X \leq Y \leq X^{c}$, which is what we need.

But, in this situation, we have

iXai<iYai<iXcai and 1iXai=(1iXcai), \sum_{i \in X} a_{i}<\sum_{i \in Y} a_{i}<\sum_{i \in X^{c}} a_{i} \quad \text { and } \quad 1-\sum_{i \in X} a_{i}=-\left(1-\sum_{i \in X^{c}} a_{i}\right),

so $\left|1-\sum_{i \in Y} a_{i}\right|<\left|1-\sum_{i \in X} a_{i}\right|$. Hence if $X$ is $\left(a_{i}\right)$-minimising, we do not have $X \prec X^{c}$, and similarly we do not have $X^{c}<X$.

Considering the first description above, this immediately implies the following Claim. Claim. There exist $1 \leqslant k, \ell \leqslant n$ such that $|X \cap[k, n]|>\frac{n-k+1}{2}$ and $|X \cap[\ell, n]|<\frac{n-\ell+1}{2}$. We now construct our sequence $\left(b_{i}\right)$ using this claim. Let $k$ and $\ell$ be the greatest values satisfying the claim, and without loss of generality suppose $k=n$ and $\ell<n$ (otherwise replace $X$ by its complement). As $\ell$ is maximal, $n-\ell$ is even and $|X \cap[\ell, n]|=\frac{n-\ell}{2}$. For sufficiently small positive $\epsilon$, we take

bi=iϵ+{0, if i<δ, if in1γ, if i=n b_{i}=i \epsilon+ \begin{cases}0, & \text { if } i<\ell \\ \delta, & \text { if } \ell \leqslant i \leqslant n-1 \\ \gamma, & \text { if } i=n\end{cases}

Let $M=\sum_{i \in X} i$. So we require

Mϵ+(n21)δ+γ=1 M \epsilon+\left(\frac{n-\ell}{2}-1\right) \delta+\gamma=1

and

n(n+1)2ϵ+(n)δ+γ=2 \frac{n(n+1)}{2} \epsilon+(n-\ell) \delta+\gamma=2

These give

γ=2δ+(n(n+1)22M)ϵ \gamma=2 \delta+\left(\frac{n(n+1)}{2}-2 M\right) \epsilon

and for sufficiently small positive $\epsilon$, solving for $\gamma$ and $\delta$ gives $0<\delta<\gamma$ (since $\epsilon=0$ gives $\delta=1 /\left(\frac{n-\ell}{2}+1\right)$ and $\left.\gamma=2 \delta\right)$, so the sequence is strictly increasing and has positive values.

Comment. This solution also shows that the claim gives a complete description of sets $X$ that are $\left(a_{i}\right)$-minimising for some $\left(a_{i}\right)$.

Another approach to proving the claim is as follows. We prove the existence of $\ell$ with the claimed property; the existence of $k$ follows by considering the complement of $X$.

Suppose, for a contradiction, that for all $1 \leqslant \ell \leqslant n$ we have $|X \cap[\ell, n]| \geqslant\left\lceil\frac{n-\ell+1}{2}\right\rceil$. If we ever have strict inequality, consider the set $Y={n, n-2, n-4, \ldots}$. This set may be obtained from $X$ by possibly removing some elements and reducing the values of others. (To see this, consider the largest $k \in X \backslash Y$, if any; remove it, and replace it by the greatest $j \in X^{c}$ with $j<k$, if any. Such steps preserve the given inequality, and are possible until we reach the set $Y$.) So if we had strict inequality, and so $X \neq Y$, we have

iXai>iYai>1 \sum_{i \in X} a_{i}>\sum_{i \in Y} a_{i}>1

contradicting $X$ being $\left(a_{i}\right)$-minimising. Otherwise, we always have equality, meaning that $X=Y$. But now consider $Z=Y \cup{n-1} \backslash{n}$. Since $n \geqslant 3$, we have

iYai>iZai>iYcai=2iYai \sum_{i \in Y} a_{i}>\sum_{i \in Z} a_{i}>\sum_{i \in Y^{c}} a_{i}=2-\sum_{i \in Y} a_{i}

and so $Z$ contradicts $X$ being $\left(a_{i}\right)$-minimising.

A4. Let $n \geqslant 2$ be a positive integer and $a_{1}, a_{2}, \ldots, a_{n}$ be real numbers such that

a1+a2++an=0 a_{1}+a_{2}+\cdots+a_{n}=0

Define the set $A$ by

A={(i,j)1i<jn,aiaj1}. A=\left\{(i, j)\left|1 \leqslant i<j \leqslant n,\left|a_{i}-a_{j}\right| \geqslant 1\right\} .\right.

Prove that, if $A$ is not empty, then

(i,j)Aaiaj<0 \sum_{(i, j) \in A} a_{i} a_{j}<0

(China) Solution 1. Define sets $B$ and $C$ by

B={(i,j)1i,jn,aiaj1},C={(i,j)1i,jn,aiaj<1}. \begin{aligned} & B=\left\{(i, j)\left|1 \leqslant i, j \leqslant n,\left|a_{i}-a_{j}\right| \geqslant 1\right\},\right. \\ & C=\left\{(i, j)\left|1 \leqslant i, j \leqslant n,\left|a_{i}-a_{j}\right|<1\right\} .\right. \end{aligned}

We have

(i,j)Aaiaj=12(i,j)Baiaj(i,j)Baiaj=1i,jnaiaj(i,j)Baiaj=0(i,j)Caiaj. \begin{aligned} \sum_{(i, j) \in A} a_{i} a_{j} & =\frac{1}{2} \sum_{(i, j) \in B} a_{i} a_{j} \\ \sum_{(i, j) \in B} a_{i} a_{j} & =\sum_{1 \leqslant i, j \leqslant n} a_{i} a_{j}-\sum_{(i, j) \notin B} a_{i} a_{j}=0-\sum_{(i, j) \in C} a_{i} a_{j} . \end{aligned}

So it suffices to show that if $A$ (and hence $B$ ) are nonempty, then

(i,j)Caiaj>0 \sum_{(i, j) \in C} a_{i} a_{j}>0

Partition the indices into sets $P, Q, R$, and $S$ such that

P={iai1}R={i0<ai<1}Q={i1<ai0}S={i1ai}. \begin{aligned} P & =\left\{i \mid a_{i} \leqslant-1\right\} & R & =\left\{i \mid 0<a_{i}<1\right\} \\ Q & =\left\{i \mid-1<a_{i} \leqslant 0\right\} & S & =\left\{i \mid 1 \leqslant a_{i}\right\} . \end{aligned}

Then

(i,j)CaiajiPSai2+i,jQRaiaj=iPSai2+(iQRai)20. \sum_{(i, j) \in C} a_{i} a_{j} \geqslant \sum_{i \in P \cup S} a_{i}^{2}+\sum_{i, j \in Q \cup R} a_{i} a_{j}=\sum_{i \in P \cup S} a_{i}^{2}+\left(\sum_{i \in Q \cup R} a_{i}\right)^{2} \geqslant 0 .

The first inequality holds because all of the positive terms in the RHS are also in the LHS, and all of the negative terms in the LHS are also in the RHS. The first inequality attains equality only if both sides have the same negative terms, which implies $\left|a_{i}-a_{j}\right|<1$ whenever $i, j \in Q \cup R$; the second inequality attains equality only if $P=S=\varnothing$. But then we would have $A=\varnothing$. So $A$ nonempty implies that the inequality holds strictly, as required. Solution 2. Consider $P, Q, R, S$ as in Solution 1, set

p=iPai,q=iQai,r=iRai,s=iSai, p=\sum_{i \in P} a_{i}, \quad q=\sum_{i \in Q} a_{i}, \quad r=\sum_{i \in R} a_{i}, \quad s=\sum_{i \in S} a_{i},

and let

t+=(i,j)A,aiaj0aiaj,t=(i,j)A,aiaj0aiaj. t_{+}=\sum_{(i, j) \in A, a_{i} a_{j} \geqslant 0} a_{i} a_{j}, \quad t_{-}=\sum_{(i, j) \in A, a_{i} a_{j} \leqslant 0} a_{i} a_{j} .

We know that $p+q+r+s=0$, and we need to prove that $t_{+}+t_{-}<0$. Notice that $t_{+} \leqslant p^{2} / 2+p q+r s+s^{2} / 2$ (with equality only if $p=s=0$ ), and $t_{-} \leqslant p r+p s+q s$ (with equality only if there do not exist $i \in Q$ and $j \in R$ with $a_{j}-a_{i}>1$ ). Therefore,

t++tp2+s22+pq+rs+pr+ps+qs=(p+q+r+s)22(q+r)22=(q+r)220 t_{+}+t_{-} \leqslant \frac{p^{2}+s^{2}}{2}+p q+r s+p r+p s+q s=\frac{(p+q+r+s)^{2}}{2}-\frac{(q+r)^{2}}{2}=-\frac{(q+r)^{2}}{2} \leqslant 0

If $A$ is not empty and $p=s=0$, then there must exist $i \in Q, j \in R$ with $\left|a_{i}-a_{j}\right|>1$, and hence the earlier equality conditions cannot both occur.

Comment. The RHS of the original inequality cannot be replaced with any constant $c<0$ (independent of $n$ ). Indeed, take

a1=nn+2,a2==an1=1n+2,an=2n+2. a_{1}=-\frac{n}{n+2}, a_{2}=\cdots=a_{n-1}=\frac{1}{n+2}, a_{n}=\frac{2}{n+2} .

Then $\sum_{(i, j) \in A} a_{i} a_{j}=-\frac{2 n}{(n+2)^{2}}$, which converges to zero as $n \rightarrow \infty$.

This page is intentionally left blank

A5. Let $x_{1}, x_{2}, \ldots, x_{n}$ be different real numbers. Prove that

1inji1xixjxixj={0, if n is even 1, if n is odd  \sum_{1 \leqslant i \leqslant n} \prod_{j \neq i} \frac{1-x_{i} x_{j}}{x_{i}-x_{j}}= \begin{cases}0, & \text { if } n \text { is even } \\ 1, & \text { if } n \text { is odd }\end{cases}

(Kazakhstan) Common remarks. Let $G\left(x_{1}, x_{2}, \ldots, x_{n}\right)$ be the function of the $n$ variables $x_{1}, x_{2}, \ldots, x_{n}$ on the LHS of the required identity.

Solution 1 (Lagrange interpolation). Since both sides of the identity are rational functions, it suffices to prove it when all $x_{i} \notin{ \pm 1}$. Define

f(t)=i=1n(1xit) f(t)=\prod_{i=1}^{n}\left(1-x_{i} t\right)

and note that

f(xi)=(1xi2)ji1xixj f\left(x_{i}\right)=\left(1-x_{i}^{2}\right) \prod_{j \neq i} 1-x_{i} x_{j}

Using the nodes $+1,-1, x_{1}, \ldots, x_{n}$, the Lagrange interpolation formula gives us the following expression for $f$ :

i=1nf(xi)(x1)(x+1)(xi1)(xi+1)jixxjxixj+f(1)x+11+11inxxi1xi+f(1)x1111inxxi1xi \sum_{i=1}^{n} f\left(x_{i}\right) \frac{(x-1)(x+1)}{\left(x_{i}-1\right)\left(x_{i}+1\right)} \prod_{j \neq i} \frac{x-x_{j}}{x_{i}-x_{j}}+f(1) \frac{x+1}{1+1} \prod_{1 \leqslant i \leqslant n} \frac{x-x_{i}}{1-x_{i}}+f(-1) \frac{x-1}{-1-1} \prod_{1 \leqslant i \leqslant n} \frac{x-x_{i}}{1-x_{i}}

The coefficient of $t^{n+1}$ in $f(t)$ is 0 , since $f$ has degree $n$. The coefficient of $t^{n+1}$ in the above expression of $f$ is

0=1inf(xi)ji(xixj)(xi1)(xi+1)+f(1)1jn(1xj)(1+1)+f(1)1jn(1xj)(11)=G(x1,,xn)+12+(1)n+12 \begin{aligned} 0 & =\sum_{1 \leqslant i \leqslant n} \frac{f\left(x_{i}\right)}{\prod_{j \neq i}\left(x_{i}-x_{j}\right) \cdot\left(x_{i}-1\right)\left(x_{i}+1\right)}+\frac{f(1)}{\prod_{1 \leqslant j \leqslant n}\left(1-x_{j}\right) \cdot(1+1)}+\frac{f(-1)}{\prod_{1 \leqslant j \leqslant n}\left(-1-x_{j}\right) \cdot(-1-1)} \\ & =-G\left(x_{1}, \ldots, x_{n}\right)+\frac{1}{2}+\frac{(-1)^{n+1}}{2} \end{aligned}

Comment. The main difficulty is to think of including the two extra nodes $\pm 1$ and evaluating the coefficient $t^{n+1}$ in $f$ when $n+1$ is higher than the degree of $f$.

It is possible to solve the problem using Lagrange interpolation on the nodes $x_{1}, \ldots, x_{n}$, but the definition of the polynomial being interpolated should depend on the parity of $n$. For $n$ even, consider the polynomial

P(x)=i(1xxi)i(xxi) P(x)=\prod_{i}\left(1-x x_{i}\right)-\prod_{i}\left(x-x_{i}\right)

Lagrange interpolation shows that $G$ is the coefficient of $x^{n-1}$ in the polynomial $P(x) /\left(1-x^{2}\right)$, i.e. 0 . For $n$ odd, consider the polynomial

P(x)=i(1xxi)xi(xxi) P(x)=\prod_{i}\left(1-x x_{i}\right)-x \prod_{i}\left(x-x_{i}\right)

Now $G$ is the coefficient of $x^{n-1}$ in $P(x) /\left(1-x^{2}\right)$, which is 1 .

Solution 2 (using symmetries). Observe that $G$ is symmetric in the variables $x_{1}, \ldots, x_{n}$. Define $V=\prod_{i<j}\left(x_{j}-x_{i}\right)$ and let $F=G \cdot V$, which is a polynomial in $x_{1}, \ldots, x_{n}$. Since $V$ is alternating, $F$ is also alternating (meaning that, if we exchange any two variables, then $F$ changes sign). Every alternating polynomial in $n$ variables $x_{1}, \ldots, x_{n}$ vanishes when any two variables $x_{i}, x_{j}(i \neq j)$ are equal, and is therefore divisible by $x_{i}-x_{j}$ for each pair $i \neq j$. Since these linear factors are pairwise coprime, $V$ divides $F$ exactly as a polynomial. Thus $G$ is in fact a symmetric polynomial in $x_{1}, \ldots, x_{n}$.

Now observe that if all $x_{i}$ are nonzero and we set $y_{i}=1 / x_{i}$ for $i=1, \ldots, n$, then we have

1yiyjyiyj=1xixjxixj \frac{1-y_{i} y_{j}}{y_{i}-y_{j}}=\frac{1-x_{i} x_{j}}{x_{i}-x_{j}}

so that

G(1x1,,1xn)=G(x1,,xn). G\left(\frac{1}{x_{1}}, \ldots, \frac{1}{x_{n}}\right)=G\left(x_{1}, \ldots, x_{n}\right) .

By continuity this is an identity of rational functions. Since $G$ is a polynomial, it implies that $G$ is constant. (If $G$ were not constant, we could choose a point $\left(c_{1}, \ldots, c_{n}\right)$ with all $c_{i} \neq 0$, such that $G\left(c_{1}, \ldots, c_{n}\right) \neq G(0, \ldots, 0)$; then $g(x):=G\left(c_{1} x, \ldots, c_{n} x\right)$ would be a nonconstant polynomial in the variable $x$, so $|g(x)| \rightarrow \infty$ as $x \rightarrow \infty$, hence $\left|G\left(\frac{y}{c_{1}}, \ldots, \frac{y}{c_{n}}\right)\right| \rightarrow \infty$ as $y \rightarrow 0$, which is impossible since $G$ is a polynomial.)

We may identify the constant by substituting $x_{i}=\zeta^{i}$, where $\zeta$ is a primitive $n^{\text {th }}$ root of unity in $\mathbb{C}$. In the $i^{\text {th }}$ term in the sum in the original expression we have a factor $1-\zeta^{i} \zeta^{n-i}=0$, unless $i=n$ or $2 i=n$. In the case where $n$ is odd, the only exceptional term is $i=n$, which gives the value $\prod_{j \neq n} \frac{1-\zeta^{j}}{1-\zeta^{j}}=1$. When $n$ is even, we also have the term $\prod_{j \neq \frac{n}{2}} \frac{1+\zeta^{j}}{-1-\zeta^{j}}=(-1)^{n-1}=-1$, so the sum is 0 .

Comment. If we write out an explicit expression for $F$,

F=1in(1)nij<kj,ki(xkxj)ji(1xixj) F=\sum_{1 \leqslant i \leqslant n}(-1)^{n-i} \prod_{\substack{j<k \\ j, k \neq i}}\left(x_{k}-x_{j}\right) \prod_{j \neq i}\left(1-x_{i} x_{j}\right)

then to prove directly that $F$ vanishes when $x_{i}=x_{j}$ for some $i \neq j$, but no other pair of variables coincide, we have to check carefully that the two nonzero terms in this sum cancel.

A different and slightly less convenient way to identify the constant is to substitute $x_{i}=1+\epsilon \zeta^{i}$, and throw away terms that are $O(\epsilon)$ as $\epsilon \rightarrow 0$.

Solution 3 (breaking symmetry). Consider $G$ as a rational function in $x_{n}$ with coefficients that are rational functions in the other variables. We can write

G(x1,,xn)=P(xn)jn(xnxj) G\left(x_{1}, \ldots, x_{n}\right)=\frac{P\left(x_{n}\right)}{\prod_{j \neq n}\left(x_{n}-x_{j}\right)}

where $P\left(x_{n}\right)$ is a polynomial in $x_{n}$ whose coefficients are rational functions in the other variables. We then have

P(xn)=(jn(1xnxj))+1in1(xixn1)(ji,n(xnxj))(ji,n1xixjxixj). P\left(x_{n}\right)=\left(\prod_{j \neq n}\left(1-x_{n} x_{j}\right)\right)+\sum_{1 \leqslant i \leqslant n-1}\left(x_{i} x_{n}-1\right)\left(\prod_{j \neq i, n}\left(x_{n}-x_{j}\right)\right)\left(\prod_{j \neq i, n} \frac{1-x_{i} x_{j}}{x_{i}-x_{j}}\right) .

For any $k \neq n$, substituting $x_{n}=x_{k}$ (which is valid when manipulating the numerator $P\left(x_{n}\right)$ on its own), we have (noting that $x_{n}-x_{j}$ vanishes when $j=k$ )

P(xk)=(jn(1xkxj))+1in1(xixk1)(ji,n(xkxj))(ji,n1xixjxixj)=(jn(1xkxj))+(xk21)(jk,n(xkxj))(jk,n1xkxjxkxj)=(jn(1xkxj))+(xk21)(jk,n(1xkxj))=0. \begin{aligned} P\left(x_{k}\right) & =\left(\prod_{j \neq n}\left(1-x_{k} x_{j}\right)\right)+\sum_{1 \leqslant i \leqslant n-1}\left(x_{i} x_{k}-1\right)\left(\prod_{j \neq i, n}\left(x_{k}-x_{j}\right)\right)\left(\prod_{j \neq i, n} \frac{1-x_{i} x_{j}}{x_{i}-x_{j}}\right) \\ & =\left(\prod_{j \neq n}\left(1-x_{k} x_{j}\right)\right)+\left(x_{k}^{2}-1\right)\left(\prod_{j \neq k, n}\left(x_{k}-x_{j}\right)\right)\left(\prod_{j \neq k, n} \frac{1-x_{k} x_{j}}{x_{k}-x_{j}}\right) \\ & =\left(\prod_{j \neq n}\left(1-x_{k} x_{j}\right)\right)+\left(x_{k}^{2}-1\right)\left(\prod_{j \neq k, n}\left(1-x_{k} x_{j}\right)\right) \\ & =0 . \end{aligned}

Note that $P$ is a polynomial in $x_{n}$ of degree $n-1$. For any choice of distinct real numbers $x_{1}, \ldots, x_{n-1}, P$ has those real numbers as its roots, and the denominator has the same degree and the same roots. This shows that $G$ is constant in $x_{n}$, for any fixed choice of distinct $x_{1}, \ldots, x_{n-1}$. Now, $G$ is symmetric in all $n$ variables, so it must be also be constant in each of the other variables. $G$ is therefore a constant that depends only on $n$. The constant may be identified as in the previous solution.

Comment. There is also a solution in which we recognise the expression for $F$ in the comment after Solution 2 as the final column expansion of a certain matrix obtained by modifying the final column of the Vandermonde matrix. The task is then to show that the matrix can be modified by column operations either to make the final column identically zero (in the case where $n$ even) or to recover the Vandermonde matrix (in the case where $n$ odd). The polynomial $P /\left(1-x^{2}\right)$ is helpful for this task, where $P$ is the parity-dependent polynomial defined in the comment after Solution 1.

A6. A polynomial $P(x, y, z)$ in three variables with real coefficients satisfies the identities

P(x,y,z)=P(x,y,xyz)=P(x,zxy,z)=P(yzx,y,z). P(x, y, z)=P(x, y, x y-z)=P(x, z x-y, z)=P(y z-x, y, z) .

Prove that there exists a polynomial $F(t)$ in one variable such that

P(x,y,z)=F(x2+y2+z2xyz). P(x, y, z)=F\left(x^{2}+y^{2}+z^{2}-x y z\right) .

(Russia) Common remarks. The polynomial $x^{2}+y^{2}+z^{2}-x y z$ satisfies the condition (), so every polynomial of the form $F\left(x^{2}+y^{2}+z^{2}-x y z\right)$ does satisfy (). We will use without comment the fact that two polynomials have the same coefficients if and only if they are equal as functions.

Solution 1. In the first two steps, we deal with any polynomial $P(x, y, z)$ satisfying $P(x, y, z)=$ $P(x, y, x y-z)$. Call such a polynomial weakly symmetric, and call a polynomial satisfying the full conditions in the problem symmetric. Step 1. We start with the description of weakly symmetric polynomials. We claim that they are exactly the polynomials in $x, y$, and $z(x y-z)$. Clearly, all such polynomials are weakly symmetric. For the converse statement, consider $P_{1}(x, y, z):=P\left(x, y, z+\frac{1}{2} x y\right)$, which satisfies $P_{1}(x, y, z)=P_{1}(x, y,-z)$ and is therefore a polynomial in $x, y$, and $z^{2}$. This means that $P$ is a polynomial in $x, y$, and $\left(z-\frac{1}{2} x y\right)^{2}=-z(x y-z)+\frac{1}{4} x^{2} y^{2}$, and therefore a polynomial in $x, y$, and $z(x y-z)$. Step 2. Suppose that $P$ is weakly symmetric. Consider the monomials in $P(x, y, z)$ of highest total degree. Our aim is to show that in each such monomial $\mu x^{a} y^{b} z^{c}$ we have $a, b \geqslant c$. Consider the expansion

P(x,y,z)=i,j,kμijkxiyj(z(xyz))k P(x, y, z)=\sum_{i, j, k} \mu_{i j k} x^{i} y^{j}(z(x y-z))^{k}

The maximal total degree of a summand in (1.1) is $m=\max {i, j, k: \mu{i j k} \neq 0}(i+j+3 k)$. Now, for any $i, j, k$ satisfying $i+j+3 k=m$ the summand $\mu_{i, j, k} x^{i} y^{j}(z(x y-z))^{k}$ has leading term of the form $\mu x^{i+k} y^{j+k} z^{k}$. No other nonzero summand in (1.1) may have a term of this form in its expansion, hence this term does not cancel in the whole sum. Therefore, $\operatorname{deg} P=m$, and the leading component of $P$ is exactly

i+j+3k=mμi,j,kxi+kyj+kzk \sum_{i+j+3 k=m} \mu_{i, j, k} x^{i+k} y^{j+k} z^{k}

and each summand in this sum satisfies the condition claimed above. Step 3. We now prove the problem statement by induction on $m=\operatorname{deg} P$. For $m=0$ the claim is trivial. Consider now a symmetric polynomial $P$ with $\operatorname{deg} P>0$. By Step 2, each of its monomials $\mu x^{a} y^{b} z^{c}$ of the highest total degree satisfies $a, b \geqslant c$. Applying other weak symmetries, we obtain $a, c \geqslant b$ and $b, c \geqslant a$; therefore, $P$ has a unique leading monomial of the form $\mu(x y z)^{c}$. The polynomial $P_{0}(x, y, z)=P(x, y, z)-\mu\left(x y z-x^{2}-y^{2}-z^{2}\right)^{c}$ has smaller total degree. Since $P_{0}$ is symmetric, it is representable as a polynomial function of $x y z-x^{2}-y^{2}-z^{2}$. Then $P$ is also of this form, completing the inductive step.

Comment. We could alternatively carry out Step 1 by an induction on $n=\operatorname{deg}_{z} P$, in a manner similar to Step 3. If $n=0$, the statement holds. Assume that $n>0$ and check the leading component of $P$ with respect to $z$ :

P(x,y,z)=Qn(x,y)zn+R(x,y,z) P(x, y, z)=Q_{n}(x, y) z^{n}+R(x, y, z)

where $\operatorname{deg}{z} R<n$. After the change $z \mapsto x y-z$, the leading component becomes $Q{n}(x, y)(-z)^{n}$; on the other hand, it should remain the same. Hence $n$ is even. Now consider the polynomial

P0(x,y,z)=P(x,y,z)Qn(x,y)(z(zxy))n/2 P_{0}(x, y, z)=P(x, y, z)-Q_{n}(x, y) \cdot(z(z-x y))^{n / 2}

It is also weakly symmetric, and $\operatorname{deg}{z} P{0}<n$. By the inductive hypothesis, it has the form $P_{0}(x, y, z)=$ $S(x, y, z(z-x y))$. Hence the polynomial

P(x,y,z)=S(x,y,z(xyz))+Qn(x,y)(z(zxy))n/2 P(x, y, z)=S(x, y, z(x y-z))+Q_{n}(x, y)(z(z-x y))^{n / 2}

also has this form. This completes the inductive step. Solution 2. We will rely on the well-known identity

cos2u+cos2v+cos2w2cosucosvcosw1=0 whenever u+v+w=0 \cos ^{2} u+\cos ^{2} v+\cos ^{2} w-2 \cos u \cos v \cos w-1=0 \quad \text { whenever } u+v+w=0

Claim 1. The polynomial $P(x, y, z)$ is constant on the surface

S={(2cosu,2cosv,2cosw):u+v+w=0} \mathfrak{S}=\{(2 \cos u, 2 \cos v, 2 \cos w): u+v+w=0\}

Proof. Notice that for $x=2 \cos u, y=2 \cos v, z=2 \cos w$, the Vieta jumps $x \mapsto y z-x$, $y \mapsto z x-y, z \mapsto x y-z$ in (*) replace $(u, v, w)$ by $(v-w,-v, w),(u, w-u,-w)$ and $(-u, v, u-v)$, respectively. For example, for the first type of jump we have

yzx=4cosvcosw2cosu=2cos(v+w)+2cos(vw)2cosu=2cos(vw). y z-x=4 \cos v \cos w-2 \cos u=2 \cos (v+w)+2 \cos (v-w)-2 \cos u=2 \cos (v-w) .

Define $G(u, v, w)=P(2 \cos u, 2 \cos v, 2 \cos w)$. For $u+v+w=0$, the jumps give

G(u,v,w)=G(vw,v,w)=G(wv,v,(vw)(v))=G(u2v,v,2vw)=G(u+2v,v,w2v) \begin{aligned} G(u, v, w) & =G(v-w,-v, w)=G(w-v,-v,(v-w)-(-v))=G(-u-2 v,-v, 2 v-w) \\ & =G(u+2 v, v, w-2 v) \end{aligned}

By induction,

G(u,v,w)=G(u+2kv,v,w2kv)(kZ) G(u, v, w)=G(u+2 k v, v, w-2 k v) \quad(k \in \mathbb{Z})

Similarly,

G(u,v,w)=G(u,v2u,w+2u)(Z) G(u, v, w)=G(u, v-2 \ell u, w+2 \ell u) \quad(\ell \in \mathbb{Z})

And, of course, we have

G(u,v,w)=G(u+2pπ,v+2qπ,w2(p+q)π)(p,qZ) G(u, v, w)=G(u+2 p \pi, v+2 q \pi, w-2(p+q) \pi) \quad(p, q \in \mathbb{Z})

Take two nonzero real numbers $u, v$ such that $u, v$ and $\pi$ are linearly independent over $\mathbb{Q}$. By combining (2.2-2.4), we can see that $G$ is constant on a dense subset of the plane $u+v+w=0$. By continuity, $G$ is constant on the entire plane and therefore $P$ is constant on $\mathfrak{S}$. Claim 2. The polynomial $T(x, y, z)=x^{2}+y^{2}+z^{2}-x y z-4$ divides $P(x, y, z)-P(2,2,2)$. Proof. By dividing $P$ by $T$ with remainders, there exist some polynomials $R(x, y, z), A(y, z)$ and $B(y, z)$ such that

P(x,y,z)P(2,2,2)=T(x,y,z)R(x,y,z)+A(y,z)x+B(y,z) P(x, y, z)-P(2,2,2)=T(x, y, z) \cdot R(x, y, z)+A(y, z) x+B(y, z)

On the surface $\mathfrak{S}$ the LHS of (2.5) is zero by Claim 1 (since $(2,2,2) \in \mathfrak{S}$ ) and $T=0$ by (2.1). Hence, $A(y, z) x+B(y, z)$ vanishes on $\mathfrak{S}$.

Notice that for every $y=2 \cos v$ and $z=2 \cos w$ with $\frac{\pi}{3}<v, w<\frac{2 \pi}{3}$, there are two distinct values of $x$ such that $(x, y, z) \in \mathfrak{S}$, namely $x_{1}=2 \cos (v+w)$ (which is negative), and $x_{2}=2 \cos (v-w)$ (which is positive). This can happen only if $A(y, z)=B(y, z)=0$. Hence, $A(y, z)=B(y, z)=0$ for $|y|<1,|z|<1$. The polynomials $A$ and $B$ vanish on an open set, so $A$ and $B$ are both the zero polynomial.

The quotient $(P(x, y, z)-P(2,2,2)) / T(x, y, z)$ is a polynomial of lower degree than $P$ and it also satisfies (*). The problem statement can now be proven by induction on the degree of $P$.

Comment. In the proof of (2.2) and (2.3) we used two consecutive Vieta jumps; in fact from (*) we used only $P(x, y, x y-z)=P(x, z x-y, z)=P(y z-x, y, z)$.

Solution 3 (using algebraic geometry, just for interest). Let $Q=x^{2}+y^{2}+z^{2}-x y z$ and let $t \in \mathbb{C}$. Checking where $Q-t, \frac{\partial Q}{\partial x}, \frac{\partial Q}{\partial y}$ and $\frac{\partial Q}{\partial z}$ vanish simultaneously, we find that the surface $Q=t$ is smooth except for the cases $t=0$, when the only singular point is $(0,0,0)$, and $t=4$, when the four points $( \pm 2, \pm 2, \pm 2)$ that satisfy $x y z=8$ are the only singular points. The singular points are the fixed points of the group $\Gamma$ of polynomial automorphisms of $\mathbb{C}^{3}$ generated by the three Vieta involutions

ι1:(x,y,z)(x,y,xyz),ι2:(x,y,z)(x,xzy,z),ι3:(x,y,z)(yzx,y,z) \iota_{1}:(x, y, z) \mapsto(x, y, x y-z), \quad \iota_{2}:(x, y, z) \mapsto(x, x z-y, z), \quad \iota_{3}:(x, y, z) \mapsto(y z-x, y, z)

$\Gamma$ acts on each surface $\mathcal{V}{t}: Q-t=0$. If $Q-t$ were reducible then the surface $Q=t$ would contain a curve of singular points. Therefore $Q-t$ is irreducible in $\mathbb{C}[x, y, z]$. (One can also prove algebraically that $Q-t$ is irreducible, for example by checking that its discriminant as a quadratic polynomial in $x$ is not a square in $\mathbb{C}[y, z]$, and likewise for the other two variables.) In the following solution we will only use the algebraic surface $\mathcal{V}{0}$.

Let $U$ be the $\Gamma$-orbit of $(3,3,3)$. Consider $\iota_{3} \circ \iota_{2}$, which leaves $z$ invariant. For each fixed value of $z, \iota_{3} \circ \iota_{2}$ acts linearly on $(x, y)$ by the matrix

Mz:=(z21zz1) M_{z}:=\left(\begin{array}{cc} z^{2}-1 & -z \\ z & -1 \end{array}\right)

The reverse composition $\iota_{2} \circ \iota_{3}$ acts by $M_{z}^{-1}=M_{z}^{\text {adj }}$. Note det $M_{z}=1$ and $\operatorname{tr} M_{z}=z^{2}-2$. When $z$ does not lie in the real interval $[-2,2]$, the eigenvalues of $M_{z}$ do not have absolute value 1 , so every orbit of the group generated by $M_{z}$ on $\mathbb{C}^{2} \backslash{(0,0)}$ is unbounded. For example, fixing $z=3$ we find $\left(3 F_{2 k+1}, 3 F_{2 k-1}, 3\right) \in U$ for every $k \in \mathbb{Z}$, where $\left(F_{n}\right){n \in \mathbb{Z}}$ is the Fibonacci sequence with $F{0}=0, F_{1}=1$.

Now we may start at any point $\left(3 F_{2 k+1}, 3 F_{2 k-1}, 3\right)$ and iteratively apply $\iota_{1} \circ \iota_{2}$ to generate another infinite sequence of distinct points of $U$, Zariski dense in the hyperbola cut out of $\mathcal{V}{0}$ by the plane $x-3 F{2 k+1}=0$. (The plane $x=a$ cuts out an irreducible conic when $a \notin{-2,0,2}$.) Thus the Zariski closure $\bar{U}$ of $U$ contains infinitely many distinct algebraic curves in $\mathcal{V}{0}$. Since $\mathcal{V}{0}$ is an irreducible surface this implies that $\bar{U}=\mathcal{V}_{0}$.

For any polynomial $P$ satisfying (), we have $P-P(3,3,3)=0$ at each point of $U$. Since $\bar{U}=\mathcal{V}{0}, P-P(3,3,3)$ vanishes on $\mathcal{V}{0}$. Then Hilbert's Nullstellensatz and the irreducibility of $Q$ imply that $P-P(3,3,3)$ is divisible by $Q$. Now $(P-P(3,3,3)) / Q$ is a polynomial also satisfying (), so we may complete the proof by an induction on the total degree, as in the other solutions.

Comment. We remark that Solution 2 used a trigonometric parametrisation of a real component of $\mathcal{V}{4} ;$ in contrast $\mathcal{V}{0}$ is birationally equivalent to the projective space $\mathbb{P}^{2}$ under the maps

(x,y,z)(x:y:z),(a:b:c)(a2+b2+c2bc,a2+b2+c2ac,a2+b2+c2ab). (x, y, z) \rightarrow(x: y: z), \quad(a: b: c) \rightarrow\left(\frac{a^{2}+b^{2}+c^{2}}{b c}, \frac{a^{2}+b^{2}+c^{2}}{a c}, \frac{a^{2}+b^{2}+c^{2}}{a b}\right) .

The set $U$ in Solution 3 is contained in $\mathbb{Z}^{3}$ so it is nowhere dense in $\mathcal{V}_{0}$ in the classical topology. Comment (background to the problem). A triple $(a, b, c) \in \mathbb{Z}^{3}$ is called a Markov triple if $a^{2}+b^{2}+c^{2}=3 a b c$, and an integer that occurs as a coordinate of some Markov triple is called a Markov number. (The spelling Markoff is also frequent.) Markov triples arose in A. Markov's work in the 1870s on the reduction theory of indefinite binary quadratic forms. For every Markov triple, $(3 a, 3 b, 3 c)$ lies on $Q=0$. It is well known that all nonzero Markov triples can be generated from $(1,1,1)$ by sequences of Vieta involutions, which are the substitutions described in equation (*) in the problem statement. There has been recent work by number theorists about the properties of Markov numbers (see for example Jean Bourgain, Alex Gamburd and Peter Sarnak, Markoff triples and strong approximation, Comptes Rendus Math. 345, no. 2, 131-135 (2016), arXiv:1505.06411). Each Markov number occurs in infinitely many triples, but a famous old open problem is the unicity conjecture, which asserts that each Markov number occurs in only one Markov triple (up to permutations and sign changes) as the largest coordinate in absolute value in that triple. It is a standard fact in the modern literature on Markov numbers that the Markov triples are Zariski dense in the Markov surface. Proving this is the main work of Solution 3. Algebraic geometry is definitely off-syllabus for the IMO, and one still has to work a bit to prove the Zariski density. On the other hand the approaches of Solutions 1 and 2 are elementary and only use tools expected to be known by IMO contestants. Therefore we do not think that the existence of a solution using algebraic geometry necessarily makes this problem unsuitable for the IMO.

A7. Let $\mathbb{Z}$ be the set of integers. We consider functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ satisfying

f(f(x+y)+y)=f(f(x)+y) f(f(x+y)+y)=f(f(x)+y)

for all integers $x$ and $y$. For such a function, we say that an integer $v$ is $f$-rare if the set

Xv={xZ:f(x)=v} X_{v}=\{x \in \mathbb{Z}: f(x)=v\}

is finite and nonempty. (a) Prove that there exists such a function $f$ for which there is an $f$-rare integer. (b) Prove that no such function $f$ can have more than one $f$-rare integer. (Netherlands) Solution 1. a) Let $f$ be the function where $f(0)=0$ and $f(x)$ is the largest power of 2 dividing $2 x$ for $x \neq 0$. The integer 0 is evidently $f$-rare, so it remains to verify the functional equation.

Since $f(2 x)=2 f(x)$ for all $x$, it suffices to verify the functional equation when at least one of $x$ and $y$ is odd (the case $x=y=0$ being trivial). If $y$ is odd, then we have

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

since all the values attained by $f$ are even. If, on the other hand, $x$ is odd and $y$ is even, then we already have

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

from which the functional equation follows immediately. b) An easy inductive argument (substituting $x+k y$ for $x$ ) shows that

f(f(x+ky)+y)=f(f(x)+y) f(f(x+k y)+y)=f(f(x)+y)

for all integers $x, y$ and $k$. If $v$ is an $f$-rare integer and $a$ is the least element of $X_{v}$, then by substituting $y=a-f(x)$ in the above, we see that

f(x+k(af(x)))f(x)+aXv f(x+k \cdot(a-f(x)))-f(x)+a \in X_{v}

for all integers $x$ and $k$, so that in particular

f(x+k(af(x)))f(x) f(x+k \cdot(a-f(x))) \geqslant f(x)

for all integers $x$ and $k$, by assumption on $a$. This says that on the (possibly degenerate) arithmetic progression through $x$ with common difference $a-f(x)$, the function $f$ attains its minimal value at $x$.

Repeating the same argument with $a$ replaced by the greatest element $b$ of $X_{v}$ shows that

f(x+k(bf(x))f(x) f(x+k \cdot(b-f(x)) \leqslant f(x)

for all integers $x$ and $k$. Combined with the above inequality, we therefore have

f(x+k(af(x))(bf(x)))=f(x) f(x+k \cdot(a-f(x)) \cdot(b-f(x)))=f(x)

for all integers $x$ and $k$. Thus if $f(x) \neq a, b$, then the set $X_{f(x)}$ contains a nondegenerate arithmetic progression, so is infinite. So the only possible $f$-rare integers are $a$ and $b$.

In particular, the $f$-rare integer $v$ we started with must be one of $a$ or $b$, so that $f(v)=$ $f(a)=f(b)=v$. This means that there cannot be any other $f$-rare integers $v^{\prime}$, as they would on the one hand have to be either $a$ or $b$, and on the other would have to satisfy $f\left(v^{\prime}\right)=v^{\prime}$. Thus $v$ is the unique $f$-rare integer.

Comment 1. If $f$ is a solution to the functional equation, then so too is any conjugate of $f$ by a translation, i.e. any function $x \mapsto f(x+n)-n$ for an integer $n$. Thus in proving part (b), one is free to consider only functions $f$ for which 0 is $f$-rare, as in the following solution.

Solution 2, part (b) only. Suppose $v$ is $f$-rare, and let $a$ and $b$ be the least and greatest elements of $X_{v}$, respectively. Substituting $x=v$ and $y=a-v$ into the equation shows that

f(v)v+aXv f(v)-v+a \in X_{v}

and in particular $f(v) \geqslant v$. Repeating the same argument with $x=v$ and $y=b-v$ shows that $f(v) \leqslant v$, and hence $f(v)=v$.

Suppose now that $v^{\prime}$ is a second $f$-rare integer. We may assume that $v=0$ (see Comment 1 ). We've seen that $f\left(v^{\prime}\right)=v^{\prime}$; we claim that in fact $f\left(k v^{\prime}\right)=v^{\prime}$ for all positive integers $k$. This gives a contradiction unless $v^{\prime}=v=0$.

This claim is proved by induction on $k$. Supposing it to be true for $k$, we substitute $y=k v^{\prime}$ and $x=0$ into the functional equation to yield

f((k+1)v)=f(f(0)+kv)=f(kv)=v f\left((k+1) v^{\prime}\right)=f\left(f(0)+k v^{\prime}\right)=f\left(k v^{\prime}\right)=v^{\prime}

using that $f(0)=0$. This completes the induction, and hence the proof. Comment 2. There are many functions $f$ satisfying the functional equation for which there is an $f$-rare integer. For instance, one may generalise the construction in part (a) of Solution 1 by taking a sequence $1=a_{0}, a_{1}, a_{2}, \ldots$ of positive integers with each $a_{i}$ a proper divisor of $a_{i+1}$ and choosing arbitrary functions $f_{i}:\left(\mathbb{Z} / a_{i} \mathbb{Z}\right) \backslash{0} \rightarrow a_{i} \mathbb{Z} \backslash{0}$ from the nonzero residue classes modulo $a_{i}$ to the nonzero multiples of $a_{i}$. One then defines a function $f: \mathbb{Z} \rightarrow \mathbb{Z}$ by

f(x):={fi+1(xai+1), if aix but ai+1x0, if x=0 f(x):= \begin{cases}f_{i+1}\left(x \bmod a_{i+1}\right), & \text { if } a_{i} \mid x \text { but } a_{i+1} \nmid x \\ 0, & \text { if } x=0\end{cases}

If one writes $v(x)$ for the largest $i$ such that $a_{i} \mid x$ (with $v(0)=\infty$ ), then it is easy to verify the functional equation for $f$ separately in the two cases $v(y)>v(x)$ and $v(x) \geqslant v(y)$. Hence this $f$ satisfies the functional equation and 0 is an $f$-rare integer.

Comment 3. In fact, if $v$ is an $f$-rare integer for an $f$ satisfying the functional equation, then its fibre $X_{v}={v}$ must be a singleton. We may assume without loss of generality that $v=0$. We've already seen in Solution 1 that 0 is either the greatest or least element of $X_{0}$; replacing $f$ with the function $x \mapsto-f(-x)$ if necessary, we may assume that 0 is the least element of $X_{0}$. We write $b$ for the largest element of $X_{0}$, supposing for contradiction that $b>0$, and write $N=(2 b)$ !.

It now follows from (*) that we have

f(f(Nb)+b)=f(f(0)+b)=f(b)=0 f(f(N b)+b)=f(f(0)+b)=f(b)=0

from which we see that $f(N b)+b \in X_{0} \subseteq[0, b]$. It follows that $f(N b) \in[-b, 0)$, since by construction $N b \notin X_{v}$. Now it follows that $(f(N b)-0) \cdot(f(N b)-b)$ is a divisor of $N$, so from ( $\dagger$ ) we see that $f(N b)=f(0)=0$. This yields the desired contradiction.

Combinatorics

C1. The infinite sequence $a_{0}, a_{1}, a_{2}, \ldots$ of (not necessarily different) integers has the following properties: $0 \leqslant a_{i} \leqslant i$ for all integers $i \geqslant 0$, and

(ka0)+(ka1)++(kak)=2k \binom{k}{a_{0}}+\binom{k}{a_{1}}+\cdots+\binom{k}{a_{k}}=2^{k}

for all integers $k \geqslant 0$. Prove that all integers $N \geqslant 0$ occur in the sequence (that is, for all $N \geqslant 0$, there exists $i \geqslant 0$ with $\left.a_{i}=N\right)$. (Netherlands) Solution. We prove by induction on $k$ that every initial segment of the sequence, $a_{0}, a_{1}, \ldots, a_{k}$, consists of the following elements (counted with multiplicity, and not necessarily in order), for some $\ell \geqslant 0$ with $2 \ell \leqslant k+1$ :

0,1,,1,0,1,,k 0,1, \ldots, \ell-1, \quad 0,1, \ldots, k-\ell

For $k=0$ we have $a_{0}=0$, which is of this form. Now suppose that for $k=m$ the elements $a_{0}, a_{1}, \ldots, a_{m}$ are $0,0,1,1,2,2, \ldots, \ell-1, \ell-1, \ell, \ell+1, \ldots, m-\ell-1, m-\ell$ for some $\ell$ with $0 \leqslant 2 \ell \leqslant m+1$. It is given that

(m+1a0)+(m+1a1)++(m+1am)+(m+1am+1)=2m+1 \binom{m+1}{a_{0}}+\binom{m+1}{a_{1}}+\cdots+\binom{m+1}{a_{m}}+\binom{m+1}{a_{m+1}}=2^{m+1}

which becomes

((m+10)+(m+11)++(m+11))+((m+10)+(m+11)++(m+1m))+(m+1am+1)=2m+1 \begin{aligned} \left(\binom{m+1}{0}+\binom{m+1}{1}\right. & \left.+\cdots+\binom{m+1}{\ell-1}\right) \\ & +\left(\binom{m+1}{0}+\binom{m+1}{1}+\cdots+\binom{m+1}{m-\ell}\right)+\binom{m+1}{a_{m+1}}=2^{m+1} \end{aligned}

or, using $\binom{m+1}{i}=\binom{m+1}{m+1-i}$, that

((m+10)+(m+11)++(m+11))+((m+1m+1)+(m+1m)++(m+1+1))+(m+1am+1)=2m+1 \begin{aligned} \left(\binom{m+1}{0}+\binom{m+1}{1}\right. & \left.+\cdots+\binom{m+1}{\ell-1}\right) \\ & +\left(\binom{m+1}{m+1}+\binom{m+1}{m}+\cdots+\binom{m+1}{\ell+1}\right)+\binom{m+1}{a_{m+1}}=2^{m+1} \end{aligned}

On the other hand, it is well known that

(m+10)+(m+11)++(m+1m+1)=2m+1 \binom{m+1}{0}+\binom{m+1}{1}+\cdots+\binom{m+1}{m+1}=2^{m+1}

and so, by subtracting, we get

(m+1am+1)=(m+1) \binom{m+1}{a_{m+1}}=\binom{m+1}{\ell}

From this, using the fact that the binomial coefficients $\binom{m+1}{i}$ are increasing for $i \leqslant \frac{m+1}{2}$ and decreasing for $i \geqslant \frac{m+1}{2}$, we conclude that either $a_{m+1}=\ell$ or $a_{m+1}=m+1-\ell$. In either case, $a_{0}, a_{1}, \ldots, a_{m+1}$ is again of the claimed form, which concludes the induction.

As a result of this description, any integer $N \geqslant 0$ appears as a term of the sequence $a_{i}$ for some $0 \leqslant i \leqslant 2 N$.

C2. You are given a set of $n$ blocks, each weighing at least 1 ; their total weight is $2 n$. Prove that for every real number $r$ with $0 \leqslant r \leqslant 2 n-2$ you can choose a subset of the blocks whose total weight is at least $r$ but at most $r+2$. (Thailand) Solution 1. We prove the following more general statement by induction on $n$. Claim. Suppose that you have $n$ blocks, each of weight at least 1 , and of total weight $s \leqslant 2 n$. Then for every $r$ with $-2 \leqslant r \leqslant s$, you can choose some of the blocks whose total weight is at least $r$ but at most $r+2$. Proof. The base case $n=1$ is trivial. To prove the inductive step, let $x$ be the largest block weight. Clearly, $x \geqslant s / n$, so $s-x \leqslant \frac{n-1}{n} s \leqslant 2(n-1)$. Hence, if we exclude a block of weight $x$, we can apply the inductive hypothesis to show the claim holds (for this smaller set) for any $-2 \leqslant r \leqslant s-x$. Adding the excluded block to each of those combinations, we see that the claim also holds when $x-2 \leqslant r \leqslant s$. So if $x-2 \leqslant s-x$, then we have covered the whole interval $[-2, s]$. But each block weight is at least 1 , so we have $x-2 \leqslant(s-(n-1))-2=s-(2 n-(n-1)) \leqslant s-(s-(n-1)) \leqslant s-x$, as desired.

Comment. Instead of inducting on sets of blocks with total weight $s \leqslant 2 n$, we could instead prove the result only for $s=2 n$. We would then need to modify the inductive step to scale up the block weights before applying the induction hypothesis.

Solution 2. Let $x_{1}, \ldots, x_{n}$ be the weights of the blocks in weakly increasing order. Consider the set $S$ of sums of the form $\sum_{j \in J} x_{j}$ for a subset $J \subseteq{1,2, \ldots, n}$. We want to prove that the mesh of $S$ - i.e. the largest distance between two adjacent elements - is at most 2.

For $0 \leqslant k \leqslant n$, let $S_{k}$ denote the set of sums of the form $\sum_{i \in J} x_{i}$ for a subset $J \subseteq{1,2, \ldots, k}$. We will show by induction on $k$ that the mesh of $S_{k}$ is at most 2 .

The base case $k=0$ is trivial (as $S_{0}={0}$ ). For $k>0$ we have

Sk=Sk1(xk+Sk1) S_{k}=S_{k-1} \cup\left(x_{k}+S_{k-1}\right)

(where $\left(x_{k}+S_{k-1}\right)$ denotes $\left{x_{k}+s: s \in S_{k-1}\right}$ ), so it suffices to prove that $x_{k} \leqslant \sum_{j<k} x_{j}+2$. But if this were not the case, we would have $x_{l}>\sum_{j<k} x_{j}+2 \geqslant k+1$ for all $l \geqslant k$, and hence

2n=j=1nxj>(n+1k)(k+1)+k1 2 n=\sum_{j=1}^{n} x_{j}>(n+1-k)(k+1)+k-1

This rearranges to $n>k(n+1-k)$, which is false for $1 \leqslant k \leqslant n$, giving the desired contradiction.

C3. Let $n$ be a positive integer. Harry has $n$ coins lined up on his desk, each showing

heads or tails. He repeatedly does the following operation: if there are $k$ coins showing heads and $k>0$, then he flips the $k^{\text {th }}$ coin over; otherwise he stops the process. (For example, the process starting with THT would be THT $\rightarrow H H T \rightarrow H T T \rightarrow T T T$, which takes three steps.)

Letting $C$ denote the initial configuration (a sequence of $n H$ 's and $T$ 's), write $\ell(C)$ for the number of steps needed before all coins show $T$. Show that this number $\ell(C)$ is finite, and determine its average value over all $2^{n}$ possible initial configurations $C$.

Answer: The average is $\frac{1}{4} n(n+1)$. Common remarks. Throughout all these solutions, we let $E(n)$ denote the desired average value.

Solution 1. We represent the problem using a directed graph $G_{n}$ whose vertices are the length- $n$ strings of $H$ 's and $T$ 's. The graph features an edge from each string to its successor (except for $T T \cdots T T$, which has no successor). We will also write $\bar{H}=T$ and $\bar{T}=H$.

The graph $G_{0}$ consists of a single vertex: the empty string. The main claim is that $G_{n}$ can be described explicitly in terms of $G_{n-1}$ :

  • We take two copies, $X$ and $Y$, of $G_{n-1}$.
  • In $X$, we take each string of $n-1$ coins and just append a $T$ to it. In symbols, we replace $s_{1} \cdots s_{n-1}$ with $s_{1} \cdots s_{n-1} T$.
  • In $Y$, we take each string of $n-1$ coins, flip every coin, reverse the order, and append an $H$ to it. In symbols, we replace $s_{1} \cdots s_{n-1}$ with $\bar{s}{n-1} \bar{s}{n-2} \cdots \bar{s}_{1} H$.
  • Finally, we add one new edge from $Y$ to $X$, namely $H H \cdots H H H \rightarrow H H \cdots H H T$.

We depict $G_{4}$ below, in a way which indicates this recursive construction:

We prove the claim inductively. Firstly, $X$ is correct as a subgraph of $G_{n}$, as the operation on coins is unchanged by an extra $T$ at the end: if $s_{1} \cdots s_{n-1}$ is sent to $t_{1} \cdots t_{n-1}$, then $s_{1} \cdots s_{n-1} T$ is sent to $t_{1} \cdots t_{n-1} T$.

Next, $Y$ is also correct as a subgraph of $G_{n}$, as if $s_{1} \cdots s_{n-1}$ has $k$ occurrences of $H$, then $\bar{s}{n-1} \cdots \bar{s}{1} H$ has $(n-1-k)+1=n-k$ occurrences of $H$, and thus (provided that $k>0$ ), if $s_{1} \cdots s_{n-1}$ is sent to $t_{1} \cdots t_{n-1}$, then $\bar{s}{n-1} \cdots \bar{s}{1} H$ is sent to $\bar{t}{n-1} \cdots \bar{t}{1} H$.

Finally, the one edge from $Y$ to $X$ is correct, as the operation does send $H H \cdots H H H$ to HH $\cdots$ HHT.

To finish, note that the sequences in $X$ take an average of $E(n-1)$ steps to terminate, whereas the sequences in $Y$ take an average of $E(n-1)$ steps to reach $H H \cdots H$ and then an additional $n$ steps to terminate. Therefore, we have

E(n)=12(E(n1)+(E(n1)+n))=E(n1)+n2 E(n)=\frac{1}{2}(E(n-1)+(E(n-1)+n))=E(n-1)+\frac{n}{2}

We have $E(0)=0$ from our description of $G_{0}$. Thus, by induction, we have $E(n)=\frac{1}{2}(1+\cdots+$ $n)=\frac{1}{4} n(n+1)$, which in particular is finite.

Solution 2. We consider what happens with configurations depending on the coins they start and end with.

  • If a configuration starts with $H$, the last $n-1$ coins follow the given rules, as if they were all the coins, until they are all $T$, then the first coin is turned over.
  • If a configuration ends with $T$, the last coin will never be turned over, and the first $n-1$ coins follow the given rules, as if they were all the coins.
  • If a configuration starts with $T$ and ends with $H$, the middle $n-2$ coins follow the given rules, as if they were all the coins, until they are all $T$. After that, there are $2 n-1$ more steps: first coins $1,2, \ldots, n-1$ are turned over in that order, then coins $n, n-1, \ldots, 1$ are turned over in that order.

As this covers all configurations, and the number of steps is clearly finite for 0 or 1 coins, it follows by induction on $n$ that the number of steps is always finite.

We define $E_{A B}(n)$, where $A$ and $B$ are each one of $H, T$ or $$, to be the average number of steps over configurations of length $n$ restricted to those that start with $A$, if $A$ is not $$, and that end with $B$, if $B$ is not * (so * represents "either $H$ or $T$ "). The above observations tell us that, for $n \geqslant 2$ :

  • $E_{H *}(n)=E(n-1)+1$.
  • $E_{* T}(n)=E(n-1)$.
  • $E_{H T}(n)=E(n-2)+1$ (by using both the observations for $H $ and for $\left. T\right)$.
  • $E_{T H}(n)=E(n-2)+2 n-1$.

Now $E_{H *}(n)=\frac{1}{2}\left(E_{H H}(n)+E_{H T}(n)\right)$, so $E_{H H}(n)=2 E(n-1)-E(n-2)+1$. Similarly, $E_{T T}(n)=2 E(n-1)-E(n-2)-1$. So

E(n)=14(EHT(n)+EHH(n)+ETT(n)+ETH(n))=E(n1)+n2 E(n)=\frac{1}{4}\left(E_{H T}(n)+E_{H H}(n)+E_{T T}(n)+E_{T H}(n)\right)=E(n-1)+\frac{n}{2}

We have $E(0)=0$ and $E(1)=\frac{1}{2}$, so by induction on $n$ we have $E(n)=\frac{1}{4} n(n+1)$. Solution 3. Let $H_{i}$ be the number of heads in positions 1 to $i$ inclusive (so $H_{n}$ is the total number of heads), and let $I_{i}$ be 1 if the $i^{\text {th }}$ coin is a head, 0 otherwise. Consider the function

t(i)=Ii+2(min{i,Hn}Hi) t(i)=I_{i}+2\left(\min \left\{i, H_{n}\right\}-H_{i}\right)

We claim that $t(i)$ is the total number of times coin $i$ is turned over (which implies that the process terminates). Certainly $t(i)=0$ when all coins are tails, and $t(i)$ is always a nonnegative integer, so it suffices to show that when the $k^{\text {th }}$ coin is turned over (where $k=H_{n}$ ), $t(k)$ goes down by 1 and all the other $t(i)$ are unchanged. We show this by splitting into cases:

  • If $i<k, I_{i}$ and $H_{i}$ are unchanged, and $\min \left{i, H_{n}\right}=i$ both before and after the coin flip, so $t(i)$ is unchanged.
  • If $i>k, \min \left{i, H_{n}\right}=H_{n}$ both before and after the coin flip, and both $H_{n}$ and $H_{i}$ change by the same amount, so $t(i)$ is unchanged.
  • If $i=k$ and the coin is heads, $I_{i}$ goes down by 1 , as do both $\min \left{i, H_{n}\right}=H_{n}$ and $H_{i}$; so $t(i)$ goes down by 1 .
  • If $i=k$ and the coin is tails, $I_{i}$ goes up by $1, \min \left{i, H_{n}\right}=i$ is unchanged and $H_{i}$ goes up by 1 ; so $t(i)$ goes down by 1 .

We now need to compute the average value of

i=1nt(i)=i=1nIi+2i=1nmin{i,Hn}2i=1nHi. \sum_{i=1}^{n} t(i)=\sum_{i=1}^{n} I_{i}+2 \sum_{i=1}^{n} \min \left\{i, H_{n}\right\}-2 \sum_{i=1}^{n} H_{i} .

The average value of the first term is $\frac{1}{2} n$, and that of the third term is $-\frac{1}{2} n(n+1)$. To compute the second term, we sum over choices for the total number of heads, and then over the possible values of $i$, getting

21nj=0n(nj)i=1nmin{i,j}=21nj=0n(nj)(nj(j2)). 2^{1-n} \sum_{j=0}^{n}\binom{n}{j} \sum_{i=1}^{n} \min \{i, j\}=2^{1-n} \sum_{j=0}^{n}\binom{n}{j}\left(n j-\binom{j}{2}\right) .

Now, in terms of trinomial coefficients,

j=0nj(nj)=j=1n(nnj,j1,1)=nj=0n1(n1j)=2n1n \sum_{j=0}^{n} j\binom{n}{j}=\sum_{j=1}^{n}\binom{n}{n-j, j-1,1}=n \sum_{j=0}^{n-1}\binom{n-1}{j}=2^{n-1} n

and

j=0n(j2)(nj)=j=2n(nnj,j2,2)=(n2)j=0n2(n2j)=2n2(n2) \sum_{j=0}^{n}\binom{j}{2}\binom{n}{j}=\sum_{j=2}^{n}\binom{n}{n-j, j-2,2}=\binom{n}{2} \sum_{j=0}^{n-2}\binom{n-2}{j}=2^{n-2}\binom{n}{2}

So the second term above is

21n(2n1n22n2(n2))=n2n(n1)4 2^{1-n}\left(2^{n-1} n^{2}-2^{n-2}\binom{n}{2}\right)=n^{2}-\frac{n(n-1)}{4}

and the required average is

E(n)=12n+n2n(n1)412n(n+1)=n(n+1)4. E(n)=\frac{1}{2} n+n^{2}-\frac{n(n-1)}{4}-\frac{1}{2} n(n+1)=\frac{n(n+1)}{4} .

Solution 4. Harry has built a Turing machine to flip the coins for him. The machine is initially positioned at the $k^{\text {th }}$ coin, where there are $k$ heads (and the position before the first coin is considered to be the $0^{\text {th }}$ coin). The machine then moves according to the following rules, stopping when it reaches the position before the first coin: if the coin at its current position is $H$, it flips the coin and moves to the previous coin, while if the coin at its current position is $T$, it flips the coin and moves to the next position.

Consider the maximal sequences of consecutive moves in the same direction. Suppose the machine has $a$ consecutive moves to the next coin, before a move to the previous coin. After those $a$ moves, the $a$ coins flipped in those moves are all heads, as is the coin the machine is now at, so at least the next $a+1$ moves will all be moves to the previous coin. Similarly, $a$ consecutive moves to the previous coin are followed by at least $a+1$ consecutive moves to the next coin. There cannot be more than $n$ consecutive moves in the same direction, so this proves that the process terminates (with a move from the first coin to the position before the first coin).

Thus we have a (possibly empty) sequence $a_{1}<\cdots<a_{t} \leqslant n$ giving the lengths of maximal sequences of consecutive moves in the same direction, where the final $a_{t}$ moves must be moves to the previous coin, ending before the first coin. We claim there is a bijection between initial configurations of the coins and such sequences. This gives

E(n)=12(1+2++n)=n(n+1)4 E(n)=\frac{1}{2}(1+2+\cdots+n)=\frac{n(n+1)}{4}

as required, since each $i$ with $1 \leqslant i \leqslant n$ will appear in half of the sequences, and will contribute $i$ to the number of moves when it does.

To see the bijection, consider following the sequence of moves backwards, starting with the machine just before the first coin and all coins showing tails. This certainly determines a unique configuration of coins that could possibly correspond to the given sequence. Furthermore, every coin flipped as part of the $a_{j}$ consecutive moves is also flipped as part of all subsequent sequences of $a_{k}$ consecutive moves, for all $k>j$, meaning that, as we follow the moves backwards, each coin is always in the correct state when flipped to result in a move in the required direction. (Alternatively, since there are $2^{n}$ possible configurations of coins and $2^{n}$ possible such ascending sequences, the fact that the sequence of moves determines at most one configuration of coins, and thus that there is an injection from configurations of coins to such ascending sequences, is sufficient for it to be a bijection, without needing to show that coins are in the right state as we move backwards.)

Solution 5. We explicitly describe what happens with an arbitrary sequence $C$ of $n$ coins. Suppose that $C$ contain $k$ heads at positions $1 \leqslant c_{1}<c_{2}<\cdots<c_{k} \leqslant n$.

Let $i$ be the minimal index such that $c_{i} \geqslant k$. Then the first few steps will consist of turning over the $k^{\mathrm{th}},(k+1)^{\mathrm{th}}, \ldots, c_{i}^{\mathrm{th}},\left(c_{i}-1\right)^{\mathrm{th}},\left(c_{i}-2\right)^{\mathrm{th}}, \ldots, k^{\mathrm{th}}$ coins in this order. After that we get a configuration with $k-1$ heads at the same positions as in the initial one, except for $c_{i}$. This part of the process takes $2\left(c_{i}-k\right)+1$ steps.

After that, the process acts similarly; by induction on the number of heads we deduce that the process ends. Moreover, if the $c_{i}$ disappear in order $c_{i_{1}}, \ldots, c_{i_{k}}$, the whole process takes

(C)=j=1k(2(cij(k+1j))+1)=2j=1kcj2j=1k(k+1j)+k=2j=1kcjk2 \ell(C)=\sum_{j=1}^{k}\left(2\left(c_{i_{j}}-(k+1-j)\right)+1\right)=2 \sum_{j=1}^{k} c_{j}-2 \sum_{j=1}^{k}(k+1-j)+k=2 \sum_{j=1}^{k} c_{j}-k^{2}

steps. Now let us find the total value $S_{k}$ of $\ell(C)$ over all $\binom{n}{k}$ configurations with exactly $k$ heads. To sum up the above expression over those, notice that each number $1 \leqslant i \leqslant n$ appears as $c_{j}$ exactly $\binom{n-1}{k-1}$ times. Thus

Sk=2(n1k1)i=1ni(nk)k2=2(n1)(nk+1)(k1)!n(n+1)2n(nk+1)k!k2=n(n1)(nk+1)(k1)!((n+1)k)=n(n1)(n2k1)+n(n1k1). \begin{gathered} S_{k}=2\binom{n-1}{k-1} \sum_{i=1}^{n} i-\binom{n}{k} k^{2}=2 \frac{(n-1) \cdots(n-k+1)}{(k-1)!} \cdot \frac{n(n+1)}{2}-\frac{n \cdots(n-k+1)}{k!} k^{2} \\ =\frac{n(n-1) \cdots(n-k+1)}{(k-1)!}((n+1)-k)=n(n-1)\binom{n-2}{k-1}+n\binom{n-1}{k-1} . \end{gathered}

Therefore, the total value of $\ell(C)$ over all configurations is

k=1nSk=n(n1)k=1n(n2k1)+nk=1n(n1k1)=n(n1)2n2+n2n1=2nn(n+1)4 \sum_{k=1}^{n} S_{k}=n(n-1) \sum_{k=1}^{n}\binom{n-2}{k-1}+n \sum_{k=1}^{n}\binom{n-1}{k-1}=n(n-1) 2^{n-2}+n 2^{n-1}=2^{n} \frac{n(n+1)}{4}

Hence the required average is $E(n)=\frac{n(n+1)}{4}$.

C4. On a flat plane in Camelot, King Arthur builds a labyrinth $\mathfrak{L}$ consisting of $n$ walls,

each of which is an infinite straight line. No two walls are parallel, and no three walls have a common point. Merlin then paints one side of each wall entirely red and the other side entirely blue.

At the intersection of two walls there are four corners: two diagonally opposite corners where a red side and a blue side meet, one corner where two red sides meet, and one corner where two blue sides meet. At each such intersection, there is a two-way door connecting the two diagonally opposite corners at which sides of different colours meet.

After Merlin paints the walls, Morgana then places some knights in the labyrinth. The knights can walk through doors, but cannot walk through walls.

Let $k(\mathfrak{L})$ be the largest number $k$ such that, no matter how Merlin paints the labyrinth $\mathfrak{L}$, Morgana can always place at least $k$ knights such that no two of them can ever meet. For each $n$, what are all possible values for $k(\mathfrak{L})$, where $\mathfrak{L}$ is a labyrinth with $n$ walls? (Canada)

Answer: The only possible value of $k$ is $k=n+1$, no matter what shape the labyrinth is.

Solution 1. First we show by induction that the $n$ walls divide the plane into $\binom{n+1}{2}+1$ regions. The claim is true for $n=0$ as, when there are no walls, the plane forms a single region. When placing the $n^{\text {th }}$ wall, it intersects each of the $n-1$ other walls exactly once and hence splits each of $n$ of the regions formed by those other walls into two regions. By the induction hypothesis, this yields $\left(\binom{n}{2}+1\right)+n=\binom{n+1}{2}+1$ regions, proving the claim.

Now let $G$ be the graph with vertices given by the $\binom{n+1}{2}+1$ regions, and with two regions connected by an edge if there is a door between them.

We now show that no matter how Merlin paints the $n$ walls, Morgana can place at least $n+1$ knights. No matter how the walls are painted, there are exactly $\binom{n}{2}$ intersection points, each of which corresponds to a single edge in $G$. Consider adding the edges of $G$ sequentially and note that each edge reduces the number of connected components by at most one. Therefore the number of connected components of G is at least $\binom{n+1}{2}+1-\binom{n}{2}=n+1$. If Morgana places a knight in regions corresponding to different connected components of $G$, then no two knights can ever meet.

Now we give a construction showing that, no matter what shape the labyrinth is, Merlin can colour it such that there are exactly $n+1$ connected components, allowing Morgana to place at most $n+1$ knights.

First, we choose a coordinate system on the labyrinth so that none of the walls run due north-south, or due east-west. We then have Merlin paint the west face of each wall red, and the east face of each wall blue. We label the regions according to how many walls the region is on the east side of: the labels are integers between 0 and $n$.

We claim that, for each $i$, the regions labelled $i$ are connected by doors. First, we note that for each $i$ with $0 \leqslant i \leqslant n$ there is a unique region labelled $i$ which is unbounded to the north.

Now, consider a knight placed in some region with label $i$, and ask them to walk north (moving east or west by following the walls on the northern sides of regions, as needed). This knight will never get stuck: each region is convex, and so, if it is bounded to the north, it has a single northernmost vertex with a door northwards to another region with label $i$.

Eventually it will reach a region which is unbounded to the north, which will be the unique such region with label $i$. Hence every region with label $i$ is connected to this particular region, and so all regions with label $i$ are connected to each other.

As a result, there are exactly $n+1$ connected components, and Morgana can place at most $n+1$ knights.

Comment. Variations on this argument exist: some of them capture more information, and some of them capture less information, about the connected components according to this system of numbering.

For example, it can be shown that the unbounded regions are numbered $0,1, \ldots, n-1, n, n-1, \ldots, 1$ as one cycles around them, that the regions labelled 0 and $n$ are the only regions in their connected components, and that each other connected component forms a single chain running between the two unbounded ones. It is also possible to argue that the regions are acyclic without revealing much about their structure.

Solution 2. We give another description of a strategy for Merlin to paint the walls so that Morgana can place no more than $n+1$ knights.

Merlin starts by building a labyrinth of $n$ walls of his own design. He places walls in turn with increasing positive gradients, placing each so far to the right that all intersection points of previously-placed lines lie to the left of it. He paints each in such a way that blue is on the left and red is on the right.

For example, here is a possible sequence of four such lines $\ell_{1}, \ell_{2}, \ell_{3}, \ell_{4}$ :

We say that a region is "on the right" if it has $x$-coordinate unbounded above (note that if we only have one wall, then both regions are on the right). We claim inductively that, after placing $n$ lines, there are $n+1$ connected components in the resulting labyrinth, each of which contains exactly one region on the right. This is certainly true after placing 0 lines, as then there is only one region (and hence one connected component) and it is on the right.

When placing the $n^{\text {th }}$ line, it then cuts every one of the $n-1$ previously placed lines, and since it is to the right of all intersection points, the regions it cuts are exactly the $n$ regions on the right.

The addition of this line leaves all previous connected components with exactly one region on the right, and creates a new connected component containing exactly one region, and that region is also on the right. As a result, by induction, this particular labyrinth will have $n+1$ connected components.

Having built this labyrinth, Merlin then moves the walls one-by-one (by a sequence of continuous translations and rotations of lines) into the proper position of the given labyrinth, in such a way that no two lines ever become parallel.

The only time the configuration is changed is when one wall is moved through an intersection point of two others:

Note that all moves really do switch between two configurations like this: all sets of three lines have this colour configuration initially, and the rules on rotations mean they are preserved (in particular, we cannot create three lines creating a triangle with three red edges inwards, or three blue edges inwards).

However, as can be seen, such a move preserves the number of connected components, so in the painting this provides for Arthur's actual labyrinth, Morgana can still only place at most $n+1$ knights.

Comment. While these constructions are superficially distinct, they in fact result in the same colourings for any particular labyrinth. In fact, using the methods of Solution 2, it is possible to show that these are the only colourings that result in exactly $n+1$ connected components.

C5. On a certain social network, there are 2019 users, some pairs of which are friends, where friendship is a symmetric relation. Initially, there are 1010 people with 1009 friends each and 1009 people with 1010 friends each. However, the friendships are rather unstable, so events of the following kind may happen repeatedly, one at a time:

Let $A, B$, and $C$ be people such that $A$ is friends with both $B$ and $C$, but $B$ and $C$ are not friends; then $B$ and $C$ become friends, but $A$ is no longer friends with them.

Prove that, regardless of the initial friendships, there exists a sequence of such events after which each user is friends with at most one other user. (Croatia) Common remarks. The problem has an obvious rephrasing in terms of graph theory. One is given a graph $G$ with 2019 vertices, 1010 of which have degree 1009 and 1009 of which have degree 1010. One is allowed to perform operations on $G$ of the following kind:

Suppose that vertex $A$ is adjacent to two distinct vertices $B$ and $C$ which are not adjacent to each other. Then one may remove the edges $A B$ and $A C$ from $G$ and add the edge $B C$ into $G$.

Call such an operation a refriending. One wants to prove that, via a sequence of such refriendings, one can reach a graph which is a disjoint union of single edges and vertices.

All of the solutions presented below will use this reformulation. Solution 1. Note that the given graph is connected, since the total degree of any two vertices is at least 2018 and hence they are either adjacent or have at least one neighbour in common. Hence the given graph satisfies the following condition:

Every connected component of $G$ with at least three vertices is not complete and has a vertex of odd degree.

We will show that if a graph $G$ satisfies condition (1) and has a vertex of degree at least 2 , then there is a refriending on $G$ that preserves condition (1). Since refriendings decrease the total number of edges of $G$, by using a sequence of such refriendings, we must reach a graph $G$ with maximal degree at most 1 , so we are done.

Pick a vertex $A$ of degree at least 2 in a connected component $G^{\prime}$ of $G$. Since no component of $G$ with at least three vertices is complete we may assume that not all of the neighbours of $A$ are adjacent to one another. (For example, pick a maximal complete subgraph $K$ of $G^{\prime}$. Some vertex $A$ of $K$ has a neighbour outside $K$, and this neighbour is not adjacent to every vertex of $K$ by maximality.) Removing $A$ from $G$ splits $G^{\prime}$ into smaller connected components $G_{1}, \ldots, G_{k}$ (possibly with $k=1$ ), to each of which $A$ is connected by at least one edge. We divide into several cases.

Case 1: $k \geqslant 2$ and $A$ is connected to some $G_{i}$ by at least two edges. Choose a vertex $B$ of $G_{i}$ adjacent to $A$, and a vertex $C$ in another component $G_{j}$ adjacent to $A$. The vertices $B$ and $C$ are not adjacent, and hence removing edges $A B$ and $A C$ and adding in edge $B C$ does not disconnect $G^{\prime}$. It is easy to see that this preserves the condition, since the refriending does not change the parity of the degrees of vertices.

Case 2: $k \geqslant 2$ and $A$ is connected to each $G_{i}$ by exactly one edge. Consider the induced subgraph on any $G_{i}$ and the vertex $A$. The vertex $A$ has degree 1 in this subgraph; since the number of odd-degree vertices of a graph is always even, we see that $G_{i}$ has a vertex of odd degree (in $G$ ). Thus if we let $B$ and $C$ be any distinct neighbours of $A$, then removing edges $A B$ and $A C$ and adding in edge $B C$ preserves the above condition: the refriending creates two new components, and if either of these components has at least three vertices, then it cannot be complete and must contain a vertex of odd degree (since each $G_{i}$ does).

Case 3: $k=1$ and $A$ is connected to $G_{1}$ by at least three edges. By assumption, $A$ has two neighbours $B$ and $C$ which are not adjacent to one another. Removing edges $A B$ and $A C$ and adding in edge $B C$ does not disconnect $G^{\prime}$. We are then done as in Case 1.

Case 4: $k=1$ and $A$ is connected to $G_{1}$ by exactly two edges. Let $B$ and $C$ be the two neighbours of $A$, which are not adjacent. Removing edges $A B$ and $A C$ and adding in edge $B C$ results in two new components: one consisting of a single vertex; and the other containing a vertex of odd degree. We are done unless this second component would be a complete graph on at least 3 vertices. But in this case, $G_{1}$ would be a complete graph minus the single edge $B C$, and hence has at least 4 vertices since $G^{\prime}$ is not a 4 -cycle. If we let $D$ be a third vertex of $G_{1}$, then removing edges $B A$ and $B D$ and adding in edge $A D$ does not disconnect $G^{\prime}$. We are then done as in Case 1.

Comment. In fact, condition 1 above precisely characterises those graphs which can be reduced to a graph of maximal degree $\leqslant 1$ by a sequence of refriendings.

Solution 2. As in the previous solution, note that a refriending preserves the property that a graph has a vertex of odd degree and (trivially) the property that it is not complete; note also that our initial graph is connected. We describe an algorithm to reduce our initial graph to a graph of maximal degree at most 1, proceeding in two steps.

Step 1: There exists a sequence of refriendings reducing the graph to a tree. Proof. Since the number of edges decreases with each refriending, it suffices to prove the following: as long as the graph contains a cycle, there exists a refriending such that the resulting graph is still connected. We will show that the graph in fact contains a cycle $Z$ and vertices $A, B, C$ such that $A$ and $B$ are adjacent in the cycle $Z, C$ is not in $Z$, and is adjacent to $A$ but not $B$. Removing edges $A B$ and $A C$ and adding in edge $B C$ keeps the graph connected, so we are done.

To find this cycle $Z$ and vertices $A, B, C$, we pursue one of two strategies. If the graph contains a triangle, we consider a largest complete subgraph $K$, which thus contains at least three vertices. Since the graph itself is not complete, there is a vertex $C$ not in $K$ connected to a vertex $A$ of $K$. By maximality of $K$, there is a vertex $B$ of $K$ not connected to $C$, and hence we are done by choosing a cycle $Z$ in $K$ through the edge $A B$.

If the graph is triangle-free, we consider instead a smallest cycle $Z$. This cycle cannot be Hamiltonian (i.e. it cannot pass through every vertex of the graph), since otherwise by minimality the graph would then have no other edges, and hence would have even degree at every vertex. We may thus choose a vertex $C$ not in $Z$ adjacent to a vertex $A$ of $Z$. Since the graph is triangle-free, it is not adjacent to any neighbour $B$ of $A$ in $Z$, and we are done.

Step 2: Any tree may be reduced to a disjoint union of single edges and vertices by a sequence of refriendings. Proof. The refriending preserves the property of being acyclic. Hence, after applying a sequence of refriendings, we arrive at an acyclic graph in which it is impossible to perform any further refriendings. The maximal degree of any such graph is 1 : if it had a vertex $A$ with two neighbours $B, C$, then $B$ and $C$ would necessarily be nonadjacent since the graph is cycle-free, and so a refriending would be possible. Thus we reach a graph with maximal degree at most 1 as desired.

C6. Let $n>1$ be an integer. Suppose we are given $2 n$ points in a plane such that no three of them are collinear. The points are to be labelled $A_{1}, A_{2}, \ldots, A_{2 n}$ in some order. We then consider the $2 n$ angles $\angle A_{1} A_{2} A_{3}, \angle A_{2} A_{3} A_{4}, \ldots, \angle A_{2 n-2} A_{2 n-1} A_{2 n}, \angle A_{2 n-1} A_{2 n} A_{1}$, $\angle A_{2 n} A_{1} A_{2}$. We measure each angle in the way that gives the smallest positive value (i.e. between $0^{\circ}$ and $180^{\circ}$ ). Prove that there exists an ordering of the given points such that the resulting $2 n$ angles can be separated into two groups with the sum of one group of angles equal to the sum of the other group.

Comment. The first three solutions all use the same construction involving a line separating the points into groups of $n$ points each, but give different proofs that this construction works. Although Solution 1 is very short, the Problem Selection Committee does not believe any of the solutions is easy to find and thus rates this as a problem of medium difficulty.

Solution 1. Let $\ell$ be a line separating the points into two groups ( $L$ and $R$ ) with $n$ points in each. Label the points $A_{1}, A_{2}, \ldots, A_{2 n}$ so that $L=\left{A_{1}, A_{3}, \ldots, A_{2 n-1}\right}$. We claim that this labelling works.

Take a line $s=A_{2 n} A_{1}$. (a) Rotate $s$ around $A_{1}$ until it passes through $A_{2}$; the rotation is performed in a direction such that $s$ is never parallel to $\ell$. (b) Then rotate the new $s$ around $A_{2}$ until it passes through $A_{3}$ in a similar manner. (c) Perform $2 n-2$ more such steps, after which $s$ returns to its initial position.

The total (directed) rotation angle $\Theta$ of $s$ is clearly a multiple of $180^{\circ}$. On the other hand, $s$ was never parallel to $\ell$, which is possible only if $\Theta=0$. Now it remains to partition all the $2 n$ angles into those where $s$ is rotated anticlockwise, and the others.

Solution 2. When tracing a cyclic path through the $A_{i}$ in order, with straight line segments between consecutive points, let $\theta_{i}$ be the exterior angle at $A_{i}$, with a sign convention that it is positive if the path turns left and negative if the path turns right. Then $\sum_{i=1}^{2 n} \theta_{i}=360 k^{\circ}$ for some integer $k$. Let $\phi_{i}=\angle A_{i-1} A_{i} A_{i+1}($ indices $\bmod 2 n)$, defined as in the problem; thus $\phi_{i}=180^{\circ}-\left|\theta_{i}\right|$.

Let $L$ be the set of $i$ for which the path turns left at $A_{i}$ and let $R$ be the set for which it turns right. Then $S=\sum_{i \in L} \phi_{i}-\sum_{i \in R} \phi_{i}=(180(|L|-|R|)-360 k)^{\circ}$, which is a multiple of $360^{\circ}$ since the number of points is even. We will show that the points can be labelled such that $S=0$, in which case $L$ and $R$ satisfy the required condition of the problem.

Note that the value of $S$ is defined for a slightly larger class of configurations: it is OK for two points to coincide, as long as they are not consecutive, and OK for three points to be collinear, as long as $A_{i}, A_{i+1}$ and $A_{i+2}$ do not appear on a line in that order. In what follows it will be convenient, although not strictly necessary, to consider such configurations.

Consider how $S$ changes if a single one of the $A_{i}$ is moved along some straight-line path (not passing through any $A_{j}$ and not lying on any line $A_{j} A_{k}$, but possibly crossing such lines). Because $S$ is a multiple of $360^{\circ}$, and the angles change continuously, $S$ can only change when a point moves between $R$ and $L$. Furthermore, if $\phi_{j}=0$ when $A_{j}$ moves between $R$ and $L, S$ is unchanged; it only changes if $\phi_{j}=180^{\circ}$ when $A_{j}$ moves between those sets.

For any starting choice of points, we will now construct a new configuration, with labels such that $S=0$, that can be perturbed into the original one without any $\phi_{i}$ passing through $180^{\circ}$, so that $S=0$ for the original configuration with those labels as well.

Take some line such that there are $n$ points on each side of that line. The new configuration has $n$ copies of a single point on each side of the line, and a path that alternates between sides of the line; all angles are 0 , so this configuration has $S=0$. Perturbing the points into their original positions, while keeping each point on its side of the line, no angle $\phi_{i}$ can pass through $180^{\circ}$, because no straight line can go from one side of the line to the other and back. So the perturbation process leaves $S=0$.

Comment. More complicated variants of this solution are also possible; for example, a path defined using four quadrants of the plane rather than just two half-planes.

Solution 3. First, let $\ell$ be a line in the plane such that there are $n$ points on one side and the other $n$ points on the other side. For convenience, assume $\ell$ is horizontal (otherwise, we can rotate the plane). Then we can use the terms "above", "below", "left" and "right" in the usual way. We denote the $n$ points above the line in an arbitrary order as $P_{1}, P_{2}, \ldots, P_{n}$, and the $n$ points below the line as $Q_{1}, Q_{2}, \ldots, Q_{n}$.

If we connect $P_{i}$ and $Q_{j}$ with a line segment, the line segment will intersect with the line $\ell$. Denote the intersection as $I_{i j}$. If $P_{i}$ is connected to $Q_{j}$ and $Q_{k}$, where $j<k$, then $I_{i j}$ and $I_{i k}$ are two different points, because $P_{i}, Q_{j}$ and $Q_{k}$ are not collinear.

Now we define a "sign" for each angle $\angle Q_{j} P_{i} Q_{k}$. Assume $j<k$. We specify that the sign is positive for the following two cases:

  • if $i$ is odd and $I_{i j}$ is to the left of $I_{i k}$,
  • if $i$ is even and $I_{i j}$ is to the right of $I_{i k}$.

Otherwise the sign of the angle is negative. If $j>k$, then the sign of $\angle Q_{j} P_{i} Q_{k}$ is taken to be the same as for $\angle Q_{k} P_{i} Q_{j}$.

Similarly, we can define the sign of $\angle P_{j} Q_{i} P_{k}$ with $j<k$ (or equivalently $\angle P_{k} Q_{i} P_{j}$ ). For example, it is positive when $i$ is odd and $I_{j i}$ is to the left of $I_{k i}$.

Henceforth, whenever we use the notation $\angle Q_{j} P_{i} Q_{k}$ or $\angle P_{j} Q_{i} P_{k}$ for a numerical quantity, it is understood to denote either the (geometric) measure of the angle or the negative of this measure, depending on the sign as specified above.

We now have the following important fact for signed angle measures:

Qi1PkQi3=Qi1PkQi2+Qi2PkQi3 \angle Q_{i_{1}} P_{k} Q_{i_{3}}=\angle Q_{i_{1}} P_{k} Q_{i_{2}}+\angle Q_{i_{2}} P_{k} Q_{i_{3}}

for all points $P_{k}, Q_{i_{1}}, Q_{i_{2}}$ and $Q_{i_{3}}$ with $i_{1}<i_{2}<i_{3}$. The following figure shows a "natural" arrangement of the points. Equation (1) still holds for any other arrangement, as can be easily verified.

Similarly, we have

Pi1QkPi3=Pi1QkPi2+Pi2QkPi3, \angle P_{i_{1}} Q_{k} P_{i_{3}}=\angle P_{i_{1}} Q_{k} P_{i_{2}}+\angle P_{i_{2}} Q_{k} P_{i_{3}},

for all points $Q_{k}, P_{i_{1}}, P_{i_{2}}$ and $P_{i_{3}}$, with $i_{1}<i_{2}<i_{3}$.

We are now ready to specify the desired ordering $A_{1}, \ldots, A_{2 n}$ of the points:

  • if $i \leqslant n$ is odd, put $A_{i}=P_{i}$ and $A_{2 n+1-i}=Q_{i}$;
  • if $i \leqslant n$ is even, put $A_{i}=Q_{i}$ and $A_{2 n+1-i}=P_{i}$.

For example, for $n=3$ this ordering is $P_{1}, Q_{2}, P_{3}, Q_{3}, P_{2}, Q_{1}$. This sequence alternates between $P$ 's and $Q$ 's, so the above conventions specify a sign for each of the angles $A_{i-1} A_{i} A_{i+1}$. We claim that the sum of these $2 n$ signed angles equals 0 . If we can show this, it would complete the proof.

We prove the claim by induction. For brevity, we use the notation $\angle P_{i}$ to denote whichever of the $2 n$ angles has its vertex at $P_{i}$, and $\angle Q_{i}$ similarly.

First let $n=2$. If the four points can be arranged to form a convex quadrilateral, then the four line segments $P_{1} Q_{1}, P_{1} Q_{2}, P_{2} Q_{1}$ and $P_{2} Q_{2}$ constitute a self-intersecting quadrilateral. We use several figures to illustrate the possible cases.

The following figure is one possible arrangement of the points.

Then $\angle P_{1}$ and $\angle Q_{1}$ are positive, $\angle P_{2}$ and $\angle Q_{2}$ are negative, and we have

P1+Q1=P2+Q2. \left|\angle P_{1}\right|+\left|\angle Q_{1}\right|=\left|\angle P_{2}\right|+\left|\angle Q_{2}\right| .

With signed measures, we have

P1+Q1+P2+Q2=0 \angle P_{1}+\angle Q_{1}+\angle P_{2}+\angle Q_{2}=0

If we switch the labels of $P_{1}$ and $P_{2}$, we have the following picture:

Switching labels $P_{1}$ and $P_{2}$ has the effect of flipping the sign of all four angles (as well as swapping the magnitudes on the relabelled points); that is, the new values of ( $\angle P_{1}, \angle P_{2}, \angle Q_{1}, \angle Q_{2}$ ) equal the old values of ( $-\angle P_{2},-\angle P_{1},-\angle Q_{1},-\angle Q_{2}$ ). Consequently, equation (3) still holds. Similarly, when switching the labels of $Q_{1}$ and $Q_{2}$, or both the $P$ 's and the $Q$ 's, equation (3) still holds.

The remaining subcase of $n=2$ is that one point lies inside the triangle formed by the other three. We have the following picture.

We have

P1+Q1+Q2=P2. \left|\angle P_{1}\right|+\left|\angle Q_{1}\right|+\left|\angle Q_{2}\right|=\left|\angle P_{2}\right| .

and equation (3) holds. Again, switching the labels for $P$ 's or the $Q$ 's will not affect the validity of equation (3). Also, if the point lying inside the triangle of the other three is one of the $Q$ 's rather than the $P$ 's, the result still holds, since our sign convention is preserved when we relabel $Q$ 's as $P$ 's and vice-versa and reflect across $\ell$.

We have completed the proof of the claim for $n=2$. Assume the claim holds for $n=k$, and we wish to prove it for $n=k+1$. Suppose we are given our $2(k+1)$ points. First ignore $P_{k+1}$ and $Q_{k+1}$, and form $2 k$ angles from $P_{1}, \ldots, P_{k}$, $Q_{1}, \ldots, Q_{k}$ as in the $n=k$ case. By the induction hypothesis we have

i=1k(Pi+Qi)=0 \sum_{i=1}^{k}\left(\angle P_{i}+\angle Q_{i}\right)=0

When we add in the two points $P_{k+1}$ and $Q_{k+1}$, this changes our angles as follows:

  • the angle at $P_{k}$ changes from $\angle Q_{k-1} P_{k} Q_{k}$ to $\angle Q_{k-1} P_{k} Q_{k+1}$;
  • the angle at $Q_{k}$ changes from $\angle P_{k-1} Q_{k} P_{k}$ to $\angle P_{k-1} Q_{k} P_{k+1}$;
  • two new angles $\angle Q_{k} P_{k+1} Q_{k+1}$ and $\angle P_{k} Q_{k+1} P_{k+1}$ are added.

We need to prove the changes have no impact on the total sum. In other words, we need to prove

(Qk1PkQk+1Qk1PkQk)+(Pk1QkPk+1Pk1QkPk)+(Pk+1+Qk+1)=0 \left(\angle Q_{k-1} P_{k} Q_{k+1}-\angle Q_{k-1} P_{k} Q_{k}\right)+\left(\angle P_{k-1} Q_{k} P_{k+1}-\angle P_{k-1} Q_{k} P_{k}\right)+\left(\angle P_{k+1}+\angle Q_{k+1}\right)=0

In fact, from equations (1) and (2), we have

Qk1PkQk+1Qk1PkQk=QkPkQk+1 \angle Q_{k-1} P_{k} Q_{k+1}-\angle Q_{k-1} P_{k} Q_{k}=\angle Q_{k} P_{k} Q_{k+1}

and

Pk1QkPk+1Pk1QkPk=PkQkPk+1 \angle P_{k-1} Q_{k} P_{k+1}-\angle P_{k-1} Q_{k} P_{k}=\angle P_{k} Q_{k} P_{k+1}

Therefore, the left hand side of equation (4) becomes $\angle Q_{k} P_{k} Q_{k+1}+\angle P_{k} Q_{k} P_{k+1}+\angle Q_{k} P_{k+1} Q_{k+1}+$ $\angle P_{k} Q_{k+1} P_{k+1}$, which equals 0 , simply by applying the $n=2$ case of the claim. This completes the induction.

Solution 4. We shall think instead of the problem as asking us to assign a weight $\pm 1$ to each angle, such that the weighted sum of all the angles is zero.

Given an ordering $A_{1}, \ldots, A_{2 n}$ of the points, we shall assign weights according to the following recipe: walk in order from point to point, and assign the left turns +1 and the right turns -1 . This is the same weighting as in Solution 3, and as in that solution, the weighted sum is a multiple of $360^{\circ}$.

We now aim to show the following: Lemma. Transposing any two consecutive points in the ordering changes the weighted sum by $\pm 360^{\circ}$ or 0 .

Knowing that, we can conclude quickly: if the ordering $A_{1}, \ldots, A_{2 n}$ has weighted angle sum $360 k^{\circ}$, then the ordering $A_{2 n}, \ldots, A_{1}$ has weighted angle sum $-360 k^{\circ}$ (since the angles are the same, but left turns and right turns are exchanged). We can reverse the ordering of $A_{1}$, $\ldots, A_{2 n}$ by a sequence of transpositions of consecutive points, and in doing so the weighted angle sum must become zero somewhere along the way.

We now prove that lemma: Proof. Transposing two points amounts to taking a section $A_{k} A_{k+1} A_{k+2} A_{k+3}$ as depicted, reversing the central line segment $A_{k+1} A_{k+2}$, and replacing its two neighbours with the dotted lines.

Figure 1: Transposing two consecutive vertices: before (left) and afterwards (right) In each triangle, we alter the sum by $\pm 180^{\circ}$. Indeed, using (anticlockwise) directed angles modulo $360^{\circ}$, we either add or subtract all three angles of each triangle.

Hence both triangles together alter the sum by $\pm 180 \pm 180^{\circ}$, which is $\pm 360^{\circ}$ or 0 .

C7. There are 60 empty boxes $B_{1}, \ldots, B_{60}$ in a row on a table and an unlimited supply of pebbles. Given a positive integer $n$, Alice and Bob play the following game.

In the first round, Alice takes $n$ pebbles and distributes them into the 60 boxes as she wishes. Each subsequent round consists of two steps: (a) Bob chooses an integer $k$ with $1 \leqslant k \leqslant 59$ and splits the boxes into the two groups $B_{1}, \ldots, B_{k}$ and $B_{k+1}, \ldots, B_{60}$. (b) Alice picks one of these two groups, adds one pebble to each box in that group, and removes one pebble from each box in the other group.

Bob wins if, at the end of any round, some box contains no pebbles. Find the smallest $n$ such that Alice can prevent Bob from winning. (Czech Republic) Answer: $n=960$. In general, if there are $N>1$ boxes, the answer is $n=\left\lfloor\frac{N}{2}+1\right\rfloor\left\lceil\frac{N}{2}+1\right\rceil-1$. Common remarks. We present solutions for the general case of $N>1$ boxes, and write $M=\left\lfloor\frac{N}{2}+1\right\rfloor\left\lceil\frac{N}{2}+1\right\rceil-1$ for the claimed answer. For $1 \leqslant k<N$, say that Bob makes a $k$-move if he splits the boxes into a left group $\left{B_{1}, \ldots, B_{k}\right}$ and a right group $\left{B_{k+1}, \ldots, B_{N}\right}$. Say that one configuration dominates another if it has at least as many pebbles in each box, and say that it strictly dominates the other configuration if it also has more pebbles in at least one box. (Thus, if Bob wins in some configuration, he also wins in every configuration that it dominates.)

It is often convenient to consider ' V -shaped' configurations; for $1 \leqslant i \leqslant N$, let $V_{i}$ be the configuration where $B_{j}$ contains $1+|j-i|$ pebbles (i.e. where the $i^{\text {th }}$ box has a single pebble and the numbers increase by one in both directions, so the first box has $i$ pebbles and the last box has $N+1-i$ pebbles). Note that $V_{i}$ contains $\frac{1}{2} i(i+1)+\frac{1}{2}(N+1-i)(N+2-i)-1$ pebbles. If $i=\left\lceil\frac{N}{2}\right\rceil$, this number equals $M$.

Solutions split naturally into a strategy for Alice (starting with $M$ pebbles and showing she can prevent Bob from winning) and a strategy for Bob (showing he can win for any starting configuration with at most $M-1$ pebbles). The following observation is also useful to simplify the analysis of strategies for Bob. Observation A. Consider two consecutive rounds. Suppose that in the first round Bob made a $k$-move and Alice picked the left group, and then in the second round Bob makes an $\ell$-move, with $\ell>k$. We may then assume, without loss of generality, that Alice again picks the left group. Proof. Suppose Alice picks the right group in the second round. Then the combined effect of the two rounds is that each of the boxes $B_{k+1}, \ldots, B_{\ell}$ lost two pebbles (and the other boxes are unchanged). Hence this configuration is strictly dominated by that before the first round, and it suffices to consider only Alice's other response.

Solution 1 (Alice). Alice initially distributes pebbles according to $V_{\left\lceil\frac{N}{2}\right\rceil}$. Suppose the current configuration of pebbles dominates $V_{i}$. If Bob makes a $k$-move with $k \geqslant i$ then Alice picks the left group, which results in a configuration that dominates $V_{i+1}$. Likewise, if Bob makes a $k$-move with $k<i$ then Alice picks the right group, which results in a configuration that dominates $V_{i-1}$. Since none of $V_{1}, \ldots, V_{N}$ contains an empty box, Alice can prevent Bob from ever winning.

Solution 1 (Bob). The key idea in this solution is the following claim. Claim. If there exist a positive integer $k$ such that there are at least $2 k$ boxes that have at most $k$ pebbles each then Bob can force a win. Proof. We ignore the other boxes. First, Bob makes a $k$-move (splits the $2 k$ boxes into two groups of $k$ boxes each). Without loss of generality, Alice picks the left group. Then Bob makes a $(k+1)$-move, $\ldots$, a $(2 k-1)$-move. By Observation A, we may suppose Alice always picks the left group. After Bob's $(2 k-1)$-move, the rightmost box becomes empty and Bob wins.

Now, we claim that if $n<M$ then either there already exists an empty box, or there exist a positive integer $k$ and $2 k$ boxes with at most $k$ pebbles each (and thus Bob can force a win). Otherwise, assume each box contains at least 1 pebble, and for each $1 \leqslant k \leqslant\left\lfloor\frac{N}{2}\right\rfloor$, at least $N-(2 k-1)=N+1-2 k$ boxes contain at least $k+1$ pebbles. Summing, there are at least as many pebbles in total as in $V_{\left\lceil\frac{N}{2}\right\rceil}$; that is, at least $M$ pebbles, as desired.

Solution 2 (Alice). Let $K=\left\lfloor\frac{N}{2}+1\right\rfloor$. Alice starts with the boxes in the configuration $V_{K}$. For each of Bob's $N-1$ possible choices, consider the subset of rounds in which he makes that choice. In that subset of rounds, Alice alternates between picking the left group and picking the right group; the first time Bob makes that choice, Alice picks the group containing the $K^{\text {th }}$ box. Thus, at any time during the game, the number of pebbles in each box depends only on which choices Bob has made an odd number of times. This means that the number of pebbles in a box could decrease by at most the number of choices for which Alice would have started by removing a pebble from the group containing that box. These numbers are, for each box,

N2,N21,,1,0,1,,N21 \left\lfloor\frac{N}{2}\right\rfloor,\left\lfloor\frac{N}{2}-1\right\rfloor, \ldots, 1,0,1, \ldots,\left\lceil\frac{N}{2}-1\right\rceil

These are pointwise less than the numbers of pebbles the boxes started with, meaning that no box ever becomes empty with this strategy.

Solution 2 (Bob). Let $K=\left\lfloor\frac{N}{2}+1\right\rfloor$. For Bob's strategy, we consider a configuration $X$ with at most $M-1$ pebbles, and we make use of Observation A. Consider two configurations with $M$ pebbles: $V_{K}$ and $V_{N+1-K}$ (if $n$ is odd, they are the same configuration; if $n$ is even, one is the reverse of the other). The configuration $X$ has fewer pebbles than $V_{K}$ in at least one box, and fewer pebbles than $V_{N+1-K}$ in at least one box.

Suppose first that, with respect to one of those configurations (without loss of generality $V_{K}$ ), $X$ has fewer pebbles in one of the boxes in the half where they have $1,2, \ldots,\left\lceil\frac{N}{2}\right\rceil$ pebbles (the right half in $V_{K}$ if $N$ is even; if $N$ is odd, we can take it to be the right half, without loss of generality, as the configuration is symmetric). Note that the number cannot be fewer in the box with 1 pebble in $V_{K}$, because then it would have 0 pebbles. Bob then does a $K$-move. If Alice picks the right group, the total number of pebbles goes down and we restart Bob's strategy with a smaller number of pebbles. If Alice picks the left group, Bob follows with a $(K+1)$-move, a $(K+2)$-move, and so on; by Observation A we may assume Alice always picks the left group. But whichever box in the right half had fewer pebbles in $X$ than in $V_{K}$ ends up with 0 pebbles at some point in this sequence of moves.

Otherwise, $N$ is even, and for both of those configurations, there are fewer pebbles in $X$ only on the $2,3, \ldots, \frac{N}{2}+1$ side. That is, the numbers of pebbles in $X$ are at least

N2,N21,,1,1,,N2 \frac{N}{2}, \frac{N}{2}-1, \ldots, 1,1, \ldots, \frac{N}{2}

with equality occurring at least once on each side. Bob does an $\frac{N}{2}$-move. Whichever group Alice chooses, the total number of pebbles is unchanged, and the side from which pebbles are removed now has a box with fewer pebbles than in $(C)$, so the previous case of Bob's strategy can now be applied.

Solution 3 (Bob). For any configuration $C$, define $L(C)$ to be the greatest integer such that, for all $0 \leqslant i \leqslant N-1$, the box $B_{i+1}$ contains at least $L(C)-i$ pebbles. Similarly, define $R(C)$ to be greatest integer such that, for all $0 \leqslant i \leqslant N-1$, the box $B_{N-i}$ contains at least $R(C)-i$ pebbles. (Thus, $C$ dominates the 'left half' of $V_{L(C)}$ and the 'right half' of $V_{N+1-R(C)}$.) Then $C$ dominates a 'V-shaped' configuration if and only if $L(C)+R(C) \geqslant N+1$. Note that if $C$ dominates a V -shaped configuration, it has at least $M$ pebbles.

Now suppose that there are fewer than $M$ pebbles, so we have $L(C)+R(C) \leqslant N$. Then Bob makes an $L(C)$-move (or more generally any move with at least $L(C)$ boxes on the left and $R(C)$ boxes on the right). Let $C^{\prime}$ be the new configuration, and suppose that no box becomes empty (otherwise Bob has won). If Alice picks the left group, we have $L\left(C^{\prime}\right)=L(C)+1$ and $R\left(C^{\prime}\right)=R(C)-1$. Otherwise, we have $L\left(C^{\prime}\right)=L(C)-1$ and $R\left(C^{\prime}\right)=R(C)+1$. In either case, we have $L\left(C^{\prime}\right)+R\left(C^{\prime}\right) \leqslant N$.

Bob then repeats this strategy, until one of the boxes becomes empty. Since the condition in Observation A holds, we may assume that Alice picks a group on the same side each time. Then one of $L$ and $R$ is strictly decreasing; without loss of generality assume that $L$ strictly decreases. At some point we reach $L=1$. If $B_{2}$ is still nonempty, then $B_{1}$ must contain a single pebble. Bob makes a 1-move, and by Observation A, Alice must (eventually) pick the right group, making this box empty.

C8. Alice has a map of Wonderland, a country consisting of $n \geqslant 2$ towns. For every

pair of towns, there is a narrow road going from one town to the other. One day, all the roads are declared to be "one way" only. Alice has no information on the direction of the roads, but the King of Hearts has offered to help her. She is allowed to ask him a number of questions. For each question in turn, Alice chooses a pair of towns and the King of Hearts tells her the direction of the road connecting those two towns.

Alice wants to know whether there is at least one town in Wonderland with at most one outgoing road. Prove that she can always find out by asking at most $4 n$ questions.

Comment. This problem could be posed with an explicit statement about points being awarded for weaker bounds $c n$ for some $c>4$, in the style of IMO 2014 Problem 6. (Thailand) Solution. We will show Alice needs to ask at most $4 n-7$ questions. Her strategy has the following phases. In what follows, $S$ is the set of towns that Alice, so far, does not know to have more than one outgoing road (so initially $|S|=n$ ).

Phase 1. Alice chooses any two towns, say $A$ and $B$. Without loss of generality, suppose that the King of Hearts' answer is that the road goes from $A$ to $B$.

At the end of this phase, Alice has asked 1 question. Phase 2. During this phase there is a single (variable) town $T$ that is known to have at least one incoming road but not yet known to have any outgoing roads. Initially, $T$ is $B$. Alice does the following $n-2$ times: she picks a town $X$ she has not asked about before, and asks the direction of the road between $T$ and $X$. If it is from $X$ to $T, T$ is unchanged; if it is from $T$ to $X, X$ becomes the new choice of town $T$, as the previous $T$ is now known to have an outgoing road.

At the end of this phase, Alice has asked a total of $n-1$ questions. The final town $T$ is not yet known to have any outgoing roads, while every other town has exactly one outgoing road known. The undirected graph of roads whose directions are known is a tree.

Phase 3. During this phase, Alice asks about the directions of all roads between $T$ and another town she has not previously asked about, stopping if she finds two outgoing roads from $T$. This phase involves at most $n-2$ questions. If she does not find two outgoing roads from $T$, she has answered her original question with at most $2 n-3 \leqslant 4 n-7$ questions, so in what follows we suppose that she does find two outgoing roads, asking a total of $k$ questions in this phase, where $2 \leqslant k \leqslant n-2$ (and thus $n \geqslant 4$ for what follows).

For every question where the road goes towards $T$, the town at the other end is removed from $S$ (as it already had one outgoing road known), while the last question resulted in $T$ being removed from $S$. So at the end of this phase, $|S|=n-k+1$, while a total of $n+k-1$ questions have been asked. Furthermore, the undirected graph of roads within $S$ whose directions are known contains no cycles (as $T$ is no longer a member of $S$, all questions asked in this phase involved $T$ and the graph was a tree before this phase started). Every town in $S$ has exactly one outgoing road known (not necessarily to another town in $S$ ).

Phase 4. During this phase, Alice repeatedly picks any pair of towns in $S$ for which she does not know the direction of the road between them. Because every town in $S$ has exactly one outgoing road known, this always results in the removal of one of those two towns from $S$. Because there are no cycles in the graph of roads of known direction within $S$, this can continue until there are at most 2 towns left in $S$.

If it ends with $t$ towns left, $n-k+1-t$ questions were asked in this phase, so a total of $2 n-t$ questions have been asked.

Phase 5. During this phase, Alice asks about all the roads from the remaining towns in $S$ that she has not previously asked about. She has definitely already asked about any road between those towns (if $t=2$ ). She must also have asked in one of the first two phases about at least one other road involving one of those towns (as those phases resulted in a tree with $n>2$ vertices). So she asks at most $t(n-t)-1$ questions in this phase.

At the end of this phase, Alice knows whether any town has at most one outgoing road. If $t=1$, at most $3 n-3 \leqslant 4 n-7$ questions were needed in total, while if $t=2$, at most $4 n-7$ questions were needed in total.

Comment 1. The version of this problem originally submitted asked only for an upper bound of $5 n$, which is much simpler to prove. The Problem Selection Committee preferred a version with an asymptotically optimal constant. In the following comment, we will show that the constant is optimal.

Comment 2. We will show that Alice cannot always find out by asking at most $4 n-3\left(\log _{2} n\right)-$ 15 questions, if $n \geqslant 8$.

To show this, we suppose the King of Hearts is choosing the directions as he goes along, only picking the direction of a road when Alice asks about it for the first time. We provide a strategy for the King of Hearts that ensures that, after the given number of questions, the map is still consistent both with the existence of a town with at most one outgoing road, and with the nonexistence of such a town. His strategy has the following phases. When describing how the King of Hearts' answer to a question is determined below, we always assume he is being asked about a road for the first time (otherwise, he just repeats his previous answer for that road). This strategy is described throughout in graph-theoretic terms (vertices and edges rather than towns and roads).

Phase 1. In this phase, we consider the undirected graph formed by edges whose directions are known. The phase terminates when there are exactly 8 connected components whose undirected graphs are trees. The following invariant is maintained: in a component with $k$ vertices whose undirected graph is a tree, every vertex has at most $\left[\log _{2} k\right\rfloor$ edges into it.

  • If the King of Hearts is asked about an edge between two vertices in the same component, or about an edge between two components at least one of which is not a tree, he chooses any direction for that edge arbitrarily.
  • If he is asked about an edge between a vertex in component $A$ that has $a$ vertices and is a tree and a vertex in component $B$ that has $b$ vertices and is a tree, suppose without loss of generality that $a \geqslant b$. He then chooses the edge to go from $A$ to $B$. In this case, the new number of edges into any vertex is at most $\max \left{\left\lfloor\log _{2} a\right\rfloor,\left\lfloor\log _{2} b\right\rfloor+1\right} \leqslant\left\lfloor\log _{2}(a+b)\right\rfloor$.

In all cases, the invariant is preserved, and the number of tree components either remains unchanged or goes down by 1. Assuming Alice does not repeat questions, the process must eventually terminate with 8 tree components, and at least $n-8$ questions having been asked.

Note that each tree component contains at least one vertex with no outgoing edges. Colour one such vertex in each tree component red.

Phase 2. Let $V_{1}, V_{2}$ and $V_{3}$ be the three of the red vertices whose components are smallest (so their components together have at most $\left\lfloor\frac{3}{8} n\right\rfloor$ vertices, with each component having at most $\left\lfloor\frac{3}{8} n-2\right\rfloor$ vertices). Let sets $C_{1}, C_{2}, \ldots$ be the connected components after removing the $V_{j}$. By construction, there are no edges with known direction between $C_{i}$ and $C_{j}$ for $i \neq j$, and there are at least five such components.

If at any point during this phase, the King of Hearts is asked about an edge within one of the $C_{i}$, he chooses an arbitrary direction. If he is asked about an edge between $C_{i}$ and $C_{j}$ for $i \neq j$, he answers so that all edges go from $C_{i}$ to $C_{i+1}$ and $C_{i+2}$, with indices taken modulo the number of components, and chooses arbitrarily for other pairs. This ensures that all vertices other than the $V_{j}$ will have more than one outgoing edge.

For edges involving one of the $V_{j}$ he answers as follows, so as to remain consistent for as long as possible with both possibilities for whether one of those vertices has at most one outgoing edge. Note that as they were red vertices, they have no outgoing edges at the start of this phase. For edges between two of the $V_{j}$, he answers that the edges go from $V_{1}$ to $V_{2}$, from $V_{2}$ to $V_{3}$ and from $V_{3}$ to $V_{1}$. For edges between $V_{j}$ and some other vertex, he always answers that the edge goes into $V_{j}$, except for the last such edge for which he is asked the question for any given $V_{j}$, for which he answers that the edge goes out of $V_{j}$. Thus, as long as at least one of the $V_{j}$ has not had the question answered for all the vertices that are not among the $V_{j}$, his answers are still compatible both with all vertices having more than one outgoing edge, and with that $V_{j}$ having only one outgoing edge.

At the start of this phase, each of the $V_{j}$ has at most $\left\lfloor\log _{2}\left\lfloor\frac{3}{8} n-2\right\rfloor\right\rfloor<\left(\log _{2} n\right)-1$ incoming edges. Thus, Alice cannot determine whether some vertex has only one outgoing edge within $3(n-$ $\left.3-\left(\left(\log _{2} n\right)-1\right)\right)-1$ questions in this phase; that is, $4 n-3\left(\log _{2} n\right)-15$ questions total.

Comment 3. We can also improve the upper bound slightly, to $4 n-2\left(\log _{2} n\right)+1$. (We do not know where the precise minimum number of questions lies between $4 n-3\left(\log _{2} n\right)+O(1)$ and $4 n-2\left(\log _{2} n\right)+$ $O(1)$.) Suppose $n \geqslant 5$ (otherwise no questions are required at all).

To do this, we replace Phases 1 and 2 of the given solution with a different strategy that also results in a spanning tree where one vertex $V$ is not known to have any outgoing edges, and all other vertices have exactly one outgoing edge known, but where there is more control over the numbers of incoming edges. In Phases 3 and 4 we then take more care about the order in which pairs of towns are chosen, to ensure that each of the remaining towns has already had a question asked about at least $\log _{2} n+O(1)$ edges.

Define trees $T_{m}$ with $2^{m}$ vertices, exactly one of which (the root) has no outgoing edges and the rest of which have exactly one outgoing edge, as follows: $T_{0}$ is a single vertex, while $T_{m}$ is constructed by joining the roots of two copies of $T_{m-1}$ with an edge in either direction. If $n=2^{m}$ we can readily ask $n-1$ questions, resulting in a tree $T_{m}$ for the edges with known direction: first ask about $2^{m-1}$ disjoint pairs of vertices, then about $2^{m-2}$ disjoint pairs of the roots of the resulting $T_{1}$ trees, and so on. For the general case, where $n$ is not a power of 2 , after $k$ stages of this process we have $\left\lfloor n / 2^{k}\right\rfloor$ trees, each of which is like $T_{k}$ but may have some extra vertices (but, however, a unique root). If there are an even number of trees, then ask about pairs of their roots. If there are an odd number (greater than 1) of trees, when a single $T_{k}$ is left over, ask about its root together with that of one of the $T_{k+1}$ trees.

Say $m=\left\lfloor\log {2} n\right\rfloor$. The result of that process is a single $T{m}$ tree, possibly with some extra vertices but still a unique root $V$. That root has at least $m$ incoming edges, and we may list vertices $V_{0}$, $\ldots, V_{m-1}$ with edges to $V$, such that, for all $0 \leqslant i<m$, vertex $V_{i}$ itself has at least $i$ incoming edges.

Now divide the vertices other than $V$ into two parts: $A$ has all vertices at an odd distance from $V$ and $B$ has all the vertices at an even distance from $B$. Both $A$ and $B$ are nonempty; $A$ contains the $V_{i}$, while $B$ contains a sequence of vertices with at least $0,1, \ldots, m-2$ incoming edges respectively, similar to the $V_{i}$. There are no edges with known direction within $A$ or within $B$.

In Phase 3, then ask about edges between $V$ and other vertices: first those in $B$, in order of increasing number of incoming edges to the other vertex, then those in $A$, again in order of increasing number of incoming edges, which involves asking at most $n-1-m$ questions in this phase. If two outgoing edges are not found from $V$, at most $2 n-2-m \leqslant 4 n-2\left(\log {2} n\right)+1$ questions needed to be asked in total, so we suppose that two outgoing edges were found, with $k$ questions asked in this phase, where $2 \leqslant k \leqslant n-1-m$. The state of $S$ is as described in the solution above, with the additional property that, since $S$ must still contain all vertices with edges to $V$, it contains the vertices $V{i}$ described above.

In Phase 4, consider the vertices left in $B$, in increasing order of number of edges incoming to a vertex. If $s$ is the least number of incoming edges to such a vertex, then, for any $s \leqslant t \leqslant m-2$, there are at least $m-t-2$ vertices with more than $t$ incoming edges. Repeatedly asking about the pair of vertices left in $B$ with the least numbers of incoming edges results in a single vertex left over (if any were in $B$ at all at the start of this phase) with at least $m-2$ incoming edges. Doing the same with $A$ (which must be nonempty) leaves a vertex with at least $m-1$ incoming edges.

Thus if only $A$ is nonempty we ask at most $n-m$ questions in Phase 5 , so in total at most $3 n-m-1$ questions, while if both are nonempty we ask at most $2 n-2 m+1$ questions in Phase 5 , so in total at most $4 n-2 m-1<4 n-2\left(\log _{2} n\right)+1$ questions.

This page is intentionally left blank

C9.

For any two different real numbers $x$ and $y$, we define $D(x, y)$ to be the unique integer $d$ satisfying $2^{d} \leqslant|x-y|<2^{d+1}$. Given a set of reals $\mathcal{F}$, and an element $x \in \mathcal{F}$, we say that the scales of $x$ in $\mathcal{F}$ are the values of $D(x, y)$ for $y \in \mathcal{F}$ with $x \neq y$.

Let $k$ be a given positive integer. Suppose that each member $x$ of $\mathcal{F}$ has at most $k$ different scales in $\mathcal{F}$ (note that these scales may depend on $x$ ). What is the maximum possible size of $\mathcal{F}$ ? (Italy) Answer: The maximum possible size of $\mathcal{F}$ is $2^{k}$. Common remarks. For convenience, we extend the use of the word scale: we say that the scale between two reals $x$ and $y$ is $D(x, y)$.

Solution. We first construct a set $\mathcal{F}$ with $2^{k}$ members, each member having at most $k$ different scales in $\mathcal{F}$. Take $\mathcal{F}=\left{0,1,2, \ldots, 2^{k}-1\right}$. The scale between any two members of $\mathcal{F}$ is in the set ${0,1, \ldots, k-1}$.

We now show that $2^{k}$ is an upper bound on the size of $\mathcal{F}$. For every finite set $\mathcal{S}$ of real numbers, and every real $x$, let $r_{\mathcal{S}}(x)$ denote the number of different scales of $x$ in $\mathcal{S}$. That is, $r_{\mathcal{S}}(x)=|{D(x, y): x \neq y \in \mathcal{S}}|$. Thus, for every element $x$ of the set $\mathcal{F}$ in the problem statement, we have $r_{\mathcal{F}}(x) \leqslant k$. The condition $|\mathcal{F}| \leqslant 2^{k}$ is an immediate consequence of the following lemma. Lemma. Let $\mathcal{S}$ be a finite set of real numbers, and define

w(S)=xS2rS(x) w(\mathcal{S})=\sum_{x \in \mathcal{S}} 2^{-r_{\mathcal{S}}(x)}

Then $w(\mathcal{S}) \leqslant 1$. Proof. Induction on $n=|\mathcal{S}|$. If $\mathcal{S}={x}$, then $r_{\mathcal{S}}(x)=0$, so $w(\mathcal{S})=1$. Assume now $n \geqslant 2$, and let $x_{1}<\cdots<x_{n}$ list the members of $\mathcal{S}$. Let $d$ be the minimal scale between two distinct elements of $\mathcal{S}$; then there exist neighbours $x_{t}$ and $x_{t+1}$ with $D\left(x_{t}, x_{t+1}\right)=d$. Notice that for any two indices $i$ and $j$ with $j-i>1$ we have $D\left(x_{i}, x_{j}\right)>d$, since

xixj=xi+1xi+xjxi+12d+2d=2d+1. \left|x_{i}-x_{j}\right|=\left|x_{i+1}-x_{i}\right|+\left|x_{j}-x_{i+1}\right| \geqslant 2^{d}+2^{d}=2^{d+1} .

Now choose the minimal $i \leqslant t$ and the maximal $j \geqslant t+1$ such that $D\left(x_{i}, x_{i+1}\right)=$ $D\left(x_{i+1}, x_{i+2}\right)=\cdots=D\left(x_{j-1}, x_{j}\right)=d$.

Let $E$ be the set of all the $x_{s}$ with even indices $i \leqslant s \leqslant j, O$ be the set of those with odd indices $i \leqslant s \leqslant j$, and $R$ be the rest of the elements (so that $\mathcal{S}$ is the disjoint union of $E, O$ and $R$ ). Set $\mathcal{S}{O}=R \cup O$ and $\mathcal{S}{E}=R \cup E$; we have $\left|\mathcal{S}{O}\right|<|\mathcal{S}|$ and $\left|\mathcal{S}{E}\right|<|\mathcal{S}|$, so $w\left(\mathcal{S}{O}\right), w\left(\mathcal{S}{E}\right) \leqslant 1$ by the inductive hypothesis.

Clearly, $r_{\mathcal{S}{O}}(x) \leqslant r{\mathcal{S}}(x)$ and $r_{\mathcal{S}{E}}(x) \leqslant r{\mathcal{S}}(x)$ for any $x \in R$, and thus

xR2rS(x)=12xR(2rS(x)+2rS(x))12xR(2rSO(x)+2rSE(x)) \begin{aligned} \sum_{x \in R} 2^{-r_{\mathcal{S}}(x)} & =\frac{1}{2} \sum_{x \in R}\left(2^{-r_{\mathcal{S}}(x)}+2^{-r_{\mathcal{S}}(x)}\right) \\ & \leqslant \frac{1}{2} \sum_{x \in R}\left(2^{-r_{\mathcal{S}_{O}}(x)}+2^{-r_{\mathcal{S}_{E}}(x)}\right) \end{aligned}

On the other hand, for every $x \in O$, there is no $y \in \mathcal{S}{O}$ such that $D{\mathcal{S}{O}}(x, y)=d$ (as all candidates from $\mathcal{S}$ were in $E$ ). Hence, we have $r{\mathcal{S}{O}}(x) \leqslant r{\mathcal{S}}(x)-1$, and thus

xO2rSS(x)12xO2rsO(x) \sum_{x \in O} 2^{-r \mathcal{S}_{\mathcal{S}}(x)} \leqslant \frac{1}{2} \sum_{x \in O} 2^{-r s_{O}(x)}

Similarly, for every $x \in E$, we have

xE2rS(x)12xE2rSE(x) \sum_{x \in E} 2^{-r_{\mathcal{S}}(x)} \leqslant \frac{1}{2} \sum_{x \in E} 2^{-r_{\mathcal{S}_{E}}(x)}

We can then combine these to give

w(S)=xR2rS(x)+xO2rS(x)+xE2rS(x)12xR(2rSO(x)+2rSE(x))+12xO2rSO(x)+12xE2rSE(x)=12(xSO2rSO(x)+xSE2rsSE(x)) (since SO=OR and SE=ER)=12(w(SO)+w(SE))) (by definition of w())1 (by the inductive hypothesis)  \begin{aligned} w(S) & =\sum_{x \in R} 2^{-r_{\mathcal{S}}(x)}+\sum_{x \in O} 2^{-r_{\mathcal{S}}(x)}+\sum_{x \in E} 2^{-r_{\mathcal{S}}(x)} \\ & \leqslant \frac{1}{2} \sum_{x \in R}\left(2^{-r_{\mathcal{S}_{O}}(x)}+2^{-r_{\mathcal{S}_{E}}(x)}\right)+\frac{1}{2} \sum_{x \in O} 2^{-r_{\mathcal{S}_{O}}(x)}+\frac{1}{2} \sum_{x \in E} 2^{-r_{\mathcal{S}_{E}}(x)} \\ & \left.=\frac{1}{2}\left(\sum_{x \in \mathcal{S}_{O}} 2^{-r_{S_{O}}(x)}+\sum_{x \in \mathcal{S}_{E}} 2^{-r s_{S_{E}}(x)}\right) \quad \text { (since } \mathcal{S}_{O}=O \cup R \text { and } \mathcal{S}_{E}=E \cup R\right) \\ & \left.\left.=\frac{1}{2}\left(w\left(\mathcal{S}_{O}\right)+w\left(\mathcal{S}_{E}\right)\right)\right) \quad \text { (by definition of } w(\cdot)\right) \\ & \leqslant 1 \quad \text { (by the inductive hypothesis) } \end{aligned}

which completes the induction. Comment 1. The sets $O$ and $E$ above are not the only ones we could have chosen. Indeed, we could instead have used the following definitions:

Let $d$ be the maximal scale between two distinct elements of $\mathcal{S}$; that is, $d=D\left(x_{1}, x_{n}\right)$. Let $O=\left{x \in \mathcal{S}: D\left(x, x_{n}\right)=d\right}$ (a 'left' part of the set) and let $E=\left{x \in \mathcal{S}: D\left(x_{1}, x\right)=d\right}$ (a 'right' part of the set). Note that these two sets are disjoint, and nonempty (since they contain $x_{1}$ and $x_{n}$ respectively). The rest of the proof is then the same as in Solution 1.

Comment 2. Another possible set $\mathcal{F}$ containing $2^{k}$ members could arise from considering a binary tree of height $k$, allocating a real number to each leaf, and trying to make the scale between the values of two leaves dependent only on the (graph) distance between them. The following construction makes this more precise.

We build up sets $\mathcal{F}{k}$ recursively. Let $\mathcal{F}{0}={0}$, and then let $\mathcal{F}{k+1}=\mathcal{F}{k} \cup\left{x+3 \cdot 4^{k}: x \in \mathcal{F}{k}\right}$ (i.e. each half of $\mathcal{F}{k+1}$ is a copy of $F_{k}$ ). We have that $\mathcal{F}{k}$ is contained in the interval $\left[0,4^{k+1}\right.$ ), and so it follows by induction on $k$ that every member of $F{k+1}$ has $k$ different scales in its own half of $F_{k+1}$ (by the inductive hypothesis), and only the single scale $2 k+1$ in the other half of $F_{k+1}$.

Both of the constructions presented here have the property that every member of $\mathcal{F}$ has exactly $k$ different scales in $\mathcal{F}$. Indeed, it can be seen that this must hold (up to a slight perturbation) for any such maximal set. Suppose there were some element $x$ with only $k-1$ different scales in $\mathcal{F}$ (and every other element had at most $k$ different scales). Then we take some positive real $\epsilon$, and construct a new set $\mathcal{F}^{\prime}={y: y \in \mathcal{F}, y \leqslant x} \cup{y+\epsilon: y \in \mathcal{F}, y \geqslant x}$. We have $\left|\mathcal{F}^{\prime}\right|=|\mathcal{F}|+1$, and if $\epsilon$ is sufficiently small then $\mathcal{F}^{\prime}$ will also satisfy the property that no member has more than $k$ different scales in $\mathcal{F}^{\prime}$.

This observation might be used to motivate the idea of weighting members of an arbitrary set $\mathcal{S}$ of reals according to how many different scales they have in $\mathcal{S}$.

Geometry

G1. Let $A B C$ be a triangle. Circle $\Gamma$ passes through $A$, meets segments $A B$ and $A C$ again at points $D$ and $E$ respectively, and intersects segment $B C$ at $F$ and $G$ such that $F$ lies between $B$ and $G$. The tangent to circle $B D F$ at $F$ and the tangent to circle $C E G$ at $G$ meet at point $T$. Suppose that points $A$ and $T$ are distinct. Prove that line $A T$ is parallel to $B C$. (Nigeria) Solution. Notice that $\angle T F B=\angle F D A$ because $F T$ is tangent to circle $B D F$, and moreover $\angle F D A=\angle C G A$ because quadrilateral $A D F G$ is cyclic. Similarly, $\angle T G B=\angle G E C$ because $G T$ is tangent to circle $C E G$, and $\angle G E C=\angle C F A$. Hence,

TFB=CGA and TGB=CFA \angle T F B=\angle C G A \text { and } \quad \angle T G B=\angle C F A

Triangles $F G A$ and $G F T$ have a common side $F G$, and by (1) their angles at $F, G$ are the same. So, these triangles are congruent. So, their altitudes starting from $A$ and $T$, respectively, are equal and hence $A T$ is parallel to line $B F G C$.

Comment. Alternatively, we can prove first that $T$ lies on $\Gamma$. For example, this can be done by showing that $\angle A F T=\angle A G T$ using (1). Then the statement follows as $\angle T A F=\angle T G F=\angle G F A$.

G2. Let $A B C$ be an acute-angled triangle and let $D, E$, and $F$ be the feet of altitudes

from $A, B$, and $C$ to sides $B C, C A$, and $A B$, respectively. Denote by $\omega_{B}$ and $\omega_{C}$ the incircles of triangles $B D F$ and $C D E$, and let these circles be tangent to segments $D F$ and $D E$ at $M$ and $N$, respectively. Let line $M N$ meet circles $\omega_{B}$ and $\omega_{C}$ again at $P \neq M$ and $Q \neq N$, respectively. Prove that $M P=N Q$. (Vietnam) Solution. Denote the centres of $\omega_{B}$ and $\omega_{C}$ by $O_{B}$ and $O_{C}$, let their radii be $r_{B}$ and $r_{C}$, and let $B C$ be tangent to the two circles at $T$ and $U$, respectively.

From the cyclic quadrilaterals $A F D C$ and $A B D E$ we have

MDOB=12FDB=12BAC=12CDE=OCDN, \angle M D O_{B}=\frac{1}{2} \angle F D B=\frac{1}{2} \angle B A C=\frac{1}{2} \angle C D E=\angle O_{C} D N,

so the right-angled triangles $D M O_{B}$ and $D N O_{C}$ are similar. The ratio of similarity between the two triangles is

DNDM=OCNOBM=rCrB. \frac{D N}{D M}=\frac{O_{C} N}{O_{B} M}=\frac{r_{C}}{r_{B}} .

Let $\varphi=\angle D M N$ and $\psi=\angle M N D$. The lines $F M$ and $E N$ are tangent to $\omega_{B}$ and $\omega_{C}$, respectively, so

MTP=FMP=DMN=φ and QUN=QNE=MND=ψ \angle M T P=\angle F M P=\angle D M N=\varphi \quad \text { and } \quad \angle Q U N=\angle Q N E=\angle M N D=\psi

(It is possible that $P$ or $Q$ coincides with $T$ or $U$, or lie inside triangles $D M T$ or $D U N$, respectively. To reduce case-sensitivity, we may use directed angles or simply ignore angles $M T P$ and $Q U N$.)

In the circles $\omega_{B}$ and $\omega_{C}$ the lengths of chords $M P$ and $N Q$ are

MP=2rBsinMTP=2rBsinφ and NQ=2rCsinQUN=2rCsinψ M P=2 r_{B} \cdot \sin \angle M T P=2 r_{B} \cdot \sin \varphi \quad \text { and } \quad N Q=2 r_{C} \cdot \sin \angle Q U N=2 r_{C} \cdot \sin \psi

By applying the sine rule to triangle $D N M$ we get

DNDM=sinDMNsinMND=sinφsinψ \frac{D N}{D M}=\frac{\sin \angle D M N}{\sin \angle M N D}=\frac{\sin \varphi}{\sin \psi}

Finally, putting the above observations together, we get

MPNQ=2rBsinφ2rCsinψ=rBrCsinφsinψ=DMDNsinφsinψ=sinψsinφsinφsinψ=1, \frac{M P}{N Q}=\frac{2 r_{B} \sin \varphi}{2 r_{C} \sin \psi}=\frac{r_{B}}{r_{C}} \cdot \frac{\sin \varphi}{\sin \psi}=\frac{D M}{D N} \cdot \frac{\sin \varphi}{\sin \psi}=\frac{\sin \psi}{\sin \varphi} \cdot \frac{\sin \varphi}{\sin \psi}=1,

so $M P=N Q$ as required.

G3. In triangle $A B C$, let $A_{1}$ and $B_{1}$ be two points on sides $B C$ and $A C$, and let $P$ and $Q$ be two points on segments $A A_{1}$ and $B B_{1}$, respectively, so that line $P Q$ is parallel to $A B$. On ray $P B_{1}$, beyond $B_{1}$, let $P_{1}$ be a point so that $\angle P P_{1} C=\angle B A C$. Similarly, on ray $Q A_{1}$, beyond $A_{1}$, let $Q_{1}$ be a point so that $\angle C Q_{1} Q=\angle C B A$. Show that points $P, Q, P_{1}$, and $Q_{1}$ are concyclic. (Ukraine) Solution 1. Throughout the solution we use oriented angles. Let rays $A A_{1}$ and $B B_{1}$ intersect the circumcircle of $\triangle A C B$ at $A_{2}$ and $B_{2}$, respectively. By

QPA2=BAA2=BB2A2=QB2A2 \angle Q P A_{2}=\angle B A A_{2}=\angle B B_{2} A_{2}=\angle Q B_{2} A_{2}

points $P, Q, A_{2}, B_{2}$ are concyclic; denote the circle passing through these points by $\omega$. We shall prove that $P_{1}$ and $Q_{1}$ also lie on $\omega$.

By

CA2A1=CA2A=CBA=CQ1Q=CQ1A1, \angle C A_{2} A_{1}=\angle C A_{2} A=\angle C B A=\angle C Q_{1} Q=\angle C Q_{1} A_{1},

points $C, Q_{1}, A_{2}, A_{1}$ are also concyclic. From that we get

QQ1A2=A1Q1A2=A1CA2=BCA2=BAA2=QPA2 \angle Q Q_{1} A_{2}=\angle A_{1} Q_{1} A_{2}=\angle A_{1} C A_{2}=\angle B C A_{2}=\angle B A A_{2}=\angle Q P A_{2}

so $Q_{1}$ lies on $\omega$. It follows similarly that $P_{1}$ lies on $\omega$. Solution 2. First consider the case when lines $P P_{1}$ and $Q Q_{1}$ intersect each other at some point $R$.

Let line $P Q$ meet the sides $A C$ and $B C$ at $E$ and $F$, respectively. Then

PP1C=BAC=PEC \angle P P_{1} C=\angle B A C=\angle P E C

so points $C, E, P, P_{1}$ lie on a circle; denote that circle by $\omega_{P}$. It follows analogously that points $C, F, Q, Q_{1}$ lie on another circle; denote it by $\omega_{Q}$.

Let $A Q$ and $B P$ intersect at $T$. Applying Pappus' theorem to the lines $A A_{1} P$ and $B B_{1} Q$ provides that points $C=A B_{1} \cap B A_{1}, R=A_{1} Q \cap B_{1} P$ and $T=A Q \cap B P$ are collinear.

Let line $R C T$ meet $P Q$ and $A B$ at $S$ and $U$, respectively. From $A B | P Q$ we obtain

SPSQ=UBUA=SFSE \frac{S P}{S Q}=\frac{U B}{U A}=\frac{S F}{S E}

so

SPSE=SQSF S P \cdot S E=S Q \cdot S F

So, point $S$ has equal powers with respect to $\omega_{P}$ and $\omega_{Q}$, hence line $R C S$ is their radical axis; then $R$ also has equal powers to the circles, so $R P \cdot R P_{1}=R Q \cdot R Q_{1}$, proving that points $P, P_{1}, Q, Q_{1}$ are indeed concyclic.

Now consider the case when $P P_{1}$ and $Q Q_{1}$ are parallel. Like in the previous case, let $A Q$ and $B P$ intersect at $T$. Applying Pappus' theorem again to the lines $A A_{1} P$ and $B B_{1} Q$, in this limit case it shows that line $C T$ is parallel to $P P_{1}$ and $Q Q_{1}$.

Let line $C T$ meet $P Q$ and $A B$ at $S$ and $U$, as before. The same calculation as in the previous case shows that $S P \cdot S E=S Q \cdot S F$, so $S$ lies on the radical axis between $\omega_{P}$ and $\omega_{Q}$.

Line $C S T$, that is the radical axis between $\omega_{P}$ and $\omega_{Q}$, is perpendicular to the line $\ell$ of centres of $\omega_{P}$ and $\omega_{Q}$. Hence, the chords $P P_{1}$ and $Q Q_{1}$ are perpendicular to $\ell$. So the quadrilateral $P P_{1} Q_{1} Q$ is an isosceles trapezium with symmetry axis $\ell$, and hence is cyclic.

Comment. There are several ways of solving the problem involving Pappus' theorem. For example, one may consider the points $K=P B_{1} \cap B C$ and $L=Q A_{1} \cap A C$. Applying Pappus' theorem to the lines $A A_{1} P$ and $Q B_{1} B$ we get that $K, L$, and $P Q \cap A B$ are collinear, i.e. that $K L | A B$. Therefore, cyclicity of $P, Q, P_{1}$, and $Q_{1}$ is equivalent to that of $K, L, P_{1}$, and $Q_{1}$. The latter is easy after noticing that $C$ also lies on that circle. Indeed, e.g. $\angle(L K, L C)=\angle(A B, A C)=\angle\left(P_{1} K, P_{1} C\right)$ shows that $K$ lies on circle $K L C$.

This approach also has some possible degeneracy, as the points $K$ and $L$ may happen to be ideal.

G4. Let $P$ be a point inside triangle $A B C$. Let $A P$ meet $B C$ at $A_{1}$, let $B P$ meet $C A$ at $B_{1}$, and let $C P$ meet $A B$ at $C_{1}$. Let $A_{2}$ be the point such that $A_{1}$ is the midpoint of $P A_{2}$, let $B_{2}$ be the point such that $B_{1}$ is the midpoint of $P B_{2}$, and let $C_{2}$ be the point such that $C_{1}$ is the midpoint of $P C_{2}$. Prove that points $A_{2}, B_{2}$, and $C_{2}$ cannot all lie strictly inside the circumcircle of triangle $A B C$. (Australia)

Solution 1. Since

APB+BPC+CPA=2π=(πACB)+(πBAC)+(πCBA), \angle A P B+\angle B P C+\angle C P A=2 \pi=(\pi-\angle A C B)+(\pi-\angle B A C)+(\pi-\angle C B A),

at least one of the following inequalities holds:

APBπACB,BPCπBAC,CPAπCBA. \angle A P B \geqslant \pi-\angle A C B, \quad \angle B P C \geqslant \pi-\angle B A C, \quad \angle C P A \geqslant \pi-\angle C B A .

Without loss of generality, we assume that $\angle B P C \geqslant \pi-\angle B A C$. We have $\angle B P C>\angle B A C$ because $P$ is inside $\triangle A B C$. So $\angle B P C \geqslant \max (\angle B A C, \pi-\angle B A C)$ and hence

sinBPCsinBAC. \sin \angle B P C \leqslant \sin \angle B A C .

Let the rays $A P, B P$, and $C P$ cross the circumcircle $\Omega$ again at $A_{3}, B_{3}$, and $C_{3}$, respectively. We will prove that at least one of the ratios $\frac{P B_{1}}{B_{1} B_{3}}$ and $\frac{P C_{1}}{C_{1} C_{3}}$ is at least 1 , which yields that one of the points $B_{2}$ and $C_{2}$ does not lie strictly inside $\Omega$.

Because $A, B, C, B_{3}$ lie on a circle, the triangles $C B_{1} B_{3}$ and $B B_{1} A$ are similar, so

CB1B1B3=BB1B1A \frac{C B_{1}}{B_{1} B_{3}}=\frac{B B_{1}}{B_{1} A}

Applying the sine rule we obtain

PB1B1B3=PB1CB1CB1B1B3=PB1CB1BB1B1A=sinACPsinBPCsinBACsinPBA. \frac{P B_{1}}{B_{1} B_{3}}=\frac{P B_{1}}{C B_{1}} \cdot \frac{C B_{1}}{B_{1} B_{3}}=\frac{P B_{1}}{C B_{1}} \cdot \frac{B B_{1}}{B_{1} A}=\frac{\sin \angle A C P}{\sin \angle B P C} \cdot \frac{\sin \angle B A C}{\sin \angle P B A} .

Similarly,

PC1C1C3=sinPBAsinBPCsinBACsinACP \frac{P C_{1}}{C_{1} C_{3}}=\frac{\sin \angle P B A}{\sin \angle B P C} \cdot \frac{\sin \angle B A C}{\sin \angle A C P}

Multiplying these two equations we get

PB1B1B3PC1C1C3=sin2BACsin2BPC1 \frac{P B_{1}}{B_{1} B_{3}} \cdot \frac{P C_{1}}{C_{1} C_{3}}=\frac{\sin ^{2} \angle B A C}{\sin ^{2} \angle B P C} \geqslant 1

using (*), which yields the desired conclusion.

Comment. It also cannot happen that all three points $A_{2}, B_{2}$, and $C_{2}$ lie strictly outside $\Omega$. The same proof works almost literally, starting by assuming without loss of generality that $\angle B P C \leqslant \pi-\angle B A C$ and using $\angle B P C>\angle B A C$ to deduce that $\sin \angle B P C \geqslant \sin \angle B A C$. It is possible for $A_{2}, B_{2}$, and $C_{2}$ all to lie on the circumcircle; from the above solution we may derive that this happens if and only if $P$ is the orthocentre of the triangle $A B C$, (which lies strictly inside $A B C$ if and only if $A B C$ is acute).

Solution 2. Define points $A_{3}, B_{3}$, and $C_{3}$ as in Solution 1. Assume for the sake of contradiction that $A_{2}, B_{2}$, and $C_{2}$ all lie strictly inside circle $A B C$. It follows that $P A_{1}<A_{1} A_{3}, P B_{1}<B_{1} B_{3}$, and $P C_{1}<C_{1} C_{3}$.

Observe that $\triangle P B C_{3} \sim \triangle P C B_{3}$. Let $X$ be the point on side $P B_{3}$ that corresponds to point $C_{1}$ on side $P C_{3}$ under this similarity. In other words, $X$ lies on segment $P B_{3}$ and satisfies $P X: X B_{3}=P C_{1}: C_{1} C_{3}$. It follows that

XCP=PBC1=B3BA=B3CB1. \angle X C P=\angle P B C_{1}=\angle B_{3} B A=\angle B_{3} C B_{1} .

Hence lines $C X$ and $C B_{1}$ are isogonal conjugates in $\triangle P C B_{3}$.

Let $Y$ be the foot of the bisector of $\angle B_{3} C P$ in $\triangle P C B_{3}$. Since $P C_{1}<C_{1} C_{3}$, we have $P X<X B_{3}$. Also, we have $P Y<Y B_{3}$ because $P B_{1}<B_{1} B_{3}$ and $Y$ lies between $X$ and $B_{1}$. By the angle bisector theorem in $\triangle P C B_{3}$, we have $P Y: Y B_{3}=P C: C B_{3}$. So $P C<C B_{3}$ and it follows that $\angle P B_{3} C<\angle C P B_{3}$. Now since $\angle P B_{3} C=\angle B B_{3} C=\angle B A C$, we have

BAC<CPB3. \angle B A C<\angle C P B_{3} .

Similarly, we have

CBA<APC3 and ACB<BPA3=B3PA. \angle C B A<\angle A P C_{3} \text { and } \angle A C B<\angle B P A_{3}=\angle B_{3} P A .

Adding these three inequalities yields $\pi<\pi$, and this contradiction concludes the proof.

Solution 3. Choose coordinates such that the circumcentre of $\triangle A B C$ is at the origin and the circumradius is 1 . Then we may think of $A, B$, and $C$ as vectors in $\mathbb{R}^{2}$ such that

A2=B2=C2=1 |A|^{2}=|B|^{2}=|C|^{2}=1

$P$ may be represented as a convex combination $\alpha A+\beta B+\gamma C$ where $\alpha, \beta, \gamma>0$ and $\alpha+\beta+\gamma=1$. Then

A1=βB+γCβ+γ=11αPα1αA, A_{1}=\frac{\beta B+\gamma C}{\beta+\gamma}=\frac{1}{1-\alpha} P-\frac{\alpha}{1-\alpha} A,

so

A2=2A1P=1+α1αP2α1αA A_{2}=2 A_{1}-P=\frac{1+\alpha}{1-\alpha} P-\frac{2 \alpha}{1-\alpha} A

Hence

A22=(1+α1α)2P2+(2α1α)2A24α(1+α)(1α)2AP \left|A_{2}\right|^{2}=\left(\frac{1+\alpha}{1-\alpha}\right)^{2}|P|^{2}+\left(\frac{2 \alpha}{1-\alpha}\right)^{2}|A|^{2}-\frac{4 \alpha(1+\alpha)}{(1-\alpha)^{2}} A \cdot P

Using $|A|^{2}=1$ we obtain

(1α)22(1+α)A22=1+α2P2+2α21+α2αAP \frac{(1-\alpha)^{2}}{2(1+\alpha)}\left|A_{2}\right|^{2}=\frac{1+\alpha}{2}|P|^{2}+\frac{2 \alpha^{2}}{1+\alpha}-2 \alpha A \cdot P

Likewise

(1β)22(1+β)B22=1+β2P2+2β21+β2βBP \frac{(1-\beta)^{2}}{2(1+\beta)}\left|B_{2}\right|^{2}=\frac{1+\beta}{2}|P|^{2}+\frac{2 \beta^{2}}{1+\beta}-2 \beta B \cdot P

and

(1γ)22(1+γ)C22=1+γ2P2+2γ21+γ2γCP \frac{(1-\gamma)^{2}}{2(1+\gamma)}\left|C_{2}\right|^{2}=\frac{1+\gamma}{2}|P|^{2}+\frac{2 \gamma^{2}}{1+\gamma}-2 \gamma C \cdot P

Summing (1), (2) and (3) we obtain on the LHS the positive linear combination

 LHS =(1α)22(1+α)A22+(1β)22(1+β)B22+(1γ)22(1+γ)C22 \text { LHS }=\frac{(1-\alpha)^{2}}{2(1+\alpha)}\left|A_{2}\right|^{2}+\frac{(1-\beta)^{2}}{2(1+\beta)}\left|B_{2}\right|^{2}+\frac{(1-\gamma)^{2}}{2(1+\gamma)}\left|C_{2}\right|^{2}

and on the RHS the quantity

(1+α2+1+β2+1+γ2)P2+(2α21+α+2β21+β+2γ21+γ)2(αAP+βBP+γCP). \left(\frac{1+\alpha}{2}+\frac{1+\beta}{2}+\frac{1+\gamma}{2}\right)|P|^{2}+\left(\frac{2 \alpha^{2}}{1+\alpha}+\frac{2 \beta^{2}}{1+\beta}+\frac{2 \gamma^{2}}{1+\gamma}\right)-2(\alpha A \cdot P+\beta B \cdot P+\gamma C \cdot P) .

The first term is $2|P|^{2}$ and the last term is $-2 P \cdot P$, so

 RHS =(2α21+α+2β21+β+2γ21+γ)=3α12+(1α)22(1+α)+3β12+(1β)22(1+β)+3γ12+(1γ)22(1+γ)=(1α)22(1+α)+(1β)22(1+β)+(1γ)22(1+γ) \begin{aligned} \text { RHS } & =\left(\frac{2 \alpha^{2}}{1+\alpha}+\frac{2 \beta^{2}}{1+\beta}+\frac{2 \gamma^{2}}{1+\gamma}\right) \\ & =\frac{3 \alpha-1}{2}+\frac{(1-\alpha)^{2}}{2(1+\alpha)}+\frac{3 \beta-1}{2}+\frac{(1-\beta)^{2}}{2(1+\beta)}+\frac{3 \gamma-1}{2}+\frac{(1-\gamma)^{2}}{2(1+\gamma)} \\ & =\frac{(1-\alpha)^{2}}{2(1+\alpha)}+\frac{(1-\beta)^{2}}{2(1+\beta)}+\frac{(1-\gamma)^{2}}{2(1+\gamma)} \end{aligned}

Here we used the fact that

3α12+3β12+3γ12=0. \frac{3 \alpha-1}{2}+\frac{3 \beta-1}{2}+\frac{3 \gamma-1}{2}=0 .

We have shown that a linear combination of $\left|A_{1}\right|^{2},\left|B_{1}\right|^{2}$, and $\left|C_{1}\right|^{2}$ with positive coefficients is equal to the sum of the coefficients. Therefore at least one of $\left|A_{1}\right|^{2},\left|B_{1}\right|^{2}$, and $\left|C_{1}\right|^{2}$ must be at least 1 , as required.

Comment. This proof also works when $P$ is any point for which $\alpha, \beta, \gamma>-1, \alpha+\beta+\gamma=1$, and $\alpha, \beta, \gamma \neq 1$. (In any cases where $\alpha=1$ or $\beta=1$ or $\gamma=1$, some points in the construction are not defined.)

This page is intentionally left blank

G5. Let $A B C D E$ be a convex pentagon with $C D=D E$ and $\angle E D C \neq 2 \cdot \angle A D B$.

Suppose that a point $P$ is located in the interior of the pentagon such that $A P=A E$ and $B P=B C$. Prove that $P$ lies on the diagonal $C E$ if and only if area $(B C D)+\operatorname{area}(A D E)=$ $\operatorname{area}(A B D)+\operatorname{area}(A B P)$. (Hungary) Solution 1. Let $P^{\prime}$ be the reflection of $P$ across line $A B$, and let $M$ and $N$ be the midpoints of $P^{\prime} E$ and $P^{\prime} C$ respectively. Convexity ensures that $P^{\prime}$ is distinct from both $E$ and $C$, and hence from both $M$ and $N$. We claim that both the area condition and the collinearity condition in the problem are equivalent to the condition that the (possibly degenerate) right-angled triangles $A P^{\prime} M$ and $B P^{\prime} N$ are directly similar (equivalently, $A P^{\prime} E$ and $B P^{\prime} C$ are directly similar).

For the equivalence with the collinearity condition, let $F$ denote the foot of the perpendicular from $P^{\prime}$ to $A B$, so that $F$ is the midpoint of $P P^{\prime}$. We have that $P$ lies on $C E$ if and only if $F$ lies on $M N$, which occurs if and only if we have the equality $\angle A F M=\angle B F N$ of signed angles modulo $\pi$. By concyclicity of $A P^{\prime} F M$ and $B F P^{\prime} N$, this is equivalent to $\angle A P^{\prime} M=\angle B P^{\prime} N$, which occurs if and only if $A P^{\prime} M$ and $B P^{\prime} N$ are directly similar.

For the other equivalence with the area condition, we have the equality of signed areas $\operatorname{area}(A B D)+\operatorname{area}(A B P)=\operatorname{area}\left(A P^{\prime} B D\right)=\operatorname{area}\left(A P^{\prime} D\right)+\operatorname{area}\left(B D P^{\prime}\right)$. Using the identity $\operatorname{area}(A D E)-\operatorname{area}\left(A P^{\prime} D\right)=\operatorname{area}(A D E)+\operatorname{area}\left(A D P^{\prime}\right)=2$ area $(A D M)$, and similarly for $B$, we find that the area condition is equivalent to the equality

area(DAM)=area(DBN). \operatorname{area}(D A M)=\operatorname{area}(D B N) .

Now note that $A$ and $B$ lie on the perpendicular bisectors of $P^{\prime} E$ and $P^{\prime} C$, respectively. If we write $G$ and $H$ for the feet of the perpendiculars from $D$ to these perpendicular bisectors respectively, then this area condition can be rewritten as

MAGD=NBHD M A \cdot G D=N B \cdot H D

(In this condition, we interpret all lengths as signed lengths according to suitable conventions: for instance, we orient $P^{\prime} E$ from $P^{\prime}$ to $E$, orient the parallel line $D H$ in the same direction, and orient the perpendicular bisector of $P^{\prime} E$ at an angle $\pi / 2$ clockwise from the oriented segment $P^{\prime} E$ - we adopt the analogous conventions at $B$.)

To relate the signed lengths $G D$ and $H D$ to the triangles $A P^{\prime} M$ and $B P^{\prime} N$, we use the following calculation. Claim. Let $\Gamma$ denote the circle centred on $D$ with both $E$ and $C$ on the circumference, and $h$ the power of $P^{\prime}$ with respect to $\Gamma$. Then we have the equality

GDPM=HDPN=14h0. G D \cdot P^{\prime} M=H D \cdot P^{\prime} N=\frac{1}{4} h \neq 0 .

Proof. Firstly, we have $h \neq 0$, since otherwise $P^{\prime}$ would lie on $\Gamma$, and hence the internal angle bisectors of $\angle E D P^{\prime}$ and $\angle P^{\prime} D C$ would pass through $A$ and $B$ respectively. This would violate the angle inequality $\angle E D C \neq 2 \cdot \angle A D B$ given in the question.

Next, let $E^{\prime}$ denote the second point of intersection of $P^{\prime} E$ with $\Gamma$, and let $E^{\prime \prime}$ denote the point on $\Gamma$ diametrically opposite $E^{\prime}$, so that $E^{\prime \prime} E$ is perpendicular to $P^{\prime} E$. The point $G$ lies on the perpendicular bisectors of the sides $P^{\prime} E$ and $E E^{\prime \prime}$ of the right-angled triangle $P^{\prime} E E^{\prime \prime}$; it follows that $G$ is the midpoint of $P^{\prime} E^{\prime \prime}$. Since $D$ is the midpoint of $E^{\prime} E^{\prime \prime}$, we have that $G D=\frac{1}{2} P^{\prime} E^{\prime}$. Since $P^{\prime} M=\frac{1}{2} P^{\prime} E$, we have $G D \cdot P^{\prime} M=\frac{1}{4} P^{\prime} E^{\prime} \cdot P^{\prime} E=\frac{1}{4} h$. The other equality $H D \cdot P^{\prime} N$ follows by exactly the same argument.

From this claim, we see that the area condition is equivalent to the equality

(MA:PM)=(NB:PN) \left(M A: P^{\prime} M\right)=\left(N B: P^{\prime} N\right)

of ratios of signed lengths, which is equivalent to direct similarity of $A P^{\prime} M$ and $B P^{\prime} N$, as desired.

Solution 2. Along the perpendicular bisector of $C E$, define the linear function

f(X)=area(BCX)+area(AXE)area(ABX)area(ABP), f(X)=\operatorname{area}(B C X)+\operatorname{area}(A X E)-\operatorname{area}(A B X)-\operatorname{area}(A B P),

where, from now on, we always use signed areas. Thus, we want to show that $C, P, E$ are collinear if and only if $f(D)=0$.

Let $P^{\prime}$ be the reflection of $P$ across line $A B$. The point $P^{\prime}$ does not lie on the line $C E$. To see this, we let $A^{\prime \prime}$ and $B^{\prime \prime}$ be the points obtained from $A$ and $B$ by dilating with scale factor 2 about $P^{\prime}$, so that $P$ is the orthogonal projection of $P^{\prime}$ onto $A^{\prime \prime} B^{\prime \prime}$. Since $A$ lies on the perpendicular bisector of $P^{\prime} E$, the triangle $A^{\prime \prime} E P^{\prime}$ is right-angled at $E$ (and $B^{\prime \prime} C P^{\prime}$ similarly). If $P^{\prime}$ were to lie on $C E$, then the lines $A^{\prime \prime} E$ and $B^{\prime \prime} C$ would be perpendicular to $C E$ and $A^{\prime \prime}$ and $B^{\prime \prime}$ would lie on the opposite side of $C E$ to $D$. It follows that the line $A^{\prime \prime} B^{\prime \prime}$ does not meet triangle $C D E$, and hence point $P$ does not lie inside $C D E$. But then $P$ must lie inside $A B C E$, and it is clear that such a point cannot reflect to a point $P^{\prime}$ on $C E$.

We thus let $O$ be the centre of the circle $C E P^{\prime}$. The lines $A O$ and $B O$ are the perpendicular bisectors of $E P^{\prime}$ and $C P^{\prime}$, respectively, so

area(BCO)+area(AOE)=area(OPB)+area(POA)=area(PBOA)=area(ABO)+area(BAP)=area(ABO)+area(ABP), \begin{aligned} \operatorname{area}(B C O)+\operatorname{area}(A O E) & =\operatorname{area}\left(O P^{\prime} B\right)+\operatorname{area}\left(P^{\prime} O A\right)=\operatorname{area}\left(P^{\prime} B O A\right) \\ & =\operatorname{area}(A B O)+\operatorname{area}\left(B A P^{\prime}\right)=\operatorname{area}(A B O)+\operatorname{area}(A B P), \end{aligned}

and hence $f(O)=0$. Notice that if point $O$ coincides with $D$ then points $A, B$ lie in angle domain $C D E$ and $\angle E O C=2 \cdot \angle A O B$, which is not allowed. So, $O$ and $D$ must be distinct. Since $f$ is linear and vanishes at $O$, it follows that $f(D)=0$ if and only if $f$ is constant zero - we want to show this occurs if and only if $C, P, E$ are collinear.

In the one direction, suppose firstly that $C, P, E$ are not collinear, and let $T$ be the centre of the circle $C E P$. The same calculation as above provides

area(BCT)+area(ATE)=area(PBTA)=area(ABT)area(ABP) \operatorname{area}(B C T)+\operatorname{area}(A T E)=\operatorname{area}(P B T A)=\operatorname{area}(A B T)-\operatorname{area}(A B P)

f(T)=2area(ABP)0 f(T)=-2 \operatorname{area}(A B P) \neq 0

Hence, the linear function $f$ is nonconstant with its zero is at $O$, so that $f(D) \neq 0$. In the other direction, suppose that the points $C, P, E$ are collinear. We will show that $f$ is constant zero by finding a second point (other than $O$ ) at which it vanishes.

Let $Q$ be the reflection of $P$ across the midpoint of $A B$, so $P A Q B$ is a parallelogram. It is easy to see that $Q$ is on the perpendicular bisector of $C E$; for instance if $A^{\prime}$ and $B^{\prime}$ are the points produced from $A$ and $B$ by dilating about $P$ with scale factor 2, then the projection of $Q$ to $C E$ is the midpoint of the projections of $A^{\prime}$ and $B^{\prime}$, which are $E$ and $C$ respectively. The triangles $B C Q$ and $A Q E$ are indirectly congruent, so

f(Q)=(area(BCQ)+area(AQE))(area(ABQ)area(BAP))=00=0 f(Q)=(\operatorname{area}(B C Q)+\operatorname{area}(A Q E))-(\operatorname{area}(A B Q)-\operatorname{area}(B A P))=0-0=0

The points $O$ and $Q$ are distinct. To see this, consider the circle $\omega$ centred on $Q$ with $P^{\prime}$ on the circumference; since triangle $P P^{\prime} Q$ is right-angled at $P^{\prime}$, it follows that $P$ lies outside $\omega$. On the other hand, $P$ lies between $C$ and $E$ on the line $C P E$. It follows that $C$ and $E$ cannot both lie on $\omega$, so that $\omega$ is not the circle $C E P^{\prime}$ and $Q \neq O$.

Since $O$ and $Q$ are distinct zeroes of the linear function $f$, we have $f(D)=0$ as desired. Comment 1. The condition $\angle E D C \neq 2 \cdot \angle A D B$ cannot be omitted. If $D$ is the centre of circle $C E P^{\prime}$, then the condition on triangle areas is satisfied automatically, without having $P$ on line $C E$.

Comment 2. The "only if" part of this problem is easier than the "if" part. For example, in the second part of Solution 2, the triangles $E A Q$ and $Q B C$ are indirectly congruent, so the sum of their areas is 0 , and $D C Q E$ is a kite. Now one can easily see that $\angle(A Q, D E)=\angle(C D, C B)$ and $\angle(B Q, D C)=\angle(E D, E A)$, whence area $(B C D)=\operatorname{area}(A Q D)+\operatorname{area}(E Q A)$ and $\operatorname{area}(A D E)=$ $\operatorname{area}(B D Q)+\operatorname{area}(B Q C)$, which yields the result.

Comment 3. The origin of the problem is the following observation. Let $A B D H$ be a tetrahedron and consider the sphere $\mathcal{S}$ that is tangent to the four face planes, internally to planes $A D H$ and $B D H$ and externally to $A B D$ and $A B H$ (or vice versa). It is known that the sphere $\mathcal{S}$ exists if and only if area $(A D H)+\operatorname{area}(B D H) \neq \operatorname{area}(A B H)+\operatorname{area}(A B D)$; this relation comes from the usual formula for the volume of the tetrahedron.

Let $T, T_{a}, T_{b}, T_{d}$ be the points of tangency between the sphere and the four planes, as shown in the picture. Rotate the triangle $A B H$ inward, the triangles $B D H$ and $A D H$ outward, into the triangles $A B P, B D C$ and $A D E$, respectively, in the plane $A B D$. Notice that the points $T_{d}, T_{a}, T_{b}$ are rotated to $T$, so we have $H T_{a}=H T_{b}=H T_{d}=P T=C T=E T$. Therefore, the point $T$ is the centre of the circle $C E P$. Hence, if the sphere exists then $C, E, P$ cannot be collinear.

If the condition $\angle E D C \neq 2 \cdot \angle A D B$ is replaced by the constraint that the angles $\angle E D A, \angle A D B$ and $\angle B D C$ satisfy the triangle inequality, it enables reconstructing the argument with the tetrahedron and the tangent sphere.

G6. Let $I$ be the incentre of acute-angled triangle $A B C$. Let the incircle meet $B C, C A$,

and $A B$ at $D, E$, and $F$, respectively. Let line $E F$ intersect the circumcircle of the triangle at $P$ and $Q$, such that $F$ lies between $E$ and $P$. Prove that $\angle D P A+\angle A Q D=\angle Q I P$. (Slovakia) Solution 1. Let $N$ and $M$ be the midpoints of the arcs $\widehat{B C}$ of the circumcircle, containing and opposite vertex $A$, respectively. By $\angle F A E=\angle B A C=\angle B N C$, the right-angled kites $A F I E$ and $N B M C$ are similar. Consider the spiral similarity $\varphi$ (dilation in case of $A B=A C$ ) that moves $A F I E$ to $N B M C$. The directed angle in which $\varphi$ changes directions is $\angle(A F, N B)$, same as $\angle(A P, N P)$ and $\angle(A Q, N Q)$; so lines $A P$ and $A Q$ are mapped to lines $N P$ and $N Q$, respectively. Line $E F$ is mapped to $B C$; we can see that the intersection points $P=E F \cap A P$ and $Q=E F \cap A Q$ are mapped to points $B C \cap N P$ and $B C \cap N Q$, respectively. Denote these points by $P^{\prime}$ and $Q^{\prime}$, respectively.

Let $L$ be the midpoint of $B C$. We claim that points $P, Q, D, L$ are concyclic (if $D=L$ then line $B C$ is tangent to circle $P Q D$ ). Let $P Q$ and $B C$ meet at $Z$. By applying Menelaus' theorem to triangle $A B C$ and line $E F Z$, we have

BDDC=BFFAAEEC=BZZC, \frac{B D}{D C}=\frac{B F}{F A} \cdot \frac{A E}{E C}=-\frac{B Z}{Z C},

so the pairs $B, C$ and $D, Z$ are harmonic. It is well-known that this implies $Z B \cdot Z C=Z D \cdot Z L$. (The inversion with pole $Z$ that swaps $B$ and $C$ sends $Z$ to infinity and $D$ to the midpoint of $B C$, because the cross-ratio is preserved.) Hence, $Z D \cdot Z L=Z B \cdot Z C=Z P \cdot Z Q$ by the power of $Z$ with respect to the circumcircle; this proves our claim.

By $\angle M P P^{\prime}=\angle M Q Q^{\prime}=\angle M L P^{\prime}=\angle M L Q^{\prime}=90^{\circ}$, the quadrilaterals $M L P P^{\prime}$ and $M L Q Q^{\prime}$ are cyclic. Then the problem statement follows by

DPA+AQD=360PAQQDP=360PNQQLP=LPN+NQL=PML+LMQ=PMQ=PIQ. \begin{aligned} \angle D P A+\angle A Q D & =360^{\circ}-\angle P A Q-\angle Q D P=360^{\circ}-\angle P N Q-\angle Q L P \\ & =\angle L P N+\angle N Q L=\angle P^{\prime} M L+\angle L M Q^{\prime}=\angle P^{\prime} M Q^{\prime}=\angle P I Q . \end{aligned}

Solution 2. Define the point $M$ and the same spiral similarity $\varphi$ as in the previous solution. (The point $N$ is not necessary.) It is well-known that the centre of the spiral similarity that maps $F, E$ to $B, C$ is the Miquel point of the lines $F E, B C, B F$ and $C E$; that is, the second intersection of circles $A B C$ and $A E F$. Denote that point by $S$.

By $\varphi(F)=B$ and $\varphi(E)=C$ the triangles $S B F$ and $S C E$ are similar, so we have

SBSC=BFCE=BDCD \frac{S B}{S C}=\frac{B F}{C E}=\frac{B D}{C D}

By the converse of the angle bisector theorem, that indicates that line $S D$ bisects $\angle B S C$ and hence passes through $M$.

Let $K$ be the intersection point of lines $E F$ and $S I$. Notice that $\varphi$ sends points $S, F, E, I$ to $S, B, C, M$, so $\varphi(K)=\varphi(F E \cap S I)=B C \cap S M=D$. By $\varphi(I)=M$, we have $K D | I M$.

We claim that triangles $S P I$ and $S D Q$ are similar, and so are triangles $S P D$ and $S I Q$. Let ray $S I$ meet the circumcircle again at $L$. Note that the segment $E F$ is perpendicular to the angle bisector $A M$. Then by $\angle A M L=\angle A S L=\angle A S I=90^{\circ}$, we have $M L | P Q$. Hence, $\widetilde{P L}=\widetilde{M Q}$ and therefore $\angle P S L=\angle M S Q=\angle D S Q$. By $\angle Q P S=\angle Q M S$, the triangles $S P K$ and $S M Q$ are similar. Finally,

SPSI=SPSKSKSI=SMSQSDSM=SDSQ \frac{S P}{S I}=\frac{S P}{S K} \cdot \frac{S K}{S I}=\frac{S M}{S Q} \cdot \frac{S D}{S M}=\frac{S D}{S Q}

shows that triangles $S P I$ and $S D Q$ are similar. The second part of the claim can be proved analogously.

Now the problem statement can be proved by

DPA+AQD=DPS+SQD=QIS+SIP=QIP. \angle D P A+\angle A Q D=\angle D P S+\angle S Q D=\angle Q I S+\angle S I P=\angle Q I P .

Solution 3. Denote the circumcircle of triangle $A B C$ by $\Gamma$, and let rays $P D$ and $Q D$ meet $\Gamma$ again at $V$ and $U$, respectively. We will show that $A U \perp I P$ and $A V \perp I Q$. Then the problem statement will follow as

DPA+AQD=VUA+AVU=180UAV=QIP. \angle D P A+\angle A Q D=\angle V U A+\angle A V U=180^{\circ}-\angle U A V=\angle Q I P .

Let $M$ be the midpoint of arc $\widehat{B U V C}$ and let $N$ be the midpoint of arc $\widehat{C A B}$; the lines $A I M$ and $A N$ being the internal and external bisectors of angle $B A C$, respectively, are perpendicular. Let the tangents drawn to $\Gamma$ at $B$ and $C$ meet at $R$; let line $P Q$ meet $A U, A I, A V$ and $B C$ at $X, T, Y$ and $Z$, respectively.

As in Solution 1, we observe that the pairs $B, C$ and $D, Z$ are harmonic. Projecting these points from $Q$ onto the circumcircle, we can see that $B, C$ and $U, P$ are also harmonic. Analogously, the pair $V, Q$ is harmonic with $B, C$. Consider the inversion about the circle with centre $R$, passing through $B$ and $C$. Points $B$ and $C$ are fixed points, so this inversion exchanges every point of $\Gamma$ by its harmonic pair with respect to $B, C$. In particular, the inversion maps points $B, C, N, U, V$ to points $B, C, M, P, Q$, respectively.

Combine the inversion with projecting $\Gamma$ from $A$ to line $P Q$; the points $B, C, M, P, Q$ are projected to $F, E, T, P, Q$, respectively.

The combination of these two transformations is projective map from the lines $A B, A C$, $A N, A U, A V$ to $I F, I E, I T, I P, I Q$, respectively. On the other hand, we have $A B \perp I F$, $A C \perp I E$ and $A N \perp A T$, so the corresponding lines in these two pencils are perpendicular. This proves $A U \perp I P$ and $A V \perp I Q$, and hence completes the solution.

G7. The incircle $\omega$ of acute-angled scalene triangle $A B C$ has centre $I$ and meets sides $B C$,

$C A$, and $A B$ at $D, E$, and $F$, respectively. The line through $D$ perpendicular to $E F$ meets $\omega$ again at $R$. Line $A R$ meets $\omega$ again at $P$. The circumcircles of triangles $P C E$ and $P B F$ meet again at $Q \neq P$. Prove that lines $D I$ and $P Q$ meet on the external bisector of angle $B A C$. (India) Common remarks. Throughout the solution, $\angle(a, b)$ denotes the directed angle between lines $a$ and $b$, measured modulo $\pi$.

Solution 1.

Step 1. The external bisector of $\angle B A C$ is the line through $A$ perpendicular to $I A$. Let $D I$ meet this line at $L$ and let $D I$ meet $\omega$ at $K$. Let $N$ be the midpoint of $E F$, which lies on $I A$ and is the pole of line $A L$ with respect to $\omega$. Since $A N \cdot A I=A E^{2}=A R \cdot A P$, the points $R$, $N, I$, and $P$ are concyclic. As $I R=I P$, the line $N I$ is the external bisector of $\angle P N R$, so $P N$ meets $\omega$ again at the point symmetric to $R$ with respect to $A N-i . e$ at $K$.

Let $D N$ cross $\omega$ again at $S$. Opposite sides of any quadrilateral inscribed in the circle $\omega$ meet on the polar line of the intersection of the diagonals with respect to $\omega$. Since $L$ lies on the polar line $A L$ of $N$ with respect to $\omega$, the line $P S$ must pass through $L$. Thus it suffices to prove that the points $S, Q$, and $P$ are collinear.

Step 2. Let $\Gamma$ be the circumcircle of $\triangle B I C$. Notice that

(BQ,QC)=(BQ,QP)+(PQ,QC)=(BF,FP)+(PE,EC)=(EF,EP)+(FP,FE)=(FP,EP)=(DF,DE)=(BI,IC) \begin{aligned} & \angle(B Q, Q C)=\angle(B Q, Q P)+\angle(P Q, Q C)=\angle(B F, F P)+\angle(P E, E C) \\ &=\angle(E F, E P)+\angle(F P, F E)=\angle(F P, E P)=\angle(D F, D E)=\angle(B I, I C) \end{aligned}

so $Q$ lies on $\Gamma$. Let $Q P$ meet $\Gamma$ again at $T$. It will now suffice to prove that $S, P$, and $T$ are collinear. Notice that $\angle(B I, I T)=\angle(B Q, Q T)=\angle(B F, F P)=\angle(F K, K P)$. Note $F D \perp F K$ and $F D \perp B I$ so $F K | B I$ and hence $I T$ is parallel to the line $K N P$. Since $D I=I K$, the line $I T$ crosses $D N$ at its midpoint $M$. Step 3. Let $F^{\prime}$ and $E^{\prime}$ be the midpoints of $D E$ and $D F$, respectively. Since $D E^{\prime} \cdot E^{\prime} F=D E^{\prime 2}=$ $B E^{\prime} \cdot E^{\prime} I$, the point $E^{\prime}$ lies on the radical axis of $\omega$ and $\Gamma$; the same holds for $F^{\prime}$. Therefore, this radical axis is $E^{\prime} F^{\prime}$, and it passes through $M$. Thus $I M \cdot M T=D M \cdot M S$, so $S, I, D$, and $T$ are concyclic. This shows $\angle(D S, S T)=\angle(D I, I T)=\angle(D K, K P)=\angle(D S, S P)$, whence the points $S, P$, and $T$ are collinear, as desired.

Comment. Here is a longer alternative proof in step 1 that $P, S$, and $L$ are collinear, using a circular inversion instead of the fact that opposite sides of a quadrilateral inscribed in a circle $\omega$ meet on the polar line with respect to $\omega$ of the intersection of the diagonals. Let $G$ be the foot of the altitude from $N$ to the line $D I K L$. Observe that $N, G, K, S$ are concyclic (opposite right angles) so

DIP=2DKP=GKN+DSP=GSN+NSP=GSP, \angle D I P=2 \angle D K P=\angle G K N+\angle D S P=\angle G S N+\angle N S P=\angle G S P,

hence $I, G, S, P$ are concyclic. We have $I G \cdot I L=I N \cdot I A=r^{2}$ since $\triangle I G N \sim \triangle I A L$. Inverting the circle $I G S P$ in circle $\omega$, points $P$ and $S$ are fixed and $G$ is taken to $L$ so we find that $P, S$, and $L$ are collinear.

Solution 2. We start as in Solution 1. Namely, we introduce the same points $K, L, N$, and $S$, and show that the triples $(P, N, K)$ and $(P, S, L)$ are collinear. We conclude that $K$ and $R$ are symmetric in $A I$, and reduce the problem statement to showing that $P, Q$, and $S$ are collinear.

Step 1. Let $A R$ meet the circumcircle $\Omega$ of $A B C$ again at $X$. The lines $A R$ and $A K$ are isogonal in the angle $B A C$; it is well known that in this case $X$ is the tangency point of $\Omega$ with the $A$-mixtilinear circle. It is also well known that for this point $X$, the line $X I$ crosses $\Omega$ again at the midpoint $M^{\prime}$ of arc $B A C$.

Step 2. Denote the circles $B F P$ and $C E P$ by $\Omega_{B}$ and $\Omega_{C}$, respectively. Let $\Omega_{B}$ cross $A R$ and $E F$ again at $U$ and $Y$, respectively. We have

(UB,BF)=(UP,PF)=(RP,PF)=(RF,FA) \angle(U B, B F)=\angle(U P, P F)=\angle(R P, P F)=\angle(R F, F A)

so $U B | R F$.

Next, we show that the points $B, I, U$, and $X$ are concyclic. Since

(UB,UX)=(RF,RX)=(AF,AR)+(FR,FA)=(MB,MX)+(DR,DF) \angle(U B, U X)=\angle(R F, R X)=\angle(A F, A R)+\angle(F R, F A)=\angle\left(M^{\prime} B, M^{\prime} X\right)+\angle(D R, D F)

it suffices to prove $\angle(I B, I X)=\angle\left(M^{\prime} B, M^{\prime} X\right)+\angle(D R, D F)$, or $\angle\left(I B, M^{\prime} B\right)=\angle(D R, D F)$. But both angles equal $\angle(C I, C B)$, as desired. (This is where we used the fact that $M^{\prime}$ is the midpoint of $\operatorname{arc} B A C$ of $\Omega$.)

It follows now from circles $B U I X$ and $B P U F Y$ that

(IU,UB)=(IX,BX)=(MX,BX)=πA2=(EF,AF)=(YF,BF)=(YU,BU) \begin{aligned} \angle(I U, U B)=\angle(I X, B X)=\angle\left(M^{\prime} X, B X\right)= & \frac{\pi-\angle A}{2} \\ & =\angle(E F, A F)=\angle(Y F, B F)=\angle(Y U, B U) \end{aligned}

so the points $Y, U$, and $I$ are collinear. Let $E F$ meet $B C$ at $W$. We have

(IY,YW)=(UY,FY)=(UB,FB)=(RF,AF)=(CI,CW) \angle(I Y, Y W)=\angle(U Y, F Y)=\angle(U B, F B)=\angle(R F, A F)=\angle(C I, C W)

so the points $W, Y, I$, and $C$ are concyclic.

Similarly, if $V$ and $Z$ are the second meeting points of $\Omega_{C}$ with $A R$ and $E F$, we get that the 4-tuples $(C, V, I, X)$ and $(B, I, Z, W)$ are both concyclic.

Step 3. Let $Q^{\prime}=C Y \cap B Z$. We will show that $Q^{\prime}=Q$. First of all, we have

(QY,QB)=(CY,ZB)=(CY,ZY)+(ZY,BZ)=(CI,IW)+(IW,IB)=(CI,IB)=πA2=(FY,FB), \begin{aligned} & \angle\left(Q^{\prime} Y, Q^{\prime} B\right)=\angle(C Y, Z B)=\angle(C Y, Z Y)+\angle(Z Y, B Z) \\ & =\angle(C I, I W)+\angle(I W, I B)=\angle(C I, I B)=\frac{\pi-\angle A}{2}=\angle(F Y, F B), \end{aligned}

so $Q^{\prime} \in \Omega_{B}$. Similarly, $Q^{\prime} \in \Omega_{C}$. Thus $Q^{\prime} \in \Omega_{B} \cap \Omega_{C}={P, Q}$ and it remains to prove that $Q^{\prime} \neq P$. If we had $Q^{\prime}=P$, we would have $\angle(P Y, P Z)=\angle\left(Q^{\prime} Y, Q^{\prime} Z\right)=\angle(I C, I B)$. This would imply

(PY,YF)+(EZ,ZP)=(PY,PZ)=(IC,IB)=(PE,PF), \angle(P Y, Y F)+\angle(E Z, Z P)=\angle(P Y, P Z)=\angle(I C, I B)=\angle(P E, P F),

so circles $\Omega_{B}$ and $\Omega_{C}$ would be tangent at $P$. That is excluded in the problem conditions, so $Q^{\prime}=Q$.

Step 4. Now we are ready to show that $P, Q$, and $S$ are collinear. Notice that $A$ and $D$ are the poles of $E W$ and $D W$ with respect to $\omega$, so $W$ is the pole of $A D$. Hence, $W I \perp A D$. Since $C I \perp D E$, this yields $\angle(I C, W I)=\angle(D E, D A)$. On the other hand, $D A$ is a symmedian in $\triangle D E F$, so $\angle(D E, D A)=\angle(D N, D F)=\angle(D S, D F)$. Therefore,

(PS,PF)=(DS,DF)=(DE,DA)=(IC,IW)=(YC,YW)=(YQ,YF)=(PQ,PF), \begin{aligned} \angle(P S, P F)=\angle(D S, D F)=\angle(D E, D A)= & \angle(I C, I W) \\ & =\angle(Y C, Y W)=\angle(Y Q, Y F)=\angle(P Q, P F), \end{aligned}

which yields the desired collinearity.

G8. Let $\mathcal{L}$ be the set of all lines in the plane and let $f$ be a function that assigns to each

line $\ell \in \mathcal{L}$ a point $f(\ell)$ on $\ell$. Suppose that for any point $X$, and for any three lines $\ell_{1}, \ell_{2}, \ell_{3}$ passing through $X$, the points $f\left(\ell_{1}\right), f\left(\ell_{2}\right), f\left(\ell_{3}\right)$ and $X$ lie on a circle.

Prove that there is a unique point $P$ such that $f(\ell)=P$ for any line $\ell$ passing through $P$. (Australia) Common remarks. The condition on $f$ is equivalent to the following: There is some function $g$ that assigns to each point $X$ a circle $g(X)$ passing through $X$ such that for any line $\ell$ passing through $X$, the point $f(\ell)$ lies on $g(X)$. (The function $g$ may not be uniquely defined for all points, if some points $X$ have at most one value of $f(\ell)$ other than $X$; for such points, an arbitrary choice is made.)

If there were two points $P$ and $Q$ with the given property, $f(P Q)$ would have to be both $P$ and $Q$, so there is at most one such point, and it will suffice to show that such a point exists.

Solution 1. We provide a complete characterisation of the functions satisfying the given condition.

Write $\angle\left(\ell_{1}, \ell_{2}\right)$ for the directed angle modulo $180^{\circ}$ between the lines $\ell_{1}$ and $\ell_{2}$. Given a point $P$ and an angle $\alpha \in\left(0,180^{\circ}\right)$, for each line $\ell$, let $\ell^{\prime}$ be the line through $P$ satisfying $\angle\left(\ell^{\prime}, \ell\right)=\alpha$, and let $h_{P, \alpha}(\ell)$ be the intersection point of $\ell$ and $\ell^{\prime}$. We will prove that there is some pair $(P, \alpha)$ such that $f$ and $h_{P, \alpha}$ are the same function. Then $P$ is the unique point in the problem statement.

Given an angle $\alpha$ and a point $P$, let a line $\ell$ be called $(P, \alpha)$-good if $f(\ell)=h_{P, \alpha}(\ell)$. Let a point $X \neq P$ be called $(P, \alpha)$-good if the circle $g(X)$ passes through $P$ and some point $Y \neq P, X$ on $g(X)$ satisfies $\angle(P Y, Y X)=\alpha$. It follows from this definition that if $X$ is $(P, \alpha)$ good then every point $Y \neq P, X$ of $g(X)$ satisfies this angle condition, so $h_{P, \alpha}(X Y)=Y$ for every $Y \in g(X)$. Equivalently, $f(\ell) \in\left{X, h_{P, \alpha}(\ell)\right}$ for each line $\ell$ passing through $X$. This shows the following lemma. Lemma 1. If $X$ is $(P, \alpha)$-good and $\ell$ is a line passing through $X$ then either $f(\ell)=X$ or $\ell$ is $(P, \alpha)$-good. Lemma 2. If $X$ and $Y$ are different $(P, \alpha)$-good points, then line $X Y$ is $(P, \alpha)$-good. Proof. If $X Y$ is not $(P, \alpha)$-good then by the previous Lemma, $f(X Y)=X$ and similarly $f(X Y)=Y$, but clearly this is impossible as $X \neq Y$.

Lemma 3. If $\ell_{1}$ and $\ell_{2}$ are different $(P, \alpha)$-good lines which intersect at $X \neq P$, then either $f\left(\ell_{1}\right)=X$ or $f\left(\ell_{2}\right)=X$ or $X$ is $(P, \alpha)$-good. Proof. If $f\left(\ell_{1}\right), f\left(\ell_{2}\right) \neq X$, then $g(X)$ is the circumcircle of $X, f\left(\ell_{1}\right)$ and $f\left(\ell_{2}\right)$. Since $\ell_{1}$ and $\ell_{2}$ are $(P, \alpha)$-good lines, the angles

(Pf(1),f(1)X)=(Pf(2),f(2)X)=α \angle\left(P f\left(\ell_{1}\right), f\left(\ell_{1}\right) X\right)=\angle\left(P f\left(\ell_{2}\right), f\left(\ell_{2}\right) X\right)=\alpha

so $P$ lies on $g(X)$. Hence, $X$ is $(P, \alpha)$-good. Lemma 4. If $\ell_{1}, \ell_{2}$ and $\ell_{3}$ are different $(P, \alpha)$ good lines which intersect at $X \neq P$, then $X$ is $(P, \alpha)$-good. Proof. This follows from the previous Lemma since at most one of the three lines $\ell_{i}$ can satisfy $f\left(\ell_{i}\right)=X$ as the three lines are all $(P, \alpha)$-good. Lemma 5. If $A B C$ is a triangle such that $A, B, C, f(A B), f(A C)$ and $f(B C)$ are all different points, then there is some point $P$ and some angle $\alpha$ such that $A, B$ and $C$ are $(P, \alpha)$-good points and $A B, B C$ and $C A$ are $(P, \alpha)-\operatorname{good}$ lines.

Proof. Let $D, E, F$ denote the points $f(B C), f(A C), f(A B)$, respectively. Then $g(A)$, $g(B)$ and $g(C)$ are the circumcircles of $A E F, B D F$ and $C D E$, respectively. Let $P \neq F$ be the second intersection of circles $g(A)$ and $g(B)$ (or, if these circles are tangent at $F$, then $P=F$ ). By Miquel's theorem (or an easy angle chase), $g(C)$ also passes through $P$. Then by the cyclic quadrilaterals, the directed angles

(PD,DC)=(PF,FB)=(PE,EA)=α \angle(P D, D C)=\angle(P F, F B)=\angle(P E, E A)=\alpha

for some angle $\alpha$. Hence, lines $A B, B C$ and $C A$ are all $(P, \alpha)$-good, so by Lemma $3, A, B$ and $C$ are $(P, \alpha)$-good. (In the case where $P=D$, the line $P D$ in the equation above denotes the line which is tangent to $g(B)$ at $P=D$. Similar definitions are used for $P E$ and $P F$ in the cases where $P=E$ or $P=F$.)

Consider the set $\Omega$ of all points $(x, y)$ with integer coordinates $1 \leqslant x, y \leqslant 1000$, and consider the set $L_{\Omega}$ of all horizontal, vertical and diagonal lines passing through at least one point in $\Omega$. A simple counting argument shows that there are 5998 lines in $L_{\Omega}$. For each line $\ell$ in $L_{\Omega}$ we colour the point $f(\ell)$ red. Then there are at most 5998 red points. Now we partition the points in $\Omega$ into 10000 ten by ten squares. Since there are at most 5998 red points, at least one of these squares $\Omega_{10}$ contains no red points. Let $(m, n)$ be the bottom left point in $\Omega_{10}$. Then the triangle with vertices $(m, n),(m+1, n)$ and $(m, n+1)$ satisfies the condition of Lemma 5 , so these three vertices are all $(P, \alpha)$-good for some point $P$ and angle $\alpha$, as are the lines joining them. From this point on, we will simply call a point or line good if it is $(P, \alpha)$-good for this particular pair $(P, \alpha)$. Now by Lemma 1, the line $x=m+1$ is good, as is the line $y=n+1$. Then Lemma 3 implies that $(m+1, n+1)$ is good. By applying these two lemmas repeatedly, we can prove that the line $x+y=m+n+2$ is good, then the points $(m, n+2)$ and $(m+2, n)$ then the lines $x=m+2$ and $y=n+2$, then the points $(m+2, n+1),(m+1, n+2)$ and $(m+2, n+2)$ and so on until we have prove that all points in $\Omega_{10}$ are good.

Now we will use this to prove that every point $S \neq P$ is good. Since $g(S)$ is a circle, it passes through at most two points of $\Omega_{10}$ on any vertical line, so at most 20 points in total. Moreover, any line $\ell$ through $S$ intersects at most 10 points in $\Omega_{10}$. Hence, there are at least eight lines $\ell$ through $S$ which contain a point $Q$ in $\Omega_{10}$ which is not on $g(S)$. Since $Q$ is not on $g(S)$, the point $f(\ell) \neq Q$. Hence, by Lemma 1 , the line $\ell$ is good. Hence, at least eight good lines pass through $S$, so by Lemma 4, the point $S$ is good. Hence, every point $S \neq P$ is good, so by Lemma 2 , every line is good. In particular, every line $\ell$ passing through $P$ is good, and therefore satisfies $f(\ell)=P$, as required.

Solution 2. Note that for any distinct points $X, Y$, the circles $g(X)$ and $g(Y)$ meet on $X Y$ at the point $f(X Y) \in g(X) \cap g(Y) \cap(X Y)$. We write $s(X, Y)$ for the second intersection point of circles $g(X)$ and $g(Y)$. Lemma 1. Suppose that $X, Y$ and $Z$ are not collinear, and that $f(X Y) \notin{X, Y}$ and similarly for $Y Z$ and $Z X$. Then $s(X, Y)=s(Y, Z)=s(Z, X)$. Proof. The circles $g(X), g(Y)$ and $g(Z)$ through the vertices of triangle $X Y Z$ meet pairwise on the corresponding edges (produced). By Miquel's theorem, the second points of intersection of any two of the circles coincide. (See the diagram for Lemma 5 of Solution 1.)

Now pick any line $\ell$ and any six different points $Y_{1}, \ldots, Y_{6}$ on $\ell \backslash{f(\ell)}$. Pick a point $X$ not on $\ell$ or any of the circles $g\left(Y_{i}\right)$. Reordering the indices if necessary, we may suppose that $Y_{1}, \ldots, Y_{4}$ do not lie on $g(X)$, so that $f\left(X Y_{i}\right) \notin\left{X, Y_{i}\right}$ for $1 \leqslant i \leqslant 4$. By applying the above lemma to triangles $X Y_{i} Y_{j}$ for $1 \leqslant i<j \leqslant 4$, we find that the points $s\left(Y_{i}, Y_{j}\right)$ and $s\left(X, Y_{i}\right)$ are all equal, to point $O$ say. Note that either $O$ does not lie on $\ell$, or $O=f(\ell)$, since $O \in g\left(Y_{i}\right)$.

Now consider an arbitrary point $X^{\prime}$ not on $\ell$ or any of the circles $g\left(Y_{i}\right)$ for $1 \leqslant i \leqslant 4$. As above, we see that there are two indices $1 \leqslant i<j \leqslant 4$ such that $Y_{i}$ and $Y_{j}$ do not lie on $g\left(X^{\prime}\right)$. By applying the above lemma to triangle $X^{\prime} Y_{i} Y_{j}$ we see that $s\left(X^{\prime}, Y_{i}\right)=O$, and in particular $g\left(X^{\prime}\right)$ passes through $O$.

We will now show that $f\left(\ell^{\prime}\right)=O$ for all lines $\ell^{\prime}$ through $O$. By the above note, we may assume that $\ell^{\prime} \neq \ell$. Consider a variable point $X^{\prime} \in \ell^{\prime} \backslash{O}$ not on $\ell$ or any of the circles $g\left(Y_{i}\right)$ for $1 \leqslant i \leqslant 4$. We know that $f\left(\ell^{\prime}\right) \in g\left(X^{\prime}\right) \cap \ell^{\prime}=\left{X^{\prime}, O\right}$. Since $X^{\prime}$ was suitably arbitrary, we have $f\left(\ell^{\prime}\right)=O$ as desired.

Solution 3. Notice that, for any two different points $X$ and $Y$, the point $f(X Y)$ lies on both $g(X)$ and $g(Y)$, so any two such circles meet in at least one point. We refer to two circles as cutting only in the case where they cross, and so meet at exactly two points, thus excluding the cases where they are tangent or are the same circle. Lemma 1. Suppose there is a point $P$ such that all circles $g(X)$ pass through $P$. Then $P$ has the given property. Proof. Consider some line $\ell$ passing through $P$, and suppose that $f(\ell) \neq P$. Consider some $X \in \ell$ with $X \neq P$ and $X \neq f(\ell)$. Then $g(X)$ passes through all of $P, f(\ell)$ and $X$, but those three points are collinear, a contradiction.

Lemma 2. Suppose that, for all $\epsilon>0$, there is a point $P_{\epsilon}$ with $g\left(P_{\epsilon}\right)$ of radius at most $\epsilon$. Then there is a point $P$ with the given property. Proof. Consider a sequence $\epsilon_{i}=2^{-i}$ and corresponding points $P_{\epsilon_{i}}$. Because the two circles $g\left(P_{\epsilon_{i}}\right)$ and $g\left(P_{\epsilon_{j}}\right)$ meet, the distance between $P_{\epsilon_{i}}$ and $P_{\epsilon_{j}}$ is at most $2^{1-i}+2^{1-j}$. As $\sum_{i} \epsilon_{i}$ converges, these points converge to some point $P$. For all $\epsilon>0$, the point $P$ has distance at most $2 \epsilon$ from $P_{\epsilon}$, and all circles $g(X)$ pass through a point with distance at most $2 \epsilon$ from $P_{\epsilon}$, so distance at most $4 \epsilon$ from $P$. A circle that passes distance at most $4 \epsilon$ from $P$ for all $\epsilon>0$ must pass through $P$, so by Lemma 1 the point $P$ has the given property.

Lemma 3. Suppose no two of the circles $g(X)$ cut. Then there is a point $P$ with the given property. Proof. Consider a circle $g(X)$ with centre $Y$. The circle $g(Y)$ must meet $g(X)$ without cutting it, so has half the radius of $g(X)$. Repeating this argument, there are circles with arbitrarily small radius and the result follows by Lemma 2.

Lemma 4. Suppose there are six different points $A, B_{1}, B_{2}, B_{3}, B_{4}, B_{5}$ such that no three are collinear, no four are concyclic, and all the circles $g\left(B_{i}\right)$ cut pairwise at $A$. Then there is a point $P$ with the given property. Proof. Consider some line $\ell$ through $A$ that does not pass through any of the $B_{i}$ and is not tangent to any of the $g\left(B_{i}\right)$. Fix some direction along that line, and let $X_{\epsilon}$ be the point on $\ell$ that has distance $\epsilon$ from $A$ in that direction. In what follows we consider only those $\epsilon$ for which $X_{\epsilon}$ does not lie on any $g\left(B_{i}\right)$ (this restriction excludes only finitely many possible values of $\epsilon$ ).

Consider the circle $g\left(X_{\epsilon}\right)$. Because no four of the $B_{i}$ are concyclic, at most three of them lie on this circle, so at least two of them do not. There must be some sequence of $\epsilon \rightarrow 0$ such that it is the same two of the $B_{i}$ for all $\epsilon$ in that sequence, so now restrict attention to that sequence, and suppose without loss of generality that $B_{1}$ and $B_{2}$ do not lie on $g\left(X_{\epsilon}\right)$ for any $\epsilon$ in that sequence.

Then $f\left(X_{\epsilon} B_{1}\right)$ is not $B_{1}$, so must be the other point of intersection of $X_{\epsilon} B_{1}$ with $g\left(B_{1}\right)$, and the same applies with $B_{2}$. Now consider the three points $X_{\epsilon}, f\left(X_{\epsilon} B_{1}\right)$ and $f\left(X_{\epsilon} B_{2}\right)$. As $\epsilon \rightarrow 0$, the angle at $X_{\epsilon}$ tends to $\angle B_{1} A B_{2}$ or $180^{\circ}-\angle B_{1} A B_{2}$, which is not 0 or $180^{\circ}$ because no three of the points were collinear. All three distances between those points are bounded above by constant multiples of $\epsilon$ (in fact, if the triangle is scaled by a factor of $1 / \epsilon$, it tends to a fixed triangle). Thus the circumradius of those three points, which is the radius of $g\left(X_{\epsilon}\right)$, is also bounded above by a constant multiple of $\epsilon$, and so the result follows by Lemma 2 .

Lemma 5. Suppose there are two points $A$ and $B$ such that $g(A)$ and $g(B)$ cut. Then there is a point $P$ with the given property. Proof. Suppose that $g(A)$ and $g(B)$ cut at $C$ and $D$. One of those points, without loss of generality $C$, must be $f(A B)$, and so lie on the line $A B$. We now consider two cases, according to whether $D$ also lies on that line.

Case 1: D does not lie on that line.

In this case, consider a sequence of $X_{\epsilon}$ at distance $\epsilon$ from $D$, tending to $D$ along some line that is not a tangent to either circle, but perturbed slightly (by at most $\epsilon^{2}$ ) to ensure that no three of the points $A, B$ and $X_{\epsilon}$ are collinear and no four are concyclic.

Consider the points $f\left(X_{\epsilon} A\right)$ and $f\left(X_{\epsilon} B\right)$, and the circles $g\left(X_{\epsilon}\right)$ on which they lie. The point $f\left(X_{\epsilon} A\right)$ might be either $A$ or the other intersection of $X_{\epsilon} A$ with the circle $g(A)$, and the same applies for $B$. If, for some sequence of $\epsilon \rightarrow 0$, both those points are the other point of intersection, the same argument as in the proof of Lemma 4 applies to find arbitrarily small circles. Otherwise, we have either infinitely many of those circles passing through $A$, or infinitely many passing through $B$; without loss of generality, suppose infinitely many through $A$.

We now show we can find five points $B_{i}$ satisfying the conditions of Lemma 4 (together with $A$ ). Let $B_{1}$ be any of the $X_{\epsilon}$ for which $g\left(X_{\epsilon}\right)$ passes through $A$. Then repeat the following four times, for $2 \leqslant i \leqslant 5$.

Consider some line $\ell=X_{\epsilon} A$ (different from those considered for previous $i$ ) that is not tangent to any of the $g\left(B_{j}\right)$ for $j<i$, and is such that $f(\ell)=A$, so $g(Y)$ passes through $A$ for all $Y$ on that line. If there are arbitrarily small circles $g(Y)$ we are done by Lemma 2, so the radii of such circles must be bounded below. But as $Y \rightarrow A$, along any line not tangent to $g\left(B_{j}\right)$, the radius of a circle through $Y$ and tangent to $g\left(B_{j}\right)$ at $A$ tends to 0 . So there must be some $Y$ such that $g(Y)$ cuts $g\left(B_{j}\right)$ at $A$ rather than being tangent to it there, for all of the previous $B_{j}$, and we may also pick it such that no three of the $B_{i}$ and $A$ are collinear and no four are concyclic. Let $B_{i}$ be this $Y$. Now the result follows by Lemma 4.

Case 2: $D$ does lie on that line.

In this case, we follow a similar argument, but the sequence of $X_{\epsilon}$ needs to be slightly different. $C$ and $D$ both lie on the line $A B$, so one must be $A$ and the other must be $B$. Consider a sequence of $X_{\epsilon}$ tending to $B$. Rather than tending to $B$ along a straight line (with small perturbations), let the sequence be such that all the points are inside the two circles, with the angle between $X_{\epsilon} B$ and the tangent to $g(B)$ at $B$ tending to 0 .

Again consider the points $f\left(X_{\epsilon} A\right)$ and $f\left(X_{\epsilon} B\right)$. If, for some sequence of $\epsilon \rightarrow 0$, both those points are the other point of intersection with the respective circles, we see that the angle at $X_{\epsilon}$ tends to the angle between $A B$ and the tangent to $g(B)$ at $B$, which is not 0 or $180^{\circ}$, while the distances tend to 0 (although possibly slower than any multiple of $\epsilon$ ), so we have arbitrarily small circumradii and the result follows by Lemma 2. Otherwise, we have either infinitely many of the circles $g\left(X_{\epsilon}\right)$ passing through $A$, or infinitely many passing through $B$, and the same argument as in the previous case enables us to reduce to Lemma 4.

Lemmas 3 and 5 together cover all cases, and so the required result is proved.

Comment. From the property that all circles $g(X)$ pass through the same point $P$, it is possible to deduce that the function $f$ has the form given in Solution 1. For any line $\ell$ not passing through $P$ we may define a corresponding angle $\alpha(\ell)$, which we must show is the same for all such lines. For any point $X \neq P$, with at least one line $\ell$ through $X$ and not through $P$, such that $f(\ell) \neq X$, this angle must be equal for all such lines through $X$ (by (directed) angles in the same segment of $g(X)$ ).

Now consider all horizontal and all vertical lines not through $P$. For any pair consisting of a horizontal line $\ell_{1}$ and a vertical line $\ell_{2}$, we have $\alpha\left(\ell_{1}\right)=\alpha\left(\ell_{2}\right)$ unless $f\left(\ell_{1}\right)$ or $f\left(\ell_{2}\right)$ is the point of intersection of those lines. Consider the bipartite graph whose vertices are those lines and where an edge joins a horizontal and a vertical line with the same value of $\alpha$. Considering a subgraph induced by $n$ horizontal and $n$ vertical lines, it must have at least $n^{2}-2 n$ edges, so some horizontal line has edges to at least $n-2$ of the vertical lines. Thus, in the original graph, all but at most two of the vertical lines have the same value of $\alpha$, and likewise all but at most two of the horizontal lines have the same value of $\alpha$, and, restricting attention to suitable subsets of those lines, we see that this value must be the same for the vertical lines and for the horizontal lines.

But now we can extend this to all vertical and horizontal lines not through $P$ (and thus to lines in other directions as well, since the only requirement for 'vertical' and 'horizontal' above is that they are any two nonparallel directions). Consider any horizontal line $\ell_{1}$ not passing through $P$, and we wish to show that $\alpha\left(\ell_{1}\right)$ has the same value $\alpha$ it has for all but at most two lines not through $P$ in any direction. Indeed, we can deduce this by considering the intersection with any but at most five of the vertical lines: the only ones to exclude are the one passing through $P$, the one passing through $f\left(\ell_{1}\right)$, at most two such that $\alpha(\ell) \neq \alpha$, and the one passing through $h_{P, \alpha}\left(\ell_{1}\right)$ (defined as in Solution 1). So all lines $\ell$ not passing through $P$ have the same value of $\alpha(\ell)$.

Solution 4. For any point $X$, denote by $t(X)$ the line tangent to $g(X)$ at $X$; notice that $f(t(X))=X$, so $f$ is surjective.

Step 1: We find a point $P$ for which there are at least two different lines $p_{1}$ and $p_{2}$ such that $f\left(p_{i}\right)=P$.

Choose any point $X$. If $X$ does not have this property, take any $Y \in g(X) \backslash{X}$; then $f(X Y)=Y$. If $Y$ does not have the property, $t(Y)=X Y$, and the circles $g(X)$ and $g(Y)$ meet again at some point $Z$. Then $f(X Z)=Z=f(Y Z)$, so $Z$ has the required property.

We will show that $P$ is the desired point. From now on, we fix two different lines $p_{1}$ and $p_{2}$ with $f\left(p_{1}\right)=f\left(p_{2}\right)=P$. Assume for contradiction that $f(\ell)=Q \neq P$ for some line $\ell$ through $P$. We fix $\ell$, and note that $Q \in g(P)$.

Step 2: We prove that $P \in g(Q)$. Take an arbitrary point $X \in \ell \backslash{P, Q}$. Two cases are possible for the position of $t(X)$ in relation to the $p_{i}$; we will show that each case (and subcase) occurs for only finitely many positions of $X$, yielding a contradiction.

Case 2.1: $t(X)$ is parallel to one of the $p_{i}$; say, to $p_{1}$. Let $t(X) \operatorname{cross} p_{2}$ at $R$. Then $g(R)$ is the circle $(P R X)$, as $f(R P)=P$ and $f(R X)=X$. Let $R Q$ cross $g(R)$ again at $S$. Then $f(R Q) \in{R, S} \cap g(Q)$, so $g(Q)$ contains one of the points $R$ and $S$.

If $R \in g(Q)$, then $R$ is one of finitely many points in the intersection $g(Q) \cap p_{2}$, and each of them corresponds to a unique position of $X$, since $R X$ is parallel to $p_{1}$.

If $S \in g(Q)$, then $\angle(Q S, S P)=\angle(R S, S P)=\angle(R X, X P)=\angle\left(p_{1}, \ell\right)$, so $\angle(Q S, S P)$ is constant for all such points $X$, and all points $S$ obtained in such a way lie on one circle $\gamma$ passing through $P$ and $Q$. Since $g(Q)$ does not contain $P$, it is different from $\gamma$, so there are only finitely many points $S$. Each of them uniquely determines $R$ and thus $X$.

So, Case 2.1 can occur for only finitely many points $X$. Case 2.2: $t(X)$ crosses $p_{1}$ and $p_{2}$ at $R_{1}$ and $R_{2}$, respectively. Clearly, $R_{1} \neq R_{2}$, as $t(X)$ is the tangent to $g(X)$ at $X$, and $g(X)$ meets $\ell$ only at $X$ and $Q$. Notice that $g\left(R_{i}\right)$ is the circle $\left(P X R_{i}\right)$. Let $R_{i} Q$ meet $g\left(R_{i}\right)$ again at $S_{i}$; then $S_{i} \neq Q$, as $g\left(R_{i}\right)$ meets $\ell$ only at $P$ and $X$. Then $f\left(R_{i} Q\right) \in\left{R_{i}, S_{i}\right}$, and we distinguish several subcases.

Subcase 2.2.1: $f\left(R_{1} Q\right)=S_{1}, f\left(R_{2} Q\right)=S_{2}$; so $S_{1}, S_{2} \in g(Q)$. In this case we have $0=\angle\left(R_{1} X, X P\right)+\angle\left(X P, R_{2} X\right)=\angle\left(R_{1} S_{1}, S_{1} P\right)+\angle\left(S_{2} P, S_{2} R_{2}\right)=$ $\angle\left(Q S_{1}, S_{1} P\right)+\angle\left(S_{2} P, S_{2} Q\right)$, which shows $P \in g(Q)$.

Subcase 2.2.2: $f\left(R_{1} Q\right)=R_{1}, f\left(R_{2} Q\right)=R_{2}$; so $R_{1}, R_{2} \in g(Q)$. This can happen for at most four positions of $X$ - namely, at the intersections of $\ell$ with a line of the form $K_{1} K_{2}$, where $K_{i} \in g(Q) \cap p_{i}$.

Subcase 2.2.3: $f\left(R_{1} Q\right)=S_{1}, f\left(R_{2} Q\right)=R_{2}$ (the case $f\left(R_{1} Q\right)=R_{1}, f\left(R_{2} Q\right)=S_{2}$ is similar). In this case, there are at most two possible positions for $R_{2}$ - namely, the meeting points of $g(Q)$ with $p_{2}$. Consider one of them. Let $X$ vary on $\ell$. Then $R_{1}$ is the projection of $X$ to $p_{1}$ via $R_{2}, S_{1}$ is the projection of $R_{1}$ to $g(Q)$ via $Q$. Finally, $\angle\left(Q S_{1}, S_{1} X\right)=\angle\left(R_{1} S_{1}, S_{1} X\right)=$ $\angle\left(R_{1} P, P X\right)=\angle\left(p_{1}, \ell\right) \neq 0$, so $X$ is obtained by a fixed projective transform $g(Q) \rightarrow \ell$ from $S_{1}$. So, if there were three points $X$ satisfying the conditions of this subcase, the composition of the three projective transforms would be the identity. But, if we apply it to $X=Q$, we successively get some point $R_{1}^{\prime}$, then $R_{2}$, and then some point different from $Q$, a contradiction.

Thus Case 2.2 also occurs for only finitely many points $X$, as desired. Step 3: We show that $f(P Q)=P$, as desired. The argument is similar to that in Step 2, with the roles of $Q$ and $X$ swapped. Again, we show that there are only finitely many possible positions for a point $X \in \ell \backslash{P, Q}$, which is absurd. Case 3.1: $t(Q)$ is parallel to one of the $p_{i}$; say, to $p_{1}$. Let $t(Q)$ cross $p_{2}$ at $R$; then $g(R)$ is the circle $(P R Q)$. Let $R X \operatorname{cross} g(R)$ again at $S$. Then $f(R X) \in{R, S} \cap g(X)$, so $g(X)$ contains one of the points $R$ and $S$.

Subcase 3.1.1: $S=f(R X) \in g(X)$. We have $\angle(t(X), Q X)=\angle(S X, S Q)=\angle(S R, S Q)=\angle(P R, P Q)=\angle\left(p_{2}, \ell\right)$. Hence $t(X) | p_{2}$. Now we recall Case 2.1: we let $t(X)$ cross $p_{1}$ at $R^{\prime}$, so $g\left(R^{\prime}\right)=\left(P R^{\prime} X\right)$, and let $R^{\prime} Q$ meet $g\left(R^{\prime}\right)$ again at $S^{\prime}$; notice that $S^{\prime} \neq Q$. Excluding one position of $X$, we may assume that $R^{\prime} \notin g(Q)$, so $R^{\prime} \neq f\left(R^{\prime} Q\right)$. Therefore, $S^{\prime}=f\left(R^{\prime} Q\right) \in g(Q)$. But then, as in Case 2.1, we get $\angle(t(Q), P Q)=\angle\left(Q S^{\prime}, S^{\prime} P\right)=\angle\left(R^{\prime} X, X P\right)=\angle\left(p_{2}, \ell\right)$. This means that $t(Q)$ is parallel to $p_{2}$, which is impossible. Subcase 3.1.2: $R=f(R X) \in g(X)$. In this case, we have $\angle(t(X), \ell)=\angle(R X, R Q)=\angle\left(R X, p_{1}\right)$. Again, let $R^{\prime}=t(X) \cap p_{1}$; this point exists for all but at most one position of $X$. Then $g\left(R^{\prime}\right)=\left(R^{\prime} X P\right)$; let $R^{\prime} Q$ meet $g\left(R^{\prime}\right)$ again at $S^{\prime}$. Due to $\angle\left(R^{\prime} X, X R\right)=\angle(Q X, Q R)=\angle\left(\ell, p_{1}\right), R^{\prime}$ determines $X$ in at most two ways, so for all but finitely many positions of $X$ we have $R^{\prime} \notin g(Q)$. Therefore, for those positions we have $S^{\prime}=f\left(R^{\prime} Q\right) \in g(Q)$. But then $\angle\left(R X, p_{1}\right)=\angle\left(R^{\prime} X, X P\right)=\angle\left(R^{\prime} S^{\prime}, S^{\prime} P\right)=$ $\angle\left(Q S^{\prime}, S^{\prime} P\right)=\angle(t(Q), Q P)$ is fixed, so this case can hold only for one specific position of $X$ as well.

Thus, in Case 3.1, there are only finitely many possible positions of $X$, yielding a contradiction.

Case 3.2: $t(Q)$ crosses $p_{1}$ and $p_{2}$ at $R_{1}$ and $R_{2}$, respectively. By Step $2, R_{1} \neq R_{2}$. Notice that $g\left(R_{i}\right)$ is the circle $\left(P Q R_{i}\right)$. Let $R_{i} X$ meet $g\left(R_{i}\right)$ at $S_{i}$; then $S_{i} \neq X$. Then $f\left(R_{i} X\right) \in\left{R_{i}, S_{i}\right}$, and we distinguish several subcases.

Subcase 3.2.1: $f\left(R_{1} X\right)=S_{1}$ and $f\left(R_{2} X\right)=S_{2}$, so $S_{1}, S_{2} \in g(X)$. As in Subcase 2.2.1, we have $0=\angle\left(R_{1} Q, Q P\right)+\angle\left(Q P, R_{2} Q\right)=\angle\left(X S_{1}, S_{1} P\right)+\angle\left(S_{2} P, S_{2} X\right)$, which shows $P \in g(X)$. But $X, Q \in g(X)$ as well, so $g(X)$ meets $\ell$ at three distinct points, which is absurd. Subcase 3.2.2: $f\left(R_{1} X\right)=R_{1}, f\left(R_{2} X\right)=R_{2}$, so $R_{1}, R_{2} \in g(X)$. Now three distinct collinear points $R_{1}, R_{2}$, and $Q$ belong to $g(X)$, which is impossible. Subcase 3.2.3: $f\left(R_{1} X\right)=S_{1}, f\left(R_{2} X\right)=R_{2}$ (the case $f\left(R_{1} X\right)=R_{1}, f\left(R_{2} X\right)=S_{2}$ is similar). We have $\angle\left(X R_{2}, R_{2} Q\right)=\angle\left(X S_{1}, S_{1} Q\right)=\angle\left(R_{1} S_{1}, S_{1} Q\right)=\angle\left(R_{1} P, P Q\right)=\angle\left(p_{1}, \ell\right)$, so this case can occur for a unique position of $X$.

Thus, in Case 3.2 , there is only a unique position of $X$, again yielding the required contradiction.

Number Theory

Find all pairs $(m, n)$ of positive integers satisfying the equation

(2n1)(2n2)(2n4)(2n2n1)=m! \left(2^{n}-1\right)\left(2^{n}-2\right)\left(2^{n}-4\right) \cdots\left(2^{n}-2^{n-1}\right)=m!

(El Salvador) Answer: The only such pairs are $(1,1)$ and $(3,2)$. Common remarks. In all solutions, for any prime $p$ and positive integer $N$, we will denote by $v_{p}(N)$ the exponent of the largest power of $p$ that divides $N$. The left-hand side of (1) will be denoted by $L_{n}$; that is, $L_{n}=\left(2^{n}-1\right)\left(2^{n}-2\right)\left(2^{n}-4\right) \cdots\left(2^{n}-2^{n-1}\right)$.

Solution 1. We will get an upper bound on $n$ from the speed at which $v_{2}\left(L_{n}\right)$ grows. From

Ln=(2n1)(2n2)(2n2n1)=21+2++(n1)(2n1)(2n11)(211) L_{n}=\left(2^{n}-1\right)\left(2^{n}-2\right) \cdots\left(2^{n}-2^{n-1}\right)=2^{1+2+\cdots+(n-1)}\left(2^{n}-1\right)\left(2^{n-1}-1\right) \cdots\left(2^{1}-1\right)

we read

v2(Ln)=1+2++(n1)=n(n1)2. v_{2}\left(L_{n}\right)=1+2+\cdots+(n-1)=\frac{n(n-1)}{2} .

On the other hand, $v_{2}(m!)$ is expressed by the Legendre formula as

v2(m!)=i=1m2i. v_{2}(m!)=\sum_{i=1}^{\infty}\left\lfloor\frac{m}{2^{i}}\right\rfloor .

As usual, by omitting the floor functions,

v2(m!)<i=1m2i=m v_{2}(m!)<\sum_{i=1}^{\infty} \frac{m}{2^{i}}=m

Thus, $L_{n}=m$ ! implies the inequality

n(n1)2<m. \frac{n(n-1)}{2}<m .

In order to obtain an opposite estimate, observe that

Ln=(2n1)(2n2)(2n2n1)<(2n)n=2n2. L_{n}=\left(2^{n}-1\right)\left(2^{n}-2\right) \cdots\left(2^{n}-2^{n-1}\right)<\left(2^{n}\right)^{n}=2^{n^{2}} .

We claim that

2n2<(n(n1)2)! for n6 2^{n^{2}}<\left(\frac{n(n-1)}{2}\right)!\text { for } n \geqslant 6

For $n=6$ the estimate (3) is true because $2^{6^{2}}<6.9 \cdot 10^{10}$ and $\left(\frac{n(n-1)}{2}\right)!=15!>1.3 \cdot 10^{12}$. For $n \geqslant 7$ we prove (3) by the following inequalities:

(n(n1)2)!=15!1617n(n1)2>23616n(n1)215=22n(n1)24=2n22n(n2)24>2n2. \begin{aligned} \left(\frac{n(n-1)}{2}\right)! & =15!\cdot 16 \cdot 17 \cdots \frac{n(n-1)}{2}>2^{36} \cdot 16^{\frac{n(n-1)}{2}-15} \\ & =2^{2 n(n-1)-24}=2^{n^{2}} \cdot 2^{n(n-2)-24}>2^{n^{2}} . \end{aligned}

Putting together (2) and (3), for $n \geqslant 6$ we get a contradiction, since

Ln<2n2<(n(n1)2)!<m!=Ln L_{n}<2^{n^{2}}<\left(\frac{n(n-1)}{2}\right)!<m!=L_{n}

Hence $n \geqslant 6$ is not possible. Checking manually the cases $n \leqslant 5$ we find

L1=1=1!,L2=6=3!,5!<L3=168<6!,7!<L4=20160<8! and 10!<L5=9999360<11! \begin{gathered} L_{1}=1=1!, \quad L_{2}=6=3!, \quad 5!<L_{3}=168<6!, \\ 7!<L_{4}=20160<8!\quad \text { and } \quad 10!<L_{5}=9999360<11! \end{gathered}

So, there are two solutions:

(m,n){(1,1),(3,2)} (m, n) \in\{(1,1),(3,2)\}

Solution 2. Like in the previous solution, the cases $n=1,2,3,4$ are checked manually. We will exclude $n \geqslant 5$ by considering the exponents of 3 and 31 in (1).

For odd primes $p$ and distinct integers $a, b$, coprime to $p$, with $p \mid a-b$, the Lifting The Exponent lemma asserts that

vp(akbk)=vp(ab)+vp(k). v_{p}\left(a^{k}-b^{k}\right)=v_{p}(a-b)+v_{p}(k) .

Notice that 3 divides $2^{k}-1$ if only if $k$ is even; moreover, by the Lifting The Exponent lemma we have

v3(22k1)=v3(4k1)=1+v3(k)=v3(3k) v_{3}\left(2^{2 k}-1\right)=v_{3}\left(4^{k}-1\right)=1+v_{3}(k)=v_{3}(3 k)

Hence,

v3(Ln)=2knv3(4k1)=kn2v3(3k) v_{3}\left(L_{n}\right)=\sum_{2 k \leqslant n} v_{3}\left(4^{k}-1\right)=\sum_{k \leqslant\left\lfloor\frac{n}{2}\right\rfloor} v_{3}(3 k)

Notice that the last expression is precisely the exponent of 3 in the prime factorisation of (3 $\left.\left.\frac{n}{2}\right\rfloor\right)$ !. Therefore

v3(m!)=v3(Ln)=v3((3n2)!)3n2m3n2+2. \begin{gathered} v_{3}(m!)=v_{3}\left(L_{n}\right)=v_{3}\left(\left(3\left\lfloor\frac{n}{2}\right\rfloor\right)!\right) \\ 3\left\lfloor\frac{n}{2}\right\rfloor \leqslant m \leqslant 3\left\lfloor\frac{n}{2}\right\rfloor+2 . \end{gathered}

Suppose that $n \geqslant 5$. Note that every fifth factor in $L_{n}$ is divisible by $31=2^{5}-1$, and hence we have $v_{31}\left(L_{n}\right) \geqslant\left\lfloor\frac{n}{5}\right\rfloor$. Then

n10n5v31(Ln)=v31(m!)=k=1m31k<k=1m31k=m30 \frac{n}{10} \leqslant\left\lfloor\frac{n}{5}\right\rfloor \leqslant v_{31}\left(L_{n}\right)=v_{31}(m!)=\sum_{k=1}^{\infty}\left\lfloor\frac{m}{31^{k}}\right\rfloor<\sum_{k=1}^{\infty} \frac{m}{31^{k}}=\frac{m}{30}

By combining (4) and (5),

3n<m3n2+2 3 n<m \leqslant \frac{3 n}{2}+2

so $n<\frac{4}{3}$ which is inconsistent with the inequality $n \geqslant 5$. Comment 1. There are many combinations of the ideas above; for example combining (2) and (4) also provides $n<5$. Obviously, considering the exponents of any two primes in (1), or considering one prime and the magnitude orders lead to an upper bound on $n$ and $m$.

Comment 2. This problem has a connection to group theory. Indeed, the left-hand side is the order of the group $G L_{n}\left(\mathbb{F}{2}\right)$ of invertible $n$-by- $n$ matrices with entries modulo 2 , while the right-hand side is the order of the symmetric group $S{m}$ on $m$ elements. The result thus shows that the only possible isomorphisms between these groups are $G L_{1}\left(\mathbb{F}{2}\right) \cong S{1}$ and $G L_{2}\left(\mathbb{F}{2}\right) \cong S{3}$, and there are in fact isomorphisms in both cases. In general, $G L_{n}\left(\mathbb{F}{2}\right)$ is a simple group for $n \geqslant 3$, as it is isomorphic to $\operatorname{PS} L{n}\left(\mathbb{F}_{2}\right)$.

There is also a near-solution of interest: the left-hand side for $n=4$ is half of the right-hand side when $m=8$; this turns out to correspond to an isomorphism $G L_{4}\left(\mathbb{F}{2}\right) \cong A{8}$ with the alternating group on eight elements.

However, while this indicates that the problem is a useful one, knowing group theory is of no use in solving it!

N2. Find all triples $(a, b, c)$ of positive integers such that $a^{3}+b^{3}+c^{3}=(a b c)^{2}$. (Nigeria) Answer: The solutions are $(1,2,3)$ and its permutations. Common remarks. Note that the equation is symmetric. In all solutions, we will assume without loss of generality that $a \geqslant b \geqslant c$, and prove that the only solution is $(a, b, c)=(3,2,1)$.

The first two solutions all start by proving that $c=1$. Solution 1. We will start by proving that $c=1$. Note that

3a3a3+b3+c3>a3. 3 a^{3} \geqslant a^{3}+b^{3}+c^{3}>a^{3} .

So $3 a^{3} \geqslant(a b c)^{2}>a^{3}$ and hence $3 a \geqslant b^{2} c^{2}>a$. Now $b^{3}+c^{3}=a^{2}\left(b^{2} c^{2}-a\right) \geqslant a^{2}$, and so

18b39(b3+c3)9a2b4c4b3c5 18 b^{3} \geqslant 9\left(b^{3}+c^{3}\right) \geqslant 9 a^{2} \geqslant b^{4} c^{4} \geqslant b^{3} c^{5}

so $18 \geqslant c^{5}$ which yields $c=1$. Now, note that we must have $a>b$, as otherwise we would have $2 b^{3}+1=b^{4}$ which has no positive integer solutions. So

a3b3(b+1)3b3>1 a^{3}-b^{3} \geqslant(b+1)^{3}-b^{3}>1

and

2a3>1+a3+b3>a3 2 a^{3}>1+a^{3}+b^{3}>a^{3}

which implies $2 a^{3}>a^{2} b^{2}>a^{3}$ and so $2 a>b^{2}>a$. Therefore

4(1+b3)=4a2(b2a)4a2>b4 4\left(1+b^{3}\right)=4 a^{2}\left(b^{2}-a\right) \geqslant 4 a^{2}>b^{4}

so $4>b^{3}(b-4)$; that is, $b \leqslant 4$. Now, for each possible value of $b$ with $2 \leqslant b \leqslant 4$ we obtain a cubic equation for $a$ with constant coefficients. These are as follows:

b=2:a34a2+9=0b=3:a39a2+28=0b=4:a316a2+65=0. \begin{array}{rlrl} b=2: & & & a^{3}-4 a^{2}+9=0 \\ b=3: & & a^{3}-9 a^{2}+28=0 \\ b=4: & & a^{3}-16 a^{2}+65=0 . \end{array}

The only case with an integer solution for $a$ with $b \leqslant a$ is $b=2$, leading to $(a, b, c)=(3,2,1)$. Comment 1.1. Instead of writing down each cubic equation explicitly, we could have just observed that $a^{2} \mid b^{3}+1$, and for each choice of $b$ checked each square factor of $b^{3}+1$ for $a^{2}$.

We could also have observed that, with $c=1$, the relation $18 b^{3} \geqslant b^{4} c^{4}$ becomes $b \leqslant 18$, and we can simply check all possibilities for $b$ (instead of working to prove that $b \leqslant 4$ ). This check becomes easier after using the factorisation $b^{3}+1=(b+1)\left(b^{2}-b+1\right)$ and observing that no prime besides 3 can divide both of the factors.

Comment 1.2. Another approach to finish the problem after establishing that $c \leqslant 1$ is to set $k=b^{2} c^{2}-a$, which is clearly an integer and must be positive as it is equal to $\left(b^{3}+c^{3}\right) / a^{2}$. Then we divide into cases based on whether $k=1$ or $k \geqslant 2$; in the first case, we have $b^{3}+1=a^{2}=\left(b^{2}-1\right)^{2}$ whose only positive root is $b=2$, and in the second case we have $b^{2} \leqslant 3 a$, and so

b4(3a)292(ka2)=92(b3+1), b^{4} \leqslant(3 a)^{2} \leqslant \frac{9}{2}\left(k a^{2}\right)=\frac{9}{2}\left(b^{3}+1\right),

which implies that $b \leqslant 4$.

Solution 2. Again, we will start by proving that $c=1$. Suppose otherwise that $c \geqslant 2$. We have $a^{3}+b^{3}+c^{3} \leqslant 3 a^{3}$, so $b^{2} c^{2} \leqslant 3 a$. Since $c \geqslant 2$, this tells us that $b \leqslant \sqrt{3 a / 4}$. As the right-hand side of the original equation is a multiple of $a^{2}$, we have $a^{2} \leqslant 2 b^{3} \leqslant 2(3 a / 4)^{3 / 2}$. In other words, $a \leqslant \frac{27}{16}<2$, which contradicts the assertion that $a \geqslant c \geqslant 2$. So there are no solutions in this case, and so we must have $c=1$.

Now, the original equation becomes $a^{3}+b^{3}+1=a^{2} b^{2}$. Observe that $a \geqslant 2$, since otherwise $a=b=1$ as $a \geqslant b$.

The right-hand side is a multiple of $a^{2}$, so the left-hand side must be as well. Thus, $b^{3}+1 \geqslant$ $a^{2}$. Since $a \geqslant b$, we also have

b2=a+b3+1a22a+1a2 b^{2}=a+\frac{b^{3}+1}{a^{2}} \leqslant 2 a+\frac{1}{a^{2}}

and so $b^{2} \leqslant 2 a$ since $b^{2}$ is an integer. Thus $(2 a)^{3 / 2}+1 \geqslant b^{3}+1 \geqslant a^{2}$, from which we deduce $a \leqslant 8$.

Now, for each possible value of $a$ with $2 \leqslant a \leqslant 8$ we obtain a cubic equation for $b$ with constant coefficients. These are as follows:

a=2:b34b2+9=0a=3:b39b2+28=0a=4:a=5:16b2+65=0a=6:b325b2+126=0a=7:b336b2+217=0a=8:b349b2+344=0b364b2+513=0. \begin{array}{ll} a=2: & \\ b^{3}-4 b^{2}+9=0 \\ a=3: & \\ b^{3}-9 b^{2}+28=0 \\ a=4: & \\ a=5: 16 b^{2}+65=0 \\ a=6: & \\ b^{3}-25 b^{2}+126=0 \\ a=7: & \\ b^{3}-36 b^{2}+217=0 \\ a=8: & \\ b^{3}-49 b^{2}+344=0 \\ b^{3}-64 b^{2}+513=0 . \end{array}

The only case with an integer solution for $b$ with $a \geqslant b$ is $a=3$, leading to $(a, b, c)=(3,2,1)$. Comment 2.1. As in Solution 1, instead of writing down each cubic equation explicitly, we could have just observed that $b^{2} \mid a^{3}+1$, and for each choice of $a$ checked each square factor of $a^{3}+1$ for $b^{2}$.

Comment 2.2. This solution does not require initially proving that $c=1$, in which case the bound would become $a \leqslant 108$. The resulting cases could, in principle, be checked by a particularly industrious student.

Solution 3. Set $k=\left(b^{3}+c^{3}\right) / a^{2} \leqslant 2 a$, and rewrite the original equation as $a+k=(b c)^{2}$. Since $b^{3}$ and $c^{3}$ are positive integers, we have $(b c)^{3} \geqslant b^{3}+c^{3}-1=k a^{2}-1$, so

a+k(ka21)2/3 a+k \geqslant\left(k a^{2}-1\right)^{2 / 3}

As in Comment 1.2, $k$ is a positive integer; for each value of $k \geqslant 1$, this gives us a polynomial inequality satisfied by $a$ :

k2a4a35ka23k2a(k31)0. k^{2} a^{4}-a^{3}-5 k a^{2}-3 k^{2} a-\left(k^{3}-1\right) \leqslant 0 .

We now prove that $a \leqslant 3$. Indeed,

0k2a4a35ka23k2a(k31)k2a4a35a23aka4a35a25a 0 \geqslant \frac{k^{2} a^{4}-a^{3}-5 k a^{2}-3 k^{2} a-\left(k^{3}-1\right)}{k^{2}} \geqslant a^{4}-a^{3}-5 a^{2}-3 a-k \geqslant a^{4}-a^{3}-5 a^{2}-5 a

which fails when $a \geqslant 4$. This leaves ten triples with $3 \geqslant a \geqslant b \geqslant c \geqslant 1$, which may be checked manually to give $(a, b, c)=(3,2,1)$.

Solution 4. Again, observe that $b^{3}+c^{3}=a^{2}\left(b^{2} c^{2}-a\right)$, so $b \leqslant a \leqslant b^{2} c^{2}-1$. We consider the function $f(x)=x^{2}\left(b^{2} c^{2}-x\right)$. It can be seen that that on the interval $\left[0, b^{2} c^{2}-1\right]$ the function $f$ is increasing if $x<\frac{2}{3} b^{2} c^{2}$ and decreasing if $x>\frac{2}{3} b^{2} c^{2}$. Consequently, it must be the case that

b3+c3=f(a)min(f(b),f(b2c21)) b^{3}+c^{3}=f(a) \geqslant \min \left(f(b), f\left(b^{2} c^{2}-1\right)\right)

First, suppose that $b^{3}+c^{3} \geqslant f\left(b^{2} c^{2}-1\right)$. This may be written $b^{3}+c^{3} \geqslant\left(b^{2} c^{2}-1\right)^{2}$, and so

2b3b3+c3(b2c21)2>b4c42b2c2b4c42b3c4 2 b^{3} \geqslant b^{3}+c^{3} \geqslant\left(b^{2} c^{2}-1\right)^{2}>b^{4} c^{4}-2 b^{2} c^{2} \geqslant b^{4} c^{4}-2 b^{3} c^{4}

Thus, $(b-2) c^{4}<2$, and the only solutions to this inequality have $(b, c)=(2,2)$ or $b \leqslant 3$ and $c=1$. It is easy to verify that the only case giving a solution for $a \geqslant b$ is $(a, b, c)=(3,2,1)$.

Otherwise, suppose that $b^{3}+c^{3}=f(a) \geqslant f(b)$. Then, we have

2b3b3+c3=a2(b2c2a)b2(b2c2b). 2 b^{3} \geqslant b^{3}+c^{3}=a^{2}\left(b^{2} c^{2}-a\right) \geqslant b^{2}\left(b^{2} c^{2}-b\right) .

Consequently $b c^{2} \leqslant 3$, with strict inequality in the case that $b \neq c$. Hence $c=1$ and $b \leqslant 2$. Both of these cases have been considered already, so we are done.

Comment 4.1. Instead of considering which of $f(b)$ and $f\left(b^{2} c^{2}-1\right)$ is less than $f(a)$, we may also proceed by explicitly dividing into cases based on whether $a \geqslant \frac{2}{3} b^{2} c^{2}$ or $a<\frac{2}{3} b^{2} c^{2}$. The first case may now be dealt with as follows. We have $b^{3} c^{3}+1 \geqslant b^{3}+c^{3}$ as $b^{3}$ and $c^{3}$ are positive integers, so we have

b3c3+1b3+c3a249b4c4 b^{3} c^{3}+1 \geqslant b^{3}+c^{3} \geqslant a^{2} \geqslant \frac{4}{9} b^{4} c^{4}

This implies $b c \leqslant 2$, and hence $c=1$ and $b \leqslant 2$.

N3. We say that a set $S$ of integers is rootiful if, for any positive integer $n$ and any $a_{0}, a_{1}, \ldots, a_{n} \in S$, all integer roots of the polynomial $a_{0}+a_{1} x+\cdots+a_{n} x^{n}$ are also in $S$. Find all rootiful sets of integers that contain all numbers of the form $2^{a}-2^{b}$ for positive integers $a$ and $b$. (Czech Republic) Answer: The set $\mathbb{Z}$ of all integers is the only such rootiful set. Solution 1. The set $\mathbb{Z}$ of all integers is clearly rootiful. We shall prove that any rootiful set $S$ containing all the numbers of the form $2^{a}-2^{b}$ for $a, b \in \mathbb{Z}_{>0}$ must be all of $\mathbb{Z}$.

First, note that $0=2^{1}-2^{1} \in S$ and $2=2^{2}-2^{1} \in S$. Now, $-1 \in S$, since it is a root of $2 x+2$, and $1 \in S$, since it is a root of $2 x^{2}-x-1$. Also, if $n \in S$ then $-n$ is a root of $x+n$, so it suffices to prove that all positive integers must be in $S$.

Now, we claim that any positive integer $n$ has a multiple in $S$. Indeed, suppose that $n=2^{\alpha} \cdot t$ for $\alpha \in \mathbb{Z}_{\geqslant 0}$ and $t$ odd. Then $t \mid 2^{\phi(t)}-1$, so $n \mid 2^{\alpha+\phi(t)+1}-2^{\alpha+1}$. Moreover, $2^{\alpha+\phi(t)+1}-2^{\alpha+1} \in S$, and so $S$ contains a multiple of every positive integer $n$.

We will now prove by induction that all positive integers are in $S$. Suppose that $0,1, \ldots, n-$ $1 \in S$; furthermore, let $N$ be a multiple of $n$ in $S$. Consider the base- $n$ expansion of $N$, say $N=a_{k} n^{k}+a_{k-1} n^{k-1}+\cdots+a_{1} n+a_{0}$. Since $0 \leqslant a_{i}<n$ for each $a_{i}$, we have that all the $a_{i}$ are in $S$. Furthermore, $a_{0}=0$ since $N$ is a multiple of $n$. Therefore, $a_{k} n^{k}+a_{k-1} n^{k-1}+\cdots+a_{1} n-N=0$, so $n$ is a root of a polynomial with coefficients in $S$. This tells us that $n \in S$, completing the induction.

Solution 2. As in the previous solution, we can prove that 0,1 and -1 must all be in any rootiful set $S$ containing all numbers of the form $2^{a}-2^{b}$ for $a, b \in \mathbb{Z}_{>0}$.

We show that, in fact, every integer $k$ with $|k|>2$ can be expressed as a root of a polynomial whose coefficients are of the form $2^{a}-2^{b}$. Observe that it suffices to consider the case where $k$ is positive, as if $k$ is a root of $a_{n} x^{n}+\cdots+a_{1} x+a_{0}=0$, then $-k$ is a root of $(-1)^{n} a_{n} x^{n}+\cdots-$ $a_{1} x+a_{0}=0$.

Note that

(2an2bn)kn++(2a02b0)=0 \left(2^{a_{n}}-2^{b_{n}}\right) k^{n}+\cdots+\left(2^{a_{0}}-2^{b_{0}}\right)=0

is equivalent to

2ankn++2a0=2bnkn++2b0 2^{a_{n}} k^{n}+\cdots+2^{a_{0}}=2^{b_{n}} k^{n}+\cdots+2^{b_{0}}

Hence our aim is to show that two numbers of the form $2^{a_{n}} k^{n}+\cdots+2^{a_{0}}$ are equal, for a fixed value of $n$. We consider such polynomials where every term $2^{a_{i}} k^{i}$ is at most $2 k^{n}$; in other words, where $2 \leqslant 2^{a_{i}} \leqslant 2 k^{n-i}$, or, equivalently, $1 \leqslant a_{i} \leqslant 1+(n-i) \log _{2} k$. Therefore, there must be $1+\left\lfloor(n-i) \log {2} k\right\rfloor$ possible choices for $a{i}$ satisfying these constraints.

The number of possible polynomials is then

i=0n(1+(ni)log2k)i=0n1(ni)log2k=n!(log2k)n \prod_{i=0}^{n}\left(1+\left\lfloor(n-i) \log _{2} k\right\rfloor\right) \geqslant \prod_{i=0}^{n-1}(n-i) \log _{2} k=n!\left(\log _{2} k\right)^{n}

where the inequality holds as $1+\lfloor x\rfloor \geqslant x$. As there are $(n+1)$ such terms in the polynomial, each at most $2 k^{n}$, such a polynomial must have value at most $2 k^{n}(n+1)$. However, for large $n$, we have $n!\left(\log _{2} k\right)^{n}>2 k^{n}(n+1)$. Therefore there are more polynomials than possible values, so some two must be equal, as required.

N4. Let $\mathbb{Z}{>0}$ be the set of positive integers. A positive integer constant $C$ is given. Find all functions $f: \mathbb{Z}{>0} \rightarrow \mathbb{Z}_{>0}$ such that, for all positive integers $a$ and $b$ satisfying $a+b>C$,

a+f(b)a2+bf(a) a+f(b) \mid a^{2}+b f(a)

(Croatia) Answer: The functions satisfying (*) are exactly the functions $f(a)=k a$ for some constant $k \in \mathbb{Z}_{>0}$ (irrespective of the value of $C$ ).

Common remarks. It is easy to verify that the functions $f(a)=k a$ satisfy (). Thus, in the proofs below, we will only focus on the converse implication: that condition () implies that $f=k a$.

A common minor part of these solutions is the derivation of some relatively easy bounds on the function $f$. An upper bound is easily obtained by setting $a=1$ in (*), giving the inequality

f(b)bf(1) f(b) \leqslant b \cdot f(1)

for all sufficiently large $b$. The corresponding lower bound is only marginally more difficult to obtain: substituting $b=1$ in the original equation shows that

a+f(1)(a2+f(a))(af(1))(a+f(1))=f(1)2+f(a) a+f(1) \mid\left(a^{2}+f(a)\right)-(a-f(1)) \cdot(a+f(1))=f(1)^{2}+f(a)

for all sufficiently large $a$. It follows from this that one has the lower bound

f(a)a+f(1)(1f(1)) f(a) \geqslant a+f(1) \cdot(1-f(1))

again for all sufficiently large $a$. Each of the following proofs makes use of at least one of these bounds. Solution 1. First, we show that $b \mid f(b)^{2}$ for all $b$. To do this, we choose a large positive integer $n$ so that $n b-f(b) \geqslant C$. Setting $a=n b-f(b)$ in (*) then shows that

nb(nbf(b))2+bf(nbf(b)) n b \mid(n b-f(b))^{2}+b f(n b-f(b))

so that $b \mid f(b)^{2}$ as claimed. Now in particular we have that $p \mid f(p)$ for every prime $p$. If we write $f(p)=k(p) \cdot p$, then the bound $f(p) \leqslant f(1) \cdot p$ (valid for $p$ sufficiently large) shows that some value $k$ of $k(p)$ must be attained for infinitely many $p$. We will show that $f(a)=k a$ for all positive integers $a$. To do this, we substitute $b=p$ in (*), where $p$ is any sufficiently large prime for which $k(p)=k$, obtaining

a+kp(a2+pf(a))a(a+kp)=pf(a)pka. a+k p \mid\left(a^{2}+p f(a)\right)-a(a+k p)=p f(a)-p k a .

For suitably large $p$ we have $\operatorname{gcd}(a+k p, p)=1$, and hence we have

a+kpf(a)ka a+k p \mid f(a)-k a

But the only way this can hold for arbitrarily large $p$ is if $f(a)-k a=0$. This concludes the proof.

Comment. There are other ways to obtain the divisibility $p \mid f(p)$ for primes $p$, which is all that is needed in this proof. For instance, if $f(p)$ were not divisible by $p$ then the arithmetic progression $p^{2}+b f(p)$ would attain prime values for infinitely many $b$ by Dirichlet's Theorem: hence, for these pairs p , b, we would have $p+f(b)=p^{2}+b f(p)$. Substituting $a \mapsto b$ and $b \mapsto p$ in $(*)$ then shows that $\left(f(p)^{2}-p^{2}\right)(p-1)$ is divisible by $b+f(p)$ and hence vanishes, which is impossible since $p \nmid f(p)$ by assumption.

Solution 2. First, we substitute $b=1$ in (*) and rearrange to find that

f(a)+f(1)2a+f(1)=f(1)a+a2+f(a)a+f(1) \frac{f(a)+f(1)^{2}}{a+f(1)}=f(1)-a+\frac{a^{2}+f(a)}{a+f(1)}

is a positive integer for sufficiently large $a$. Since $f(a) \leqslant a f(1)$, for all sufficiently large $a$, it follows that $\frac{f(a)+f(1)^{2}}{a+f(1)} \leqslant f(1)$ also and hence there is a positive integer $k$ such that $\frac{f(a)+f(1)^{2}}{a+f(1)}=k$ for infinitely many values of $a$. In other words,

f(a)=ka+f(1)(kf(1)) f(a)=k a+f(1) \cdot(k-f(1))

for infinitely many $a$. Fixing an arbitrary choice of $a$ in (*), we have that

a2+bf(a)a+kb+f(1)(kf(1)) \frac{a^{2}+b f(a)}{a+k b+f(1) \cdot(k-f(1))}

is an integer for infinitely many $b$ (the same $b$ as above, maybe with finitely many exceptions). On the other hand, for $b$ taken sufficiently large, this quantity becomes arbitrarily close to $\frac{f(a)}{k}$; this is only possible if $\frac{f(a)}{k}$ is an integer and

a2+bf(a)a+kb+f(1)(kf(1))=f(a)k \frac{a^{2}+b f(a)}{a+k b+f(1) \cdot(k-f(1))}=\frac{f(a)}{k}

for infinitely many $b$. This rearranges to

f(a)k(a+f(1)(kf(1)))=a2 \frac{f(a)}{k} \cdot(a+f(1) \cdot(k-f(1)))=a^{2}

Hence $a^{2}$ is divisible by $a+f(1) \cdot(k-f(1))$, and hence so is $f(1)^{2}(k-f(1))^{2}$. The only way this can occur for all $a$ is if $k=f(1)$, in which case $(* *)$ provides that $f(a)=k a$ for all $a$, as desired.

Solution 3. Fix any two distinct positive integers $a$ and $b$. From (*) it follows that the two integers

(a2+cf(a))(b+f(c)) and (b2+cf(b))(a+f(c)) \left(a^{2}+c f(a)\right) \cdot(b+f(c)) \text { and }\left(b^{2}+c f(b)\right) \cdot(a+f(c))

are both multiples of $(a+f(c)) \cdot(b+f(c))$ for all sufficiently large $c$. Taking an appropriate linear combination to eliminate the $c f(c)$ term, we find after expanding out that the integer

[a2f(b)b2f(a)]f(c)+[(ba)f(a)f(b)]c+[ab(af(b)bf(a))] \left[a^{2} f(b)-b^{2} f(a)\right] \cdot f(c)+[(b-a) f(a) f(b)] \cdot c+[a b(a f(b)-b f(a))]

is also a multiple of $(a+f(c)) \cdot(b+f(c))$. But as $c$ varies, $(\dagger)$ is bounded above by a positive multiple of $c$ while $(a+f(c)) \cdot(b+f(c))$ is bounded below by a positive multiple of $c^{2}$. The only way that such a divisibility can hold is if in fact

[a2f(b)b2f(a)]f(c)+[(ba)f(a)f(b)]c+[ab(af(b)bf(a))]=0 \left[a^{2} f(b)-b^{2} f(a)\right] \cdot f(c)+[(b-a) f(a) f(b)] \cdot c+[a b(a f(b)-b f(a))]=0

for sufficiently large $c$. Since the coefficient of $c$ in this linear relation is nonzero, it follows that there are constants $k, \ell$ such that $f(c)=k c+\ell$ for all sufficiently large $c$; the constants $k$ and $\ell$ are necessarily integers.

The value of $\ell$ satisfies

[a2f(b)b2f(a)]+[ab(af(b)bf(a))]=0 \left[a^{2} f(b)-b^{2} f(a)\right] \cdot \ell+[a b(a f(b)-b f(a))]=0

and hence $b \mid \ell a^{2} f(b)$ for all $a$ and $b$. Taking $b$ sufficiently large so that $f(b)=k b+\ell$, we thus have that $b \mid \ell^{2} a^{2}$ for all sufficiently large $b$; this implies that $\ell=0$. From ( $\dagger \dagger \dagger$ ) it then follows that $\frac{f(a)}{a}=\frac{f(b)}{b}$ for all $a \neq b$, so that there is a constant $k$ such that $f(a)=k a$ for all $a$ ( $k$ is equal to the constant defined earlier).

Solution 4. Let $\Gamma$ denote the set of all points $(a, f(a))$, so that $\Gamma$ is an infinite subset of the upper-right quadrant of the plane. For a point $A=(a, f(a))$ in $\Gamma$, we define a point $A^{\prime}=\left(-f(a),-f(a)^{2} / a\right)$ in the lower-left quadrant of the plane, and let $\Gamma^{\prime}$ denote the set of all such points $A^{\prime}$.

Claim. For any point $A \in \Gamma$, the set $\Gamma$ is contained in finitely many lines through the point $A^{\prime}$. Proof. Let $A=(a, f(a))$. The functional equation (with $a$ and $b$ interchanged) can be rewritten as $b+f(a) \mid a f(b)-b f(a)$, so that all but finitely many points in $\Gamma$ are contained in one of the lines with equation

ayf(a)x=m(x+f(a)) a y-f(a) x=m(x+f(a))

for $m$ an integer. Geometrically, these are the lines through $A^{\prime}=\left(-f(a),-f(a)^{2} / a\right)$ with gradient $\frac{f(a)+m}{a}$. Since $\Gamma$ is contained, with finitely many exceptions, in the region $0 \leqslant y \leqslant$ $f(1) \cdot x$ and the point $A^{\prime}$ lies strictly in the lower-left quadrant of the plane, there are only finitely many values of $m$ for which this line meets $\Gamma$. This concludes the proof of the claim.

Now consider any distinct points $A, B \in \Gamma$. It is clear that $A^{\prime}$ and $B^{\prime}$ are distinct. A line through $A^{\prime}$ and a line through $B^{\prime}$ only meet in more than one point if these two lines are equal to the line $A^{\prime} B^{\prime}$. It then follows from the above claim that the line $A^{\prime} B^{\prime}$ must contain all but finitely many points of $\Gamma$. If $C$ is another point of $\Gamma$, then the line $A^{\prime} C^{\prime}$ also passes through all but finitely many points of $\Gamma$, which is only possible if $A^{\prime} C^{\prime}=A^{\prime} B^{\prime}$.

We have thus seen that there is a line $\ell$ passing through all points of $\Gamma^{\prime}$ and through all but finitely many points of $\Gamma$. We claim that this line passes through the origin $O$ and passes through every point of $\Gamma$. To see this, note that by construction $A, O, A^{\prime}$ are collinear for every point $A \in \Gamma$. Since $\ell=A A^{\prime}$ for all but finitely many points $A \in \Gamma$, it thus follows that $O \in \ell$. Thus any $A \in \Gamma$ lies on the line $\ell=A^{\prime} O$.

Since $\Gamma$ is contained in a line through $O$, it follows that there is a real constant $k$ (the gradient of $\ell$ ) such that $f(a)=k a$ for all $a$. The number $k$ is, of course, a positive integer.

Comment. Without the $a+b>C$ condition, this problem is approachable by much more naive methods. For instance, using the given divisibility for $a, b \in{1,2,3}$ one can prove by a somewhat tedious case-check that $f(2)=2 f(1)$ and $f(3)=3 f(1)$; this then forms the basis of an induction establishing that $f(n)=n f(1)$ for all $n$.

N5. Let $a$ be a positive integer. We say that a positive integer $b$ is $a$-good if $\binom{a n}{b}-1$ is divisible by $a n+1$ for all positive integers $n$ with $a n \geqslant b$. Suppose $b$ is a positive integer such that $b$ is $a$-good, but $b+2$ is not $a$-good. Prove that $b+1$ is prime. (Netherlands) Solution 1. For $p$ a prime and $n$ a nonzero integer, we write $v_{p}(n)$ for the $p$-adic valuation of $n$ : the largest integer $t$ such that $p^{t} \mid n$.

We first show that $b$ is $a$-good if and only if $b$ is even, and $p \mid a$ for all primes $p \leqslant b$. To start with, the condition that $a n+1 \left\lvert,\binom{ a n}{b}-1\right.$ can be rewritten as saying that

an(an1)(anb+1)b!1(an+1) \frac{a n(a n-1) \cdots(a n-b+1)}{b!} \equiv 1 \quad(\bmod a n+1)

Suppose, on the one hand, there is a prime $p \leqslant b$ with $p \nmid a$. Take $t=v_{p}(b!)$. Then there exist positive integers $c$ such that $a c \equiv 1\left(\bmod p^{t+1}\right)$. If we take $c$ big enough, and then take $n=(p-1) c$, then $a n=a(p-1) c \equiv p-1\left(\bmod p^{t+1}\right)$ and $a n \geqslant b$. Since $p \leqslant b$, one of the terms of the numerator an $(a n-1) \cdots(a n-b+1)$ is $a n-p+1$, which is divisible by $p^{t+1}$. Hence the $p$-adic valuation of the numerator is at least $t+1$, but that of the denominator is exactly $t$. This means that $p \left\lvert,\binom{ a n}{b}\right.$, so $p \nmid\binom{a n}{b}-1$. As $p \mid a n+1$, we get that $a n+1 \nmid\binom{a n}{b}$, so $b$ is not $a$-good.

On the other hand, if for all primes $p \leqslant b$ we have $p \mid a$, then every factor of $b$ ! is coprime to $a n+1$, and hence invertible modulo $a n+1$ : hence $b$ ! is also invertible modulo $a n+1$. Then equation (1) reduces to:

an(an1)(anb+1)b!(an+1) a n(a n-1) \cdots(a n-b+1) \equiv b!\quad(\bmod a n+1)

However, we can rewrite the left-hand side as follows:

an(an1)(anb+1)(1)(2)(b)(1)bb!(an+1) a n(a n-1) \cdots(a n-b+1) \equiv(-1)(-2) \cdots(-b) \equiv(-1)^{b} b!\quad(\bmod a n+1)

Provided that $a n>1$, if $b$ is even we deduce $(-1)^{b} b!\equiv b$ ! as needed. On the other hand, if $b$ is odd, and we take $a n+1>2(b!)$, then we will not have $(-1)^{b} b!\equiv b$ !, so $b$ is not $a$-good. This completes the claim.

To conclude from here, suppose that $b$ is $a$-good, but $b+2$ is not. Then $b$ is even, and $p \mid a$ for all primes $p \leqslant b$, but there is a prime $q \leqslant b+2$ for which $q \nmid a$ : so $q=b+1$ or $q=b+2$. We cannot have $q=b+2$, as that is even too, so we have $q=b+1$ : in other words, $b+1$ is prime.

Solution 2. We show only half of the claim of the previous solution: we show that if $b$ is $a$-good, then $p \mid a$ for all primes $p \leqslant b$. We do this with Lucas' theorem.

Suppose that we have $p \leqslant b$ with $p \nmid a$. Then consider the expansion of $b$ in base $p$; there will be some digit (not the final digit) which is nonzero, because $p \leqslant b$. Suppose it is the $p^{t}$ digit for $t \geqslant 1$.

Now, as $n$ varies over the integers, an +1 runs over all residue classes modulo $p^{t+1}$; in particular, there is a choice of $n$ (with $a n>b$ ) such that the $p^{0}$ digit of $a n$ is $p-1$ (so $p \mid a n+1$ ) and the $p^{t}$ digit of $a n$ is 0 . Consequently, $p \mid a n+1$ but $p \left\lvert,\binom{ a n}{b}\right.$ (by Lucas' theorem) so $p \nmid\binom{a n}{b}-1$. Thus $b$ is not $a$-good.

Now we show directly that if $b$ is $a$-good but $b+2$ fails to be so, then there must be a prime dividing $a n+1$ for some $n$, which also divides $(b+1)(b+2)$. Indeed, the ratio between $\binom{a n}{b+2}$ and $\binom{a n}{b}$ is $(b+1)(b+2) /(a n-b)(a n-b-1)$. We know that there must be a choice of $a n+1$ such that the former binomial coefficient is 1 modulo $a n+1$ but the latter is not, which means that the given ratio must not be $1 \bmod a n+1$. If $b+1$ and $b+2$ are both coprime to $a n+1$ then the ratio is 1 , so that must not be the case. In particular, as any prime less than $b$ divides $a$, it must be the case that either $b+1$ or $b+2$ is prime.

However, we can observe that $b$ must be even by insisting that $a n+1$ is prime (which is possible by Dirichlet's theorem) and hence $\binom{a n}{b} \equiv(-1)^{b}=1$. Thus $b+2$ cannot be prime, so $b+1$ must be prime.

N6. Let $H=\left{\lfloor i \sqrt{2}\rfloor: i \in \mathbb{Z}{>0}\right}={1,2,4,5,7, \ldots}$, and let $n$ be a positive integer. Prove that there exists a constant $C$ such that, if $A \subset{1,2, \ldots, n}$ satisfies $|A| \geqslant C \sqrt{n}$, then there exist $a, b \in A$ such that $a-b \in H$. (Here $\mathbb{Z}{>0}$ is the set of positive integers, and $\lfloor z\rfloor$ denotes the greatest integer less than or equal to $z$.) (Brazil) Common remarks. In all solutions, we will assume that $A$ is a set such that ${a-b: a, b \in A}$ is disjoint from $H$, and prove that $|A|<C \sqrt{n}$.

Solution 1. First, observe that if $n$ is a positive integer, then $n \in H$ exactly when

{n2}>112. \left\{\frac{n}{\sqrt{2}}\right\}>1-\frac{1}{\sqrt{2}} .

To see why, observe that $n \in H$ if and only if $0<i \sqrt{2}-n<1$ for some $i \in \mathbb{Z}_{>0}$. In other words, $0<i-n / \sqrt{2}<1 / \sqrt{2}$, which is equivalent to (1).

Now, write $A=\left{a_{1}<a_{2}<\cdots<a_{k}\right}$, where $k=|A|$. Observe that the set of differences is not altered by shifting $A$, so we may assume that $A \subseteq{0,1, \ldots, n-1}$ with $a_{1}=0$.

From (1), we learn that $\left{a_{i} / \sqrt{2}\right}<1-1 / \sqrt{2}$ for each $i>1$ since $a_{i}-a_{1} \notin H$. Furthermore, we must have $\left{a_{i} / \sqrt{2}\right}<\left{a_{j} / \sqrt{2}\right}$ whenever $i<j$; otherwise, we would have

(112)<{aj2}{ai2}<0. -\left(1-\frac{1}{\sqrt{2}}\right)<\left\{\frac{a_{j}}{\sqrt{2}}\right\}-\left\{\frac{a_{i}}{\sqrt{2}}\right\}<0 .

Since $\left{\left(a_{j}-a_{i}\right) / \sqrt{2}\right}=\left{a_{j} / \sqrt{2}\right}-\left{a_{i} / \sqrt{2}\right}+1$, this implies that $\left{\left(a_{j}-a_{i}\right) / \sqrt{2}\right}>1 / \sqrt{2}>$ $1-1 / \sqrt{2}$, contradicting (1).

Now, we have a sequence $0=a_{1}<a_{2}<\cdots<a_{k}<n$, with

0={a12}<{a22}<<{ak2}<112. 0=\left\{\frac{a_{1}}{\sqrt{2}}\right\}<\left\{\frac{a_{2}}{\sqrt{2}}\right\}<\cdots<\left\{\frac{a_{k}}{\sqrt{2}}\right\}<1-\frac{1}{\sqrt{2}} .

We use the following fact: for any $d \in \mathbb{Z}$, we have

{d2}>12d2 \left\{\frac{d}{\sqrt{2}}\right\}>\frac{1}{2 d \sqrt{2}}

To see why this is the case, let $h=\lfloor d / \sqrt{2}\rfloor$, so ${d / \sqrt{2}}=d / \sqrt{2}-h$. Then

{d2}(d2+h)=d22h2212 \left\{\frac{d}{\sqrt{2}}\right\}\left(\frac{d}{\sqrt{2}}+h\right)=\frac{d^{2}-2 h^{2}}{2} \geqslant \frac{1}{2}

since the numerator is a positive integer. Because $d / \sqrt{2}+h<2 d / \sqrt{2}$, inequality (2) follows. Let $d_{i}=a_{i+1}-a_{i}$, for $1 \leqslant i<k$. Then $\left{a_{i+1} / \sqrt{2}\right}-\left{a_{i} / \sqrt{2}\right}=\left{d_{i} / \sqrt{2}\right}$, and we have

112>i{di2}>122i1di(k1)2221idi>(k1)2221n. 1-\frac{1}{\sqrt{2}}>\sum_{i}\left\{\frac{d_{i}}{\sqrt{2}}\right\}>\frac{1}{2 \sqrt{2}} \sum_{i} \frac{1}{d_{i}} \geqslant \frac{(k-1)^{2}}{2 \sqrt{2}} \frac{1}{\sum_{i} d_{i}}>\frac{(k-1)^{2}}{2 \sqrt{2}} \cdot \frac{1}{n} .

Here, the first inequality holds because $\left{a_{k} / \sqrt{2}\right}<1-1 / \sqrt{2}$, the second follows from (2), the third follows from an easy application of the AM-HM inequality (or Cauchy-Schwarz), and the fourth follows from the fact that $\sum_{i} d_{i}=a_{k}<n$.

Rearranging this, we obtain

222n>k1 \sqrt{2 \sqrt{2}-2} \cdot \sqrt{n}>k-1

which provides the required bound on $k$.

Solution 2. Let $\alpha=2+\sqrt{2}$, so $(1 / \alpha)+(1 / \sqrt{2})=1$. Thus, $J=\left{\lfloor i \alpha\rfloor: i \in \mathbb{Z}{>0}\right}$ is the complementary Beatty sequence to $H$ (in other words, $H$ and $J$ are disjoint with $H \cup J=\mathbb{Z}{>0}$ ). Write $A=\left{a_{1}<a_{2}<\cdots<a_{k}\right}$. Suppose that $A$ has no differences in $H$, so all its differences are in $J$ and we can set $a_{i}-a_{1}=\left\lfloor\alpha b_{i}\right\rfloor$ for $b_{i} \in \mathbb{Z}_{>0}$.

For any $j>i$, we have $a_{j}-a_{i}=\left\lfloor\alpha b_{j}\right\rfloor-\left\lfloor\alpha b_{i}\right\rfloor$. Because $a_{j}-a_{i} \in J$, we also have $a_{j}-a_{i}=\lfloor\alpha t\rfloor$ for some positive integer $t$. Thus, $\lfloor\alpha t\rfloor=\left\lfloor\alpha b_{j}\right\rfloor-\left\lfloor\alpha b_{i}\right\rfloor$. The right hand side must equal either $\left\lfloor\alpha\left(b_{j}-b_{i}\right)\right\rfloor$ or $\left\lfloor\alpha\left(b_{j}-b_{i}\right)\right\rfloor-1$, the latter of which is not a member of $J$ as $\alpha>2$. Therefore, $t=b_{j}-b_{i}$ and so we have $\left\lfloor\alpha b_{j}\right\rfloor-\left\lfloor\alpha b_{i}\right\rfloor=\left\lfloor\alpha\left(b_{j}-b_{i}\right)\right\rfloor$.

For $1 \leqslant i<k$ we now put $d_{i}=b_{i+1}-b_{i}$, and we have

αidi=αbk=iαdi; \left\lfloor\alpha \sum_{i} d_{i}\right\rfloor=\left\lfloor\alpha b_{k}\right\rfloor=\sum_{i}\left\lfloor\alpha d_{i}\right\rfloor ;

that is, $\sum_{i}\left{\alpha d_{i}\right}<1$. We also have

1+αidi=1+aka1akn 1+\left\lfloor\alpha \sum_{i} d_{i}\right\rfloor=1+a_{k}-a_{1} \leqslant a_{k} \leqslant n

so $\sum_{i} d_{i} \leqslant n / \alpha$. With the above inequalities, an argument similar to (3) (which uses the fact that ${\alpha d}=$ ${d \sqrt{2}}>1 /(2 d \sqrt{2})$ for positive integers $d)$ proves that $1>\left((k-1)^{2} /(2 \sqrt{2})\right)(\alpha / n)$, which again rearranges to give

222n>k1 \sqrt{2 \sqrt{2}-2} \cdot \sqrt{n}>k-1

Comment. The use of Beatty sequences in Solution 2 is essentially a way to bypass (1). Both Solutions 1 and 2 use the fact that $\sqrt{2}<2$; the statement in the question would still be true if $\sqrt{2}$ did not have this property (for instance, if it were replaced with $\alpha$ ), but any argument along the lines of Solutions 1 or 2 would be more complicated.

Solution 3. Again, define $J=\mathbb{Z}_{>0} \backslash H$, so all differences between elements of $A$ are in $J$. We start by making the following observation. Suppose we have a set $B \subseteq{1,2, \ldots, n}$ such that all of the differences between elements of $B$ are in $H$. Then $|A| \cdot|B| \leqslant 2 n$.

To see why, observe that any two sums of the form $a+b$ with $a \in A, b \in B$ are different; otherwise, we would have $a_{1}+b_{1}=a_{2}+b_{2}$, and so $\left|a_{1}-a_{2}\right|=\left|b_{2}-b_{1}\right|$. However, then the left hand side is in $J$ whereas the right hand side is in $H$. Thus, ${a+b: a \in A, b \in B}$ is a set of size $|A| \cdot|B|$ all of whose elements are no greater than $2 n$, yielding the claimed inequality.

With this in mind, it suffices to construct a set $B$, all of whose differences are in $H$ and whose size is at least $C^{\prime} \sqrt{n}$ for some constant $C^{\prime}>0$.

To do so, we will use well-known facts about the negative Pell equation $X^{2}-2 Y^{2}=-1$; in particular, that there are infinitely many solutions and the values of $X$ are given by the recurrence $X_{1}=1, X_{2}=7$ and $X_{m}=6 X_{m-1}-X_{m-2}$. Therefore, we may choose $X$ to be a solution with $\sqrt{n} / 6<X \leqslant \sqrt{n}$.

Now, we claim that we may choose $B={X, 2 X, \ldots,\lfloor(1 / 3) \sqrt{n}\rfloor X}$. Indeed, we have

(X2Y)(X2+Y)=12 \left(\frac{X}{\sqrt{2}}-Y\right)\left(\frac{X}{\sqrt{2}}+Y\right)=\frac{-1}{2}

and so

0>(X2Y)32n, 0>\left(\frac{X}{\sqrt{2}}-Y\right) \geqslant \frac{-3}{\sqrt{2 n}},

from which it follows that ${X / \sqrt{2}}>1-(3 / \sqrt{2 n})$. Combined with (1), this shows that all differences between elements of $B$ are in $H$.

Comment. Some of the ideas behind Solution 3 may be used to prove that the constant $C=\sqrt{2 \sqrt{2}-2}$ (from Solutions 1 and 2) is optimal, in the sense that there are arbitrarily large values of $n$ and sets $A_{n} \subseteq{1,2, \ldots, n}$ of size roughly $C \sqrt{n}$, all of whose differences are contained in $J$.

To see why, choose $X$ to come from a sufficiently large solution to the Pell equation $X^{2}-2 Y^{2}=1$, so ${X / \sqrt{2}} \approx 1 /(2 X \sqrt{2})$. In particular, ${X},{2 X}, \ldots,{[2 X \sqrt{2}(1-1 / \sqrt{2})\rfloor X}$ are all less than $1-1 / \sqrt{2}$. Thus, by (1) any positive integer of the form $i X$ for $1 \leqslant i \leqslant\lfloor 2 X \sqrt{2}(1-1 / \sqrt{2})\rfloor$ lies in $J$.

Set $n \approx 2 X^{2} \sqrt{2}(1-1 / \sqrt{2})$. We now have a set $A={i X: i \leqslant\lfloor 2 X \sqrt{2}(1-1 / \sqrt{2})\rfloor}$ containing roughly $2 X \sqrt{2}(1-1 / \sqrt{2})$ elements less than or equal to $n$ such that all of the differences lie in $J$, and we can see that $|A| \approx C \sqrt{n}$ with $C=\sqrt{2 \sqrt{2}-2}$.

Solution 4. As in Solution 3, we will provide a construction of a large set $B \subseteq{1,2, \ldots, n}$, all of whose differences are in $H$.

Choose $Y$ to be a solution to the Pell-like equation $X^{2}-2 Y^{2}= \pm 1$; such solutions are given by the recurrence $Y_{1}=1, Y_{2}=2$ and $Y_{m}=2 Y_{m-1}+Y_{m-2}$, and so we can choose $Y$ such that $n /(3 \sqrt{2})<Y \leqslant n / \sqrt{2}$. Furthermore, it is known that for such a $Y$ and for $1 \leqslant x<Y$,

{x2}+{(Yx)2}={Y/2} \{x \sqrt{2}\}+\{(Y-x) \sqrt{2}\}=\{Y / \sqrt{2}\}

if $X^{2}-2 Y^{2}=1$, and

{x2}+{(Yx)2}=1+{Y/2} \{x \sqrt{2}\}+\{(Y-x) \sqrt{2}\}=1+\{Y / \sqrt{2}\}

if $X^{2}-2 Y^{2}=-1$. Indeed, this is a statement of the fact that $X / Y$ is a best rational approximation to $\sqrt{2}$, from below in the first case and from above in the second.

Now, consider the sequence ${\sqrt{2}},{2 \sqrt{2}}, \ldots,{(Y-1) \sqrt{2}}$. The Erdős-Szekeres theorem tells us that this sequence has a monotone subsequence with at least $\sqrt{Y-2}+1>\sqrt{Y}$ elements; if that subsequence is decreasing, we may reflect (using (4) or (5)) to ensure that it is increasing. Call the subsequence $\left{y_{1} \sqrt{2}\right},\left{y_{2} \sqrt{2}\right}, \ldots,\left{y_{t} \sqrt{2}\right}$ for $t>\sqrt{Y}$.

Now, set $B=\left{\left\lfloor y_{i} \sqrt{2}\right\rfloor: 1 \leqslant i \leqslant t\right}$. We have $\left\lfloor y_{j} \sqrt{2}\right\rfloor-\left\lfloor y_{i} \sqrt{2}\right\rfloor=\left\lfloor\left(y_{j}-y_{i}\right) \sqrt{2}\right\rfloor$ for $i<j$ (because the corresponding inequality for the fractional parts holds by the ordering assumption on the $\left{y_{i} \sqrt{2}\right}$ ), which means that all differences between elements of $B$ are indeed in $H$. Since $|B|>\sqrt{Y}>\sqrt{n} / \sqrt{3 \sqrt{2}}$, this is the required set.

Comment. Any solution to this problem will need to use the fact that $\sqrt{2}$ cannot be approximated well by rationals, either directly or implicitly (for example, by using facts about solutions to Pelllike equations). If $\sqrt{2}$ were replaced by a value of $\theta$ with very good rational approximations (from below), then an argument along the lines of Solution 3 would give long arithmetic progressions in ${\lfloor i \theta\rfloor: 0 \leqslant i<n}$ (with initial term 0 ) for certain values of $n$.

N7. Prove that there is a constant $c>0$ and infinitely many positive integers $n$ with the following property: there are infinitely many positive integers that cannot be expressed as the sum of fewer than $c n \log (n)$ pairwise coprime $n^{\text {th }}$ powers. (Canada) Solution 1. Suppose, for an integer $n$, that we can find another integer $N$ satisfying the following property: $n$ is divisible by $\varphi\left(p^{e}\right)$ for every prime power $p^{e}$ exactly dividing $N$. This property ensures that all $n^{\text {th }}$ powers are congruent to 0 or 1 modulo each such prime power $p^{e}$, and hence that any sum of $m$ pairwise coprime $n^{\text {th }}$ powers is congruent to $m$ or $m-1$ modulo $p^{e}$, since at most one of the $n^{\text {th }}$ powers is divisible by $p$. Thus, if $k$ denotes the number of distinct prime factors of $N$, we find by the Chinese Remainder Theorem at most $2^{k} m$ residue classes modulo $N$ which are sums of at most $m$ pairwise coprime $n^{\text {th }}$ powers. In particular, if $N>2^{k} m$ then there are infinitely many positive integers not expressible as a sum of at most $m$ pairwise coprime $n^{\text {th }}$ powers.

It thus suffices to prove that there are arbitrarily large pairs $(n, N)$ of integers satisfying $(\dagger)$ such that

N>c2knlog(n) N>c \cdot 2^{k} n \log (n)

for some positive constant $c$. We construct such pairs as follows. Fix a positive integer $t$ and choose (distinct) prime numbers $p \mid 2^{2^{t-1}}+1$ and $q \mid 2^{2^{t}}+1$; we set $N=p q$. It is well-known that $2^{t} \mid p-1$ and $2^{t+1} \mid q-1$, hence

n=(p1)(q1)2t n=\frac{(p-1)(q-1)}{2^{t}}

is an integer and the pair $(n, N)$ satisfies $(\dagger)$. Estimating the size of $N$ and $n$ is now straightforward. We have

log2(n)2t1+2tt<2t+1<2Nn \log _{2}(n) \leqslant 2^{t-1}+2^{t}-t<2^{t+1}<2 \cdot \frac{N}{n}

which rearranges to

N>1822nlog2(n) N>\frac{1}{8} \cdot 2^{2} n \log _{2}(n)

and so we are done if we choose $c<\frac{1}{8 \log (2)} \approx 0.18$. Comment 1. The trick in the above solution was to find prime numbers $p$ and $q$ congruent to 1 modulo some $d=2^{t}$ and which are not too large. An alternative way to do this is via Linnik's Theorem, which says that there are absolute constants $b$ and $L>1$ such that for any coprime integers $a$ and $d$, there is a prime congruent to $a$ modulo $d$ and of size $\leqslant b d^{L}$. If we choose some $d$ not divisible by 3 and choose two distinct primes $p, q \leqslant b \cdot(3 d)^{L}$ congruent to 1 modulo $d$ (and, say, distinct modulo 3 ), then we obtain a pair $(n, N)$ satisfying $(\dagger)$ with $N=p q$ and $n=\frac{(p-1)(q-1)}{d}$. A straightforward computation shows that

N>Cn1+12L1 N>C n^{1+\frac{1}{2 L-1}}

for some constant $C$, which is in particular larger than any $c \cdot 2^{2} n \log (n)$ for $p$ large. Thus, the statement of the problem is true for any constant $c$. More strongly, the statement of the problem is still true when $c n \log (n)$ is replaced by $n^{1+\delta}$ for a sufficiently small $\delta>0$.

Solution 2, obtaining better bounds. As in the preceding solution, we seek arbitrarily large pairs of integers $n$ and $N$ satisfying ( $\dagger$ ) such that $N>c 2^{k} n \log (n)$.

This time, to construct such pairs, we fix an integer $x \geqslant 4$, set $N$ to be the lowest common multiple of $1,2, \ldots, 2 x$, and set $n$ to be twice the lowest common multiple of $1,2, \ldots, x$. The pair $(n, N)$ does indeed satisfy the condition, since if $p^{e}$ is a prime power divisor of $N$ then $\frac{\varphi\left(p^{e}\right)}{2} \leqslant x$ is a factor of $\frac{n}{2}=\operatorname{lcm}_{r \leqslant x}(r)$.

Now $2 N / n$ is the product of all primes having a power lying in the interval $(x, 2 x]$, and hence $2 N / n>x^{\pi(2 x)-\pi(x)}$. Thus for sufficiently large $x$ we have

log(2N2π(2x)n)>(π(2x)π(x))log(x)log(2)π(2x)x \log \left(\frac{2 N}{2^{\pi(2 x)} n}\right)>(\pi(2 x)-\pi(x)) \log (x)-\log (2) \pi(2 x) \sim x

using the Prime Number Theorem $\pi(t) \sim t / \log (t)$. On the other hand, $n$ is a product of at most $\pi(x)$ prime powers less than or equal to $x$, and so we have the upper bound

log(n)π(x)log(x)x \log (n) \leqslant \pi(x) \log (x) \sim x

again by the Prime Number Theorem. Combined with the above inequality, we find that for any $\epsilon>0$, the inequality

log(N2π(2x)n)>(1ϵ)log(n) \log \left(\frac{N}{2^{\pi(2 x)} n}\right)>(1-\epsilon) \log (n)

holds for sufficiently large $x$. Rearranging this shows that

N>2π(2x)n2ϵ>2π(2x)nlog(n) N>2^{\pi(2 x)} n^{2-\epsilon}>2^{\pi(2 x)} n \log (n)

for all sufficiently large $x$ and we are done. Comment 2. The stronger bound $N>2^{\pi(2 x)} n^{2-\epsilon}$ obtained in the above proof of course shows that infinitely many positive integers cannot be written as a sum of at most $n^{2-\epsilon}$ pairwise coprime $n^{\text {th }}$ powers.

By refining the method in Solution 2, these bounds can be improved further to show that infinitely many positive integers cannot be written as a sum of at most $n^{\alpha}$ pairwise coprime $n^{\text {th }}$ powers for any positive $\alpha>0$. To do this, one fixes a positive integer $d$, sets $N$ equal to the product of the primes at most $d x$ which are congruent to 1 modulo $d$, and $n=d \mathrm{lcm}_{r \leqslant x}(r)$. It follows as in Solution 2 that $(n, N)$ satisfies $(\dagger)$.

Now the Prime Number Theorem in arithmetic progressions provides the estimates $\log (N) \sim \frac{d}{\varphi(d)} x$, $\log (n) \sim x$ and $\pi(d x) \sim \frac{d x}{\log (x)}$ for any fixed $d$. Combining these provides a bound

N>2π(dx)nd/φ(d)ϵ N>2^{\pi(d x)} n^{d / \varphi(d)-\epsilon}

for any positive $\epsilon$, valid for $x$ sufficiently large. Since the ratio $\frac{d}{\varphi(d)}$ can be made arbitrarily large by a judicious choice of $d$, we obtain the $n^{\alpha}$ bound claimed.

Comment 3. While big results from analytic number theory such as the Prime Number Theorem or Linnik's Theorem certainly can be used in this problem, they do not seem to substantially simplify matters: all known solutions involve first reducing to condition ( $\dagger$ ), and even then analytic results do not make it clear how to proceed. For this reason, we regard this problem as suitable for the IMO.

Rather than simplifying the problem, what nonelementary results from analytic number theory allow one to achieve is a strengthening of the main bound, typically replacing the $n \log (n)$ growth with a power $n^{1+\delta}$. However, we believe that such stronger bounds are unlikely to be found by students in the exam.

The strongest bound we know how to achieve using purely elementary methods is a bound of the form $N>2^{k} n \log (n)^{M}$ for any positive integer $M$. This is achieved by a variant of the argument in Solution 1, choosing primes $p_{0}, \ldots, p_{M}$ with $p_{i} \mid 2^{2^{t+i-1}}+1$ and setting $N=\prod_{i} p_{i}$ and $n=$ $2^{-t M} \prod_{i}\left(p_{i}-1\right)$.

N8. Let $a$ and $b$ be two positive integers. Prove that the integer

a2+4a2b a^{2}+\left\lceil\frac{4 a^{2}}{b}\right\rceil

is not a square. (Here $\lceil z\rceil$ denotes the least integer greater than or equal to z.) (Russia) Solution 1. Arguing indirectly, assume that

a2+4a2b=(a+k)2, or (2a)2b=(2a+k)k a^{2}+\left\lceil\frac{4 a^{2}}{b}\right\rceil=(a+k)^{2}, \quad \text { or } \quad\left\lceil\frac{(2 a)^{2}}{b}\right\rceil=(2 a+k) k

Clearly, $k \geqslant 1$. In other words, the equation

c2b=(c+k)k \left\lceil\frac{c^{2}}{b}\right\rceil=(c+k) k

has a positive integer solution $(c, k)$, with an even value of $c$. Choose a positive integer solution of (1) with minimal possible value of $k$, without regard to the parity of $c$. From

c2b>c2b1=ck+k21ck \frac{c^{2}}{b}>\left\lceil\frac{c^{2}}{b}\right\rceil-1=c k+k^{2}-1 \geqslant c k

and

(ck)(c+k)b<c2bc2b=(c+k)k \frac{(c-k)(c+k)}{b}<\frac{c^{2}}{b} \leqslant\left\lceil\frac{c^{2}}{b}\right\rceil=(c+k) k

it can be seen that $c>b k>c-k$, so

c=kb+r with some 0<r<k c=k b+r \quad \text { with some } 0<r<k

By substituting this in (1) we get

c2b=(bk+r)2b=k2b+2kr+r2b \left\lceil\frac{c^{2}}{b}\right\rceil=\left\lceil\frac{(b k+r)^{2}}{b}\right\rceil=k^{2} b+2 k r+\left\lceil\frac{r^{2}}{b}\right\rceil

and

(c+k)k=(kb+r+k)k=k2b+2kr+k(kr) (c+k) k=(k b+r+k) k=k^{2} b+2 k r+k(k-r)

so

r2b=k(kr) \left\lceil\frac{r^{2}}{b}\right\rceil=k(k-r)

Notice that relation (2) provides another positive integer solution of (1), namely $c^{\prime}=r$ and $k^{\prime}=k-r$, with $c^{\prime}>0$ and $0<k^{\prime}<k$. That contradicts the minimality of $k$, and hence finishes the solution.

Solution 2. Suppose that

a2+4a2b=c2 a^{2}+\left\lceil\frac{4 a^{2}}{b}\right\rceil=c^{2}

with some positive integer $c>a$, so

c21<a2+4a2bc20c2ba2(b+4)<b \begin{aligned} & c^{2}-1<a^{2}+\frac{4 a^{2}}{b} \leqslant c^{2} \\ & 0 \leqslant c^{2} b-a^{2}(b+4)<b \end{aligned}

Let $d=c^{2} b-a^{2}(b+4), x=c+a$ and $y=c-a$; then we have $c=\frac{x+y}{2}$ and $a=\frac{x-y}{2}$, and (3) can be re-written as follows:

(x+y2)2b(xy2)2(b+4)=dx2(b+2)xy+y2+d=0;0d<b \begin{aligned} \left(\frac{x+y}{2}\right)^{2} b-\left(\frac{x-y}{2}\right)^{2}(b+4) & =d \\ x^{2}-(b+2) x y+y^{2}+d=0 ; \quad 0 & \leqslant d<b \end{aligned}

So, by the indirect assumption, the equation (4) has some positive integer solution $(x, y)$. Fix $b$ and $d$, and take a pair $(x, y)$ of positive integers, satisfying (4), such that $x+y$ is minimal. By the symmetry in (4) we may assume that $x \geqslant y \geqslant 1$.

Now we perform a usual "Vieta jump". Consider (4) as a quadratic equation in variable $x$, and let $z$ be its second root. By the Vieta formulas,

x+z=(b+2)y, and zx=y2+d, x+z=(b+2) y, \quad \text { and } \quad z x=y^{2}+d,

so

z=(b+2)yx=y2+dx z=(b+2) y-x=\frac{y^{2}+d}{x}

The first formula shows that $z$ is an integer, and by the second formula $z$ is positive. Hence $(z, y)$ is another positive integer solution of (4). From

(x1)(z1)=xz(x+z)+1=(y2+d)(b+2)y+1<(y2+b)(b+2)y+1=(y1)2b(y1)(y1)2(x1)2 \begin{aligned} (x-1)(z-1) & =x z-(x+z)+1=\left(y^{2}+d\right)-(b+2) y+1 \\ & <\left(y^{2}+b\right)-(b+2) y+1=(y-1)^{2}-b(y-1) \leqslant(y-1)^{2} \leqslant(x-1)^{2} \end{aligned}

we can see that $z<x$ and therefore $z+y<x+y$. But this contradicts the minimality of $x+y$ among the positive integer solutions of (4).

The activities of the Problem Selection Committee were supported by Trinity College, Cambridge University of Cambridge