In the plane there is an infinite chessboard.
For any pair of positive integers $m$ and $n$,
consider a right-angled triangle with vertices at lattice points
and whose legs, of lengths $m$ and $n$, lie along edges of the squares.
Let $S_1$ be the total area of the black part of the triangle
and $S_2$ be the total area of the white part.
Let $f(m,n) = | S_1 - S_2 |$.

[(a)]
Calculate $f(m,n)$ for all positive integers $m$ and $n$
which are either both even or both odd.
Prove that $f(m,n) \leq \frac 12 \max \{m,n\}$ for all $m$ and $n$.
Show that there is no constant $C$
such that $f(m,n) < C$ for all $m$ and $ n$.

Solution:
In general, we say the discrepancy of a region in the plane
equals its black area minus its white area.
We allow negative discrepancies,
so discrepancy is additive and $f(m,n)$ equals the absolute value
of the discrepancy of a right triangle with legs $m$ and $n$.

For (a), the answers are $0$ and $1/2$ respectively.
To see this, consider the figure shown below.
[Figure omitted]
Notice that triangles $APM$ and $BQM$ are congruent,
and when $m \equiv n \pmod 2$, their colorings actually coincide.
So, the discrepancy of the triangle
is exactly equal to the discrepancy of $CPQB$, which is an $m \times n/2$
rectangle and hence equal to $0$ or $1/2$ according to parity.

For (b), note that a triangle with legs $m$ and $n$, with $m$ even and $n$ odd,
can be dissected into one right triangle with legs $m$ and $n-1$
plus a thin triangle of area $1/2$ which has height $m$ and base $1$.
The former region has discrepancy $0$ by (a),
and the latter region obviously has discrepancy at most its area of $m/2$,
hence $f(m,n) \le m/2$ as needed.
(An alternative slower approach, which requires a few cases,
is to prove that two adjacent columns have at most discrepancy $1/2$.)

For (c), we prove:

For each $k \ge 1$, we have
$ f(2k, 2k+1) = \frac{2k-1}{6}. $

An illustration for $k=2$ is shown below,
where we use $(0,0)$, $(0,2k)$, $(2k+1,0)$ as the three vertices.
[Figure omitted]
WLOG, the upper-left square is black, as above.
The $2k$ small white triangles just below the diagonal have area sum
$ \frac12 \cdot \frac{1}{2k+1} \cdot \frac{1}{2k}
[ 1^2 + 2^2 + \dots + (2k)^2 ] = \frac{4k+1}{12} $
The area of the $2k$ black polygons sums just below the diagonal to
$ \sum_{i=1}^{2k} ( 1
- \frac12 \cdot \frac{1}{2k+1} \cdot \frac{1}{2k} \cdot i^2 )
= 2k - \frac{4k+1}{12} = \frac{20k-1}{12}. $
Finally, in the remaining $1+2+\dots+2k$ squares,
there are $k$ more white squares than black squares.
So, it follows
$ f(2k, 2k+1)
= \left| -k + \frac{20k-1}{12} - \frac{4k+1}{12} \right|
= \frac{2k-1}{6}. $


Let $ABC$ be a triangle with $\angle A < \min(\angle B, \angle C)$.
The points $B$ and $C$ divide the circumcircle of the triangle into two arcs.
Let $U$ be an interior point of the arc between $B$ and $C$ which does not contain $A$.
The perpendicular bisectors of $ AB$ and $ AC$ meet the line $AU$ at $V$ and $W$, respectively.
The lines $BV$ and $CW$ meet at $T$.

Show that $AU = TB + TC$.

Solution:
Let $BTV$ meet the circle again at $U_1$,
so that $AU_1 UB$ is an isosceles trapezoid.
Define $U_2$ similarly.

[Figure omitted]
Now from the isosceles trapezoids we get
$ AU = BU_1 = BT + TU_1 = BT + TC $
as desired.


Let $x_1$, $x_2$, \dots, $x_n$ be real numbers satisfying the conditions:

|x_1 + x_2 + \dots + x_n| &= 1 \\
|x_i| &\le \frac{n+1}{2} \qquad \text{for } i= 1,2, \dots, n

Show that there exists a permutation $y_1$, $y_2$, \dots, $y_n$
of $x_1$, $x_2$, \dots, $x_n$ such that
$ | y_1 + 2 y_2 + \dotsb + n y_n | \leq \frac {n + 1}{2}. $

Solution:
WLOG $\sum x_i = 1$ (by negating $x_i$) and $x_1 \le x_2 \le \dots \le x_n$.
Notice that

The largest possible value of the sum in question is
$ A = x_1 + 2x_2 + 3x_3 + \dots + nx_n. $
while the smallest value is
$ B = nx_1 + (n-1)x_2 + \dots + x_n. $
Meanwhile, the average value across all permutations is
$ 1 \cdot \frac1n + 2 \cdot \frac1n + \dots + n \cdot \frac1n = \frac{n+1}{2}. $

Now imagine we transform the sum $A$ to the sum $B$,
one step at a time, by swapping adjacent elements.
Every time we do a swap of two neighboring $u \le v$, the sum decreases by
$ (iu + (i+1)v) - (iv + (i+1)u) = v-u \le n+1. $

We want to prove we land in the interval
$ I = [ -\frac{n+1}{2}, \frac{n+1}{2} ] $
at some point during this transformation.
But since $B \le \frac{n+1}{2} \le A$ (since $\frac{n+1}{2}$ was the average)
and our step sizes were at most the length of the interval $I$,
this is clear.


An $n \times n$ matrix whose entries come
from the set $S = \{1, 2, \dots , 2n - 1\}$
is called a silver matrix if,
for each $i = 1, 2, \dots , n$,
the $i$-th row and the $i$-th column together
contain all elements of $S$. Show that:
[(a)]
there is no silver matrix for $n = 1997$;
silver matrices exist for infinitely many values of $n$.

Solution:
Solution to (a).:
Define a cross to be the union of the $i$th row and $i$th column.
Every cell of the matrix not on the diagonal is contained in exactly two crosses,
while each cell on the diagonal is contained in one cross.

On the other hand, if a silver matrix existed for $n=1997$,
then each element of $S$ appears in all $1997$ crosses.
Since $1997$ is odd, each number $s \in S$ must appear on the diagonal an odd number of times.
(For example, $s$ could appear on the diagonal once and off-diagonal $998$ times,
or on the diagonal three times and off-diagonal $997$ times, etc.)
In particular, each number $s$ appears at least once on the diagonal.

However, $|S| = 3993$ while there are only $1997$ diagonal cells.
This is a contradiction.

Solution to (b).:
We construct a silver matrix $M_e$ for $n = 2^e$ for each $e \ge 1$.
We write the first three explicitly for concreteness:

M_1 &=
1 & 2 \\ 3 & 1
\\
M_2 &=
{1} & {2} & 4 & 5 \\
{3} & {1} & 6 & 7 \\
7 & 5 & {1} & {2} \\
6 & 4 & {3} & {1}
\\
M_3 &=
{1} & {2} & {4} & {5} & 8 & 9 & 11 & 12\\
{3} & {1} & {6} & {7} & 10 & 15 & 13 & 14 \\
{7} & {5} & {1} & {2} & 14 & 12 & 8 & 9 \\
{6} & {4} & {3} & {1} & 13 & 11 & 10 & 15 \\
15 & 9 & 11 & 12 & {1} & {2} & {4}
& {5} \\
10 & 8 & 13 & 14 & {3} & {1} & {6}
& {7} \\
14 & 12 & 15 & 9 & {7} & {5} & {1}
& {2} \\
13 & 11 & 10 & 8 & {6} & {4} & {3}
& {1} \\

The construction is described recursively as follows.
Let
$
M_e' = [
{c|c}
{M_{e-1}} & M_{e-1} + (2^e-1) \\ \hline
M_{e-1} + (2^e-1) & {M_{e-1}} \\

].
$
Then to get from $M_e'$ to $M_e$,
replace half of the $2^e$'s with $2^{e+1}-1$:
in the northeast quadrant, the even-indexed ones,
and in the southwest quadrant, the odd-indexed ones.

In fact, it turns out silver matrices exist for all even dimensions.
A claimed proof is outlined at .


Find all pairs $(a,b)$ of positive integers satisfying
$ a^{b^2} = b^a. $

Solution:
The answer is $(1,1)$, $(16,2)$ and $(27,3)$.

We assume $a,b > 1$ for convenience.
Let $T$ denote the set of non perfect powers other than $1$.

Every integer greater than $1$
is uniquely of the form $t^n$ for some $t \in T$, $n \in \NN$.

Clear.

Let $a = s^m$, $b = t^n$.
$ s^{m \cdot (t^n)^2} = t^{n \cdot s^m}. $
Hence $s = t$ and we have
$ m \cdot t^{2n} = n \cdot t^m
\implies t^{2n-m} = \frac nm. $
Let $n = t^e m$ and $2 \cdot t^e m - m = e$, or
$ e + m = 2t^e \cdot m. $
We resolve this equation by casework

If $e > 0$, then $2t^e \cdot m > 2e \cdot m > e+m$.
If $e=0$ we have $m=n$ and $m = 2m$, contradiction.
If $e = -1$ we apparently have
$ \frac{2}{t} \cdot m = m-1 \implies
m = \frac{t}{t-2} $
so $(t,m) = (3,3)$ or $(t,m) = (4,2)$.
If $e = -2$ we apparently have
$ \frac{2}{t^2} \cdot m = m - 2
\implies m = \frac{2}{1 - 2/t^2} = \frac{2t^2}{t^2-2}. $
This gives $(t,m) = (2,2)$.
If $e \le -3$ then let $k = -e \ge 3$, so the equation is
$ m-k = \frac{2m}{t^k}
\iff m = \frac{k \cdot t^k}{t^k-2}
= k + \frac{2k}{t^k-2}. $
However, for $k \ge 3$ and $t \ge 2$,
we always have $2k \le t^k - 2$,
with equality only when $(t,k) = (2,3)$;
this means $m=4$, which is not a new solution.


For each positive integer $n$,
let $f(n)$ denote the number of ways of representing $n$
as a sum of powers of 2 with nonnegative integer exponents.
Representations which differ only in the ordering
of their summands are considered to be the same.
For instance, $f(4) = 4$,
because the number $4$ can be represented in the following four ways:
$4$; $2+2$; $2+1+1$; $1+1+1+1$.

Prove that for any integer $n \geq 3$
we have $2^{\frac{n^2}{4}} < f(2^n) < 2^{\frac{n^2}2}$.

Solution:
It's clear that $f$ is non-decreasing.
By sorting by the number of $1$'s we used,
we have the equation
$ f(N) =
f( \left\lfloor \frac N2 \right\rfloor )
+ f( \left\lfloor \frac N2 \right\rfloor -1 )
+ f( \left\lfloor \frac N2 \right\rfloor -2 )
+ \dots
+ f(1) + f(0). \quad (\bigstar)
$

Upper bound.:
We now prove the upper bound by induction.
Indeed, the base case is trivial and for the inductive step
we simply use $(\bigstar)$:
$ f(2^n) = f(2^{n-1}) + f(2^{n-1}-1) + \dots
< 2^{n-1} f(2^{n-1})
< 2^{n-1} \cdot 2^{\frac{(n-1)^2}{2}}
= 2^{\frac{n^2}{2} - 1/2}.
$

Lower bound.:
First, we contend that $f$ is convex.
We'll first prove this in the even case
to save ourselves some annoyance:

[$f$ is basically convex]
If $2 \mid a+b$ then
we have $f(2a) + f(2b) \ge 2 f( a+b )$.

Since $f(2k+1) = f(2k)$, we will only prove the first equation.
Assume WLOG $a \ge b$ and use
$(\bigstar)$ on all three $f$ expressions here;
after subtracting repeated terms, the inequality then rewrites as
$ \sum_{(a+b)/2 \le x \le a} f(x)
\ge \sum_{b \le x \le (a+b)/2} f(x). $
This is true since there are an equal number of terms on each side
and $f$ is nondecreasing.

For each $1 \le k < 2^{n-1}$, we have
$ f(2^{n-1} - k) + f(k+1) \ge 2f(2^{n-2}) $

Use the fact that $f(2t+1)=f(2t)$ for all $t$
and then apply convexity as above.

Now we can carry out the induction:
$ f(2^n) = f(2^{n-1}) + f(2^{n-1}-1) + \dots
> 2^{n-1} f(2^{n-2}) + f(0)
> 2^{n-1} 2^{\frac{(n-2)^2}{4}} = 2^{\frac{n^2}{4}}.
$


A convex quadrilateral $ABCD$ has perpendicular diagonals.
The perpendicular bisectors of the sides $AB$ and $CD$ meet
at a unique point $P$ inside $ABCD$.
Prove that the quadrilateral $ABCD$ is cyclic
if and only if triangles $ABP$ and $CDP$ have equal areas.

Solution:
If $ABCD$ is cyclic, then $P$ is the circumcenter,
and $\angle APB + \angle PCD = 180\dg$.
The hard part is the converse.

[Figure omitted]

Let $M$ and $N$ be the midpoints of $AB$ and $CD$.

Unconditionally, we have $∠ NEM = ∠ MPN$.

Note that $EN$ is the median of right triangle $\triangle ECD$, and similarly for $EM$.
Hence $∠ NED = ∠ EDN = ∠ BDC$, while $∠ AEM = ∠ ACB$.
Since $∠ DEA = 90\dg$, by looking at quadrilateral $XDEA$ where $X = CD \cap AB$,
we derive that $∠ NED + ∠ AEM + ∠ DXA = 90\dg$, so
$ ∠ NEM = ∠ NED + ∠ AEM + 90\dg = -∠ DXA = -∠ NXM = -∠ NPM $
as needed.

However, the area condition in the problem tells us
$ \frac{EN}{EM} = \frac{CN}{CM} = \frac{PM}{PN}. $
Finally, we have $\angle MEN > 90\dg$ from the configuration.
These properties uniquely determine the point $E$:
it is the reflection of $P$ across the midpoint of $MN$.

So $EMPN$ is a parallelogram, and thus $ME \perp CD$.
This implies $∠ BAE = ∠ CEM = ∠ EDC$ giving $ABCD$ cyclic.


In a competition, there are $a$ contestants
and $b$ judges, where $b \ge 3$ is an odd integer.
Each judge rates each contestant as either ``pass'' or ``fail''.
Suppose $k$ is a number such that for any two judges,
their ratings coincide for at most $k$ contestants.
Prove that
$ \frac ka \ge \frac{b-1}{2b}. $

Solution:
This is a ``routine'' problem with global ideas.
We count pairs of coinciding ratings,
i.e.\ the number $N$ of tuples
$(\{J_1, J_2\}, C) $
of two distinct judges and a contestant
for which the judges gave the same rating.

On the one hand, if we count by the judges,
we have $ N \le \binom b2 k $
by he problem condition.

However, if we write $b=2m+1$ (so $m \coloneq \frac{b-1}{2}$), then each contestant $C$
contributes at least $\binom{m}{2} + \binom{m+1}{2} = m^2$ to $N$, and so
$ N \ge a \cdot ( \frac{b-1}{2} )^2 $
Putting together the two estimates for $N$ yields the conclusion.


For any positive integer $n$,
let $\tau(n)$ denote the number of its positive divisors (including $1$ and itself).
Determine all positive integers $m$ for which
there exists a positive integer $n$ such that
$ \frac{\tau(n^{2})}{\tau(n)}=m. $

Solution:
The answer is odd integers $m$ only.
If we write $n = p_1^{e_1} \dots p_k^{e_k}$ we get
$ \prod \frac{2e_i+1}{e_i+1} = m. $
It's clear now that $m$ must be odd,
since every fraction has odd numerator.

We now endeavor to construct odd numbers.
The proof is by induction, in which we are curating sets of
fractions of the form $\frac{2e+1}{e+1}$ that multiply
to a given target.

The base cases are easy to verify by hand.
Generally, assume $p = 2^t k - 1$ is odd, where $k$ is odd.
Then we can write
$
\frac{2^{2t}k-2^t(k+1)+1}{2^{2t-1}k-2^{t-1}(k+1)+1}
\cdot
\frac{2^{2t-1}k-2^{t-1}(k+1)+1}{2^{2t-2}k-2^{t-2}(k+1)+1}
\cdot \dots \cdot
\frac{2^{t+1}k-2(k+1)+1}{2^tk-2^0(k+1)+1}.
$
Note that $2^{2t}k-2^t(k+1)+1 = (2^t k - 1)(2^t - 1)$,
and $2^t k - k = k(2^t-1)$, so the above fraction simplifies to
$ \frac{2^t k - 1}{k} $
meaning we just need to multiply by $k$,
which we can do using induction hypothesis.


Determine all pairs $(x,y)$ of positive integers
such that $x^{2}y+x+y$ is divisible by $xy^{2}+y+7$.

Solution:
The answer is $(7k^2,7k)$ for all $k \ge 1$,
as well as $(11,1)$ and $(49,1)$.

We are given $xy^2+y+7 \mid x^2y+x+y$.
Multiplying the right-hand side by $y$ gives
$ xy^2+y+7 \mid x^2y^2+xy+y^2 $
Then subtracting $x$ times the left-hand side gives
$ xy^2+y+7 \mid y^2-7x. $
We consider cases based on the sign of $y^2=7x$.

If $y^2 > 7x$, then $0 < y^2-7x < xy^2+y+7$,
contradiction.
If $y^2=7x$, let $y = 7k$, so $x = 7k^2$.
Plugging this back in to the original equation reads
$ 343k^4 + 7k + 7 \mid 343k^5 + 7k^2 + 7k $
which is always valid, hence these are all solutions.
If $y^2 < 7x$, then $|y^2-7x| \le 7x$,
so $y \in \{1,2\}$.

When $y=1$ we get
$ x+8 \mid x^2+x+1 \iff x+8 \mid 64-8+1=57.$
This has solutions $x=11$ and $x=49$.

When $y=2$

4x+9 \mid 2x^2+x+2 \\
\implies 4x+9 &\mid 16x^2+8x+16 \\
\implies 4x+9 &\mid 81-18+16 = 79

which never occurs.


Let $I$ be the incenter of triangle $ABC$.
Let the incircle of $ABC$ touch
the sides $BC$, $CA$, and $AB$ at $K$, $L$, and $M$, respectively.
The line through $B$ parallel to $MK$ meets the lines
$LM$ and $LK$ at $R$ and $S$, respectively.
Prove that angle $RIS$ is acute.

Solution:
Observe that $\triangle MKL$ is acute with circumcenter $I$.
We now present two proofs.

First simple proof (grobber).:
The problem is equivalent to showing $BI^2 > BR \cdot BS$.
But from
$ \triangle BRK \sim \triangle MKL \sim \triangle BLS $
we conclude
$ BR = t \cdot \frac{MK}{ML},
\qquad BS = t \cdot \frac{ML}{MK} $
where $t = BK = BL$ is the length
of the tangent from $B$.
Hence $BR \cdot BS = t^2$.
Since $BI > t$ is clear, we are done.

Second projective proof.:
Let $N$ be the midpoint of $KL$,
and let ray $MN$ meet the incircle again at $P$.

Note that line $RBS$ is the polar of $N$.
By Brocard's theorem, lines $MK$ and $PL$ should thus
meet the polar of $N$, so we conclude $R = MK \cap PL$.
Analogously, $S = ML \cap PK$.

Again by Brocard's theorem, $\triangle NRS$ is self-polar,
so $N$ is the orthocenter of $\triangle RIS$.
Since $N$ lies between $I$ and $B$ we are done.


Classify all functions $f \colon \NN \to \NN$
satisfying the identity
$ f(n^2 f(m)) = m f(n)^2. $

Solution:
Let $\mathcal P$ be the set of primes,
and let $g \colon \mathcal P \to \mathcal P$ be any involution on them.
Extend $g$ to a completely multiplicative function on $\NN$.
Then $f(n) = d g(n)$ is a solution for any $d \in \NN$
which is fixed by $g$.

It's straightforward to check these all work,
since $g \colon \NN \to \NN$ is an involution on them.
So we prove these are the only functions.

Let $d = f(1)$.

We have $df(n) = f(dn)$ and $d \cdot f(ab) = f(a) f(b)$.

Let $P(m,n)$ denote the assertion in the problem statement.
Off the bat,

$P(1,1)$ implies $f(d) = d^2$.
$P(n,1)$ implies $f(f(n)) = d^2n$.
In particular, $f$ is injective.
$P(1,n)$ implies $f(dn^2) = f(n)^2$.

Then

f(a)^2 f(b)^2 &= f(da^2) f(b)^2 & \text{by third bullet}\\
&= f(b^2 f(f(da^2))) & \text{by problem statement} \\
&= f(b^2 \cdot d^2 \cdot da^2) & \text{by second bullet} \\
&= f(dab)^2 & \text{by third bullet} \\
\implies f(a) f(b) &= f(dab).

This implies the first claim by taking $(a,b) = (1,n)$.
Then $df(a) = f(da)$, and so we actually have
$f(a) f(b) = d f(ab)$.

All values of $f$ are divisible by $d$.

We have

f(n^2) &= \frac 1d f(n)^2 \\
f(n^3) &= \frac{f(n^2) f(n)}{d} = \frac{f(n)^3}{d^2} \\
f(n^4) &= \frac{f(n^3) f(n)}{d} = \frac{f(n)^4}{d^3}

and so on,
which implies the result.

Then, define $g(n) = f(n) / d$.
We conclude that $g$ is completely multiplicative, with $g(1) = 1$.
However, $f(f(n)) = d^2n$ also implies $g(g(n)) = n$,
i.e.\ $g$ is an involution.
Moreover, since $f(d) = d^2$, $g(d) = d$.

All that remains is to check that $g$ must map primes to primes
to finish the description in the problem.
This is immediate; since $g$ is multiplicative and $g(1) = 1$,
if $g(g(p)) = p$ then $g(p)$ can have at most one prime factor,
hence $g(p)$ is itself prime.

The IMO problem actually asked for the least value of $f(1998)$.
But for instruction purposes,
it is probably better to just find all $f$.
Since $1998 = 2 \cdot 3^3 \cdot 37$,
this answer is $2^3 \cdot 3 \cdot 5 = 120$, anyways.


A set $S$ of points from the space will be called
completely symmetric if it has at least three elements
and fulfills the condition that for every two distinct points $A$ and $B$ from $S$,
the perpendicular bisector plane of the segment $AB$ is a plane of symmetry for $S$.
Prove that if a completely symmetric set is finite,
then it consists of the vertices of either a regular polygon,
or a regular tetrahedron or a regular octahedron.

Solution:
Let $G$ be the centroid of $S$.

All points of $S$ lie on a sphere $\Gamma$ centered at $G$.

Each perpendicular bisector plane passes through $G$.
So if $A,B \in S$ it follows $GA = GB$.

Consider any plane passing through three or more points of $S$.
The points of $S$ in the plane form a regular polygon.

The cross section is a circle because we are intersecting a plane with sphere $\Gamma$.
Now if $A$, $B$, $C$ are three adjacent points on this circle,
by taking the perpendicular bisector we have $AB=BC$.

If the points of $S$ all lie in a plane, we are done.
Otherwise, the points of $S$ determine a polyhedron $\Pi$ inscribed in $\Gamma$.
All of the faces of $\Pi$ are evidently regular polygons,
of the same side length $s$.

Every face of $\Pi$ is an equilateral triangle.

Suppose on the contrary some face $A_1 A_2 \dots A_n$ has $n > 3$.
Let $B$ be any vertex adjacent to $A_1$ in $\Pi$ other than $A_2$ or $A_n$.
Consider the plane determined by $\triangle A_1 A_3 B$.
This is supposed to be a regular polygon, but arc $A_1 A_3$ is longer than arc $A_1 B$,
and by construction there are no points inside these arcs.
This is a contradiction.

Hence, $\Pi$ has faces all congruent equilateral triangles.
This implies it is a regular polyhedron --- either
a regular tetrahedron, regular octahedron, or regular icosahedron.
We can check the regular icosahedron fails by
taking two antipodal points as our counterexample.
This finishes the problem.


Find the least constant $C$ such that for any integer $n > 1$ the inequality
$\sum_{1 \le i < j \le n} x_i x_j (x_i^2 + x_j^2)
\le C ( \sum_{1 \le i \le n} x_i )^4$
holds for all real numbers $x_1, \dots, x_n \ge 0$.
Determine the cases of equality.

Solution:
Answer: $C = \frac 18$, with equality when two $x_i$ are equal
and the remaining $x_i$ are equal to zero.

We present two proofs of the bound.

First solution by smoothing.:
Fix $\sum x_i = 1$.
The sum on the left-hand side can be interpreted as
$\sum_{i=1}^n x_i^3 \sum_{j \neq i} x_j = \sum_{i=1}^n x_i^3(1-x_i)$,
so we may rewrite the inequality as:
Then it becomes $ \sum_i (x_i^3 - x_i^4) \le C. $

[Smoothing]
Let $f(x) = x^3 - x^4$.
If $u + v \le \frac 34$, then $f(u) + f(v) \le f(0) + f(u+v)$.

Note that

(u^3-u^4)+(v^3-v^4) &\le (u+v)^3-(u+v)^4 \\
\iff uv(4u^2+4v^2+6uv) &\le 3uv(u+v)

If $u+v\le \frac 34$ this is obvious as $4u^2+4v^2+6uv \le 4(u+v)^2$.

Observe that if three nonnegative reals have pairwise sums
exceeding $\frac34$ then they have sum at least $\frac 98$.
Hence we can smooth until $n-2$ of the terms are zero.
Hence it follows
$ C = \max_{a+b=1} (a^3+b^3-a^4-b^4) $
which is routine computation giving $C = \frac18$.

Second solution by AM-GM (Nairit Sarkar).:
Write

\text{LHS}
&\le ( \sum_{1 \le k \le n} x_k^2 )
( \sum_{1 \le i < j \le n} x_i x_j )
= 1/2 ( \sum_{1 \le k \le n} x_k^2 )
( \sum_{1 \le i < j \le n} 2 x_i x_j ) \\
&\le 1/2 ( \frac{\sum_k x_k^2 + 2 \sum_{i<j} x_i x_j}{2} )^2
= \frac 18 ( \sum_{1 \le i < n} x_i )^4

as desired.


Let $n$ be an even positive integer.
Find the minimal number of cells on the $n \times n$ board
that must be marked so that any cell
(marked or not marked) has a marked neighboring cell.

Solution:
For every marked cell, consider the marked cell adjacent
to it; in this way we have a domino of two cells.
For each domino, its aura consists of all the cells
which are adjacent to a cell of the domino.
There are up to eight squares in each aura,
but some auras could be cut off by the boundary of the board,
which means that there could be as few as five squares.

We will prove that $1/2 n (n+2)$
is the minimum number of auras
needed to cover the board
(the auras need not be disjoint).

A construction is shown on the left below,
showing that $1/2 n (n+2)$.
Color the board as shown to the right into ``rings''.
Every aura takes covers exactly (!) four blue cells.
Since there are $2n(n+2)$ blue cells, this implies the lower bound.

[Figure omitted]

Note that this proves that a partition into disjoint auras
actually always has exactly $1/2 n (n+2)$ auras,
thus also implying EGMO 2019/2.


Find all pairs of positive integers $(x,p)$
such that $p$ is a prime and $x^{p-1}$ is a divisor of $(p-1)^{x}+1$.

Solution:
If $p = 2$ then $x \in \{1,2\}$,
and if $p = 3$ then $x \in \{1,3\}$, since this is IMO 1990/3.
Also, $x = 1$ gives a solution for any prime $p$.
We show that there are no other solutions.

Assume $x > 1$ and let $q$ be smallest prime divisor of $x$.
We have $q > 2$ since $(p-1)^x+1$ is odd.
Then
$ (p-1)^x \equiv -1 \pmod q \implies (p-1)^{2x} \equiv 1 \pmod q $
so the order of $p-1 \bmod q$ is even and divides $\gcd(q-1,2x) \le 2$.
This means that
$ p-1 \equiv -1 \pmod q \implies p = q. $

In other words $p \mid x$ and we get $x^{p-1} \mid (p-1)^{x}+1$.
By exponent lifting lemma, we now have
$ 0 < (p-1) \nu_{p}(x) \le 1 + \nu_p(x). $
This forces $p=3$,
which we already addressed.


Two circles $\Omega_{1}$ and $\Omega_{2}$ touch internally the circle
$\Omega$ in $M$ and $N$ and the center of $\Omega_{2}$ is on $\Omega_{1}$.
The common chord of the circles $\Omega_{1}$ and $\Omega_{2}$
intersects $\Omega$ in $A$ and $B$
Lines $MA$ and $MB$ intersects $\Omega_{1}$ in $C$ and $D$.
Prove that $\Omega_{2}$ is tangent to $CD$.

Solution:
Let $P$ and $Q$ be the centers of $\Omega_1$ and $\Omega_2$.

Let line $MQ$ meet $\Omega_1$ again at $W$,
the homothetic image of $Q$ under $\Omega_1 \to \Omega$.

Meanwhile, let $T$ be the intersection of segment $PQ$
with $\Omega_2$, and let $L$ be its homothetic image on $\Omega$.
Since $PTQ \perp AB$, it follows $LW$ is a diameter of $\Omega$.
Let $O$ be its center.

[Figure omitted]

$MNTQ$ is cyclic.

By Reim: $∠ TQM = ∠ LWM = ∠ LNM = ∠ TNM$.

Let $E$ be the midpoint of $AB$.

$OEMN$ is cyclic.

By radical axis, the lines $MM$, $NN$, $AEB$ meet at a point $R$.
Then $OEMN$ is on the circle with diameter $OR$.

$MTE$ are collinear.

$∠ NMT = ∠ TQN = ∠ LON = ∠ NOE = ∠ NME$.

Now consider the homothety mapping $\triangle WAB$ to $\triangle QCD$.
It should map $E$ to a point on line $ME$
which is also on the line through $Q$ perpendicular to $AB$; that is, to point $T$.
Hence $TCD$ are collinear, and it's immediate that $T$ is the desired tangency point.


Find all the functions $f \colon \RR \to \RR$ such that
$f(x-f(y))=f(f(y))+xf(y)+f(x)-1$
for all $x,y \in \RR$.

Solution:
The answer is $f(x) = -1/2 x^2+1$
which obviously works.

For the other direction, first note that
$ P(f(y),y) \implies 2f(f(y)) + f(y)^2 - 1 = f(0). $
We introduce the notation $c = \frac{f(0)-1}{2}$,
and $S = \opname{img} f$.
Then the above assertion says
$ f(s) = -1/2 s^2 + (c + 1). $
Thus, the given functional equation can be rewritten as
$ Q(x,s) : f(x-s)=-1/2 s^2 + sx + f(x) - c. $

[Main claim]
We can find a function $g \colon \RR \to \RR$ such that
$ f(x-z) = zx + f(x) + g(z). \qquad (\spadesuit). $

If $z \neq 0$,
the idea is to fix a nonzero value $s_0 \in S$ (it exists)
and then choose $x_0$ such that $- 1/2 s_0^2 + s_0 x_0 - c = z$.
Then, $Q(x_0, s)$ gives an pair $(u,v)$ with $u-v = z$.

But now for any $x$, using $Q(x+v,u)$ and $Q(x,-v)$ gives

f(x-z)-f(x) &= f(x-u+v)-f(x)
= f(x+v)-f(x) + u(x+v) - 1/2 u^2 + c \\
&= -vx-1/2 s^2-c + u(x+v) - 1/2 u^2 + c \\
&= -vx-1/2 v^2 + u(x+v) - 1/2 u^2 = zx + g(z)

where $g(z) = -1/2(u^2+v^2)$ depends only on $z$.

Now, let
$ h(x) \coloneq 1/2 x^2 + f(x) - (2c+1), $
so $h(0) = 0$.

The function $h$ is additive.

We just need to rewrite $(\spadesuit)$.
Letting $x=z$ in $(\spadesuit)$,
we find that actually $g(x)=f(0)-x^2-f(x)$.
Using the definition of $h$ now gives
$ h(x-z) = h(x) + h(z). \qedhere $

To finish, we need to remember that $f$, hence $h$, is known
on the image
$ S = \left\{ f(x) \mid x \in \RR \right\}
= \left\{ h(x) - 1/2 x^2 + (2c+1) \mid x \in \RR \right\}. $
Thus, we derive
$ h( h(x)-1/2 x^2+(2c+1) ) = -c
\qquad \forall x \in \RR. \qquad(\heartsuit) $
We can take the following two instances of $\heartsuit$:

h( h(2x)-2x^2+(2c+1) ) &= -c \\
h( 2h(x)-x^2+2(2c+1) ) &= -2c.

Now subtracting these and using $2h(x)=h(2x)$ gives
$ c = h( -x^2 - (2c+1) ). $
Together with $h$ additive, this implies readily $h$ is constant.
That means $c=0$ and the problem is solved.


Two circles $G_1$ and $G_2$ intersect at two points $M$ and $N$.
Let $AB$ be the line tangent to these circles at $A$ and $B$,
respectively, so that $M$ lies closer to $AB$ than $N$.
Let $CD$ be the line parallel to $AB$
and passing through the point $M$,
with $C$ on $G_1$ and $D$ on $G_2$.
Lines $AC$ and $BD$ meet at $E$; lines $AN$ and $CD$ meet at $P$;
lines $BN$ and $CD$ meet at $Q$.
Show that $EP = EQ$.

Solution:
First, we have $∠ EAB = ∠ ACM = ∠ BAM$
and similarly $∠ EBA = ∠ BDM = ∠ ABM$.
Consequently, $AB$ bisects $\angle EAM$ and $\angle EBM$,
and hence $\triangle EAB \cong \triangle MAB$.

[Figure omitted]

Now it is well-known that $MN$ bisects $AB$
and since $AB \parallel PQ$
we deduce that $M$ is the midpoint of $PQ$.
As $AB$ is the perpendicular bisector of $EM$,
it follows that $EP = EQ$ as well.


Let $a$, $b$, $c$ be positive real numbers with $abc = 1$.
Show that
$
( a - 1 + \frac 1b )
( b - 1 + \frac 1c )
( c - 1 + \frac 1a )
\le 1.
$

Solution:
Let $a = x/y$, $b = y/z$, $c = z/x$ for $x,y,z > 0$.
Then the inequality rewrites as
$ (-x+y+z)(x-y+z)(x+y-z) \le xyz $
which when expanded is equivalent to Schur's inequality.
Alternatively, if one wants to avoid appealing to Schur,
then the following argument works:

At most one term on the left-hand side is negative;
if that occurs we are done from $xyz > 0 > (-x+y+z)(x-y+z)(x+y-z)$.
If all terms in the left-hand side are nonnegative,
let us denote $m = -x+y+z \ge 0$, $n = x-y+z \ge 0$, $p = x+y-z \ge 0$.
Then it becomes
$ mnp \le \frac{(m+n)(n+p)(p+m)}{8} $
which follows by AM-GM.


Let $n \ge 2$ be a positive integer
and $\lambda$ a positive real number.
Initially there are $n$ fleas on a horizontal line,
not all at the same point.
We define a move as choosing two fleas at some points $A$ and $B$,
with $A$ to the left of $B$,
and letting the flea from $A$ jump over the flea from $B$ to the point $C$
so that $\frac{BC}{AB} = \lambda$.

Determine all values of $ \lambda$ such that,
for any point $M$ on the line
and for any initial position of the $n$ fleas,
there exists a sequence of moves that will take
them all to the position right of $M$.

Solution:
The answer is $\lambda \ge \frac{1}{n-1}$.

We change the problem by replacing the fleas
with \textbf{bowling balls} $B_1$, $B_2$, \dots, $B_n$ in that order.
Bowling balls aren't exactly great at jumping,
so each move can now be described as follows:

Select two indices $i < j$.
Then ball $B_i$ moves to $B_{i+1}$'s location,
$B_{i+1}$ moves to $B_{i+2}$'s location, and so on;
until $B_{j-1}$ moves to $B_j$'s location,
Finally, $B_j$ moves some distance forward;
the distance is at most $\lambda \cdot |B_j B_i|$
and $B_j$ may not pass $B_{j+1}$.

If $\lambda < \frac{1}{n-1}$
the bowling balls have bounded movement.

Let $a_i \ge 0$ denote the initial distance
between $B_i$ and $B_{i+1}$,
and let $\Delta_i$ denote the distance travelled by ball $i$.
Of course we have
$\Delta_1 \le a_1 + \Delta_2$,
$\Delta_2 \le a_2 + \Delta_3$,
\dots,
$\Delta_{n-1} \le a_{n-1} + \Delta_n$
by the relative ordering of the bowling balls.
Finally, distance covered by $B_n$ is always
$\lambda$ times distance travelled by other bowling balls, so

\Delta_n &\le \lambda \sum_{i=1}^{n-1} \Delta_i
\le \lambda \sum_{i=1}^{n-1}
( ( a_i + a_{i+1} + \dots + a_{n-1} )
+ \Delta_n ) \\
&= (n-1)\lambda \cdot \Delta_n + \sum_{i=1}^{n-1} i a_i

and since $(n-1)\lambda > 1$, this gives an upper bound.

Equivalently, you can phrase the proof without
bowling balls as follows:
if $x_1 < \dots < x_n$ are the positions of the fleas,
the quantity
$ L = x_n - \lambda(x_1 + \dots + x_{n-1}) $
is a monovariant which never increases;
i.e.\ $L$ is bounded above.
Since $L > (1-(n-1)\lambda) x_n$, it follows
$\lambda < \frac{1}{n-1}$ is enough to stop the fleas.

When $\lambda \ge \frac{1}{n-1}$,
it suffices to always jump the leftmost flea
over the rightmost flea.

If we let $x_i$ denote the distance travelled by $B_1$
in the $i$th step,
then $x_i = a_i$ for $1 \le i \le n-1$
and $x_i = \lambda(x_{i-1} + x_{i-2} + \dots + x_{i-(n-1)})$.

In particular, if $\lambda \ge \frac{1}{n-1}$
then each $x_i$ is at least the average of the previous $n-1$ terms.
So if the $a_i$ are not all zero,
then $\{x_{n}, \dots, x_{2n-2}\}$ are all positive
and thereafter $x_i \ge \min \left\{ x_n, \dots, x_{2n-2} \right\} > 0$
for every $i \ge 2n-1$.
So the partial sums of $x_i$ are unbounded, as desired.

Other inductive constructions are possible.
Here is the idea of one of them,
although the details are more complicated.

We claim in general that given $n-1$ fleas at $0$
and one flea at $1$,
we can get all the fleas arbitrarily close to
$\frac{1}{1-(n-1)\lambda}$
(or as far as we want if $\lambda > \frac{1}{n-1}$.).
The proof is induction by $n \ge 2$;
for $n=2$ we get a geometric series.
For $n \ge 3$, we leave one flea at zero
and move the remainder close to $\frac{1}{1-(n-2)\lambda}$,
then jump the last flea to
$\frac{1+\lambda}{1-(n-2)\lambda}$.

Now we're in the same situation,
except we shifted $\frac{1}{1-(n-2)\lambda}$ right
and have then scaled everything by
$r = \frac{\lambda}{1-(n-2)\lambda}$.
If we repeat this process again and check the geometric series,
we see the fleas converge to
$ \frac{1}{1-(n-2)\lambda}
( 1 + r + r^2 + r^3 + \dots )
= \frac{1}{1-(n-2)\lambda} \cdot \frac{1}{1-r}
= \frac{1}{1-(n-1)\lambda}. $


A magician has one hundred cards numbered $1$ to $100$.
He puts them into three boxes, a red one, a white one and a blue one,
so that each box contains at least one card.
A member of the audience draws two cards from two different boxes
and announces the sum of numbers on those cards.
Given this information,
the magician locates the box from which no card has been drawn.

How many ways are there to put the cards
in the three boxes so that the trick works?

Solution:
There are $2 \cdot 3! = 12$ ways, which amount to:

Partitioning the cards modulo $3$, or
Placing $1$ alone in a box,
$100$ alone in a second box,
and all remaining cards in the third box.

These are easily checked to work so we prove they are the only ones.

First solution.:
We proceed by induction on $n \ge 3$ with the base case being immediate.

For the inductive step,
consider a working partition of $\{1, 2, \dots, n\}$.
Then either $n$ is in its own box; or
deleting $n$ gives a working partition of $\{1, 2, \dots, n-1\}$.
Similarly, either $1$ is in its own box; or
deleting $1$ gives a working partition of $\{2, 3, \dots, n\}$,
and we can reduce all numbers by $1$ to get
a working partition of $\{1, 2, \dots, n-1\}$.

Therefore, we only need to consider there cases.

If $1$ and $n$ are both in their own box,
this yields one type of solution we already found.

If $n$ is not in a box by itself,
then by induction hypothesis the cards $1$ through $n-1$
are either arranged mod $3$,
or as $\{1\} \cup \{2,3,\dots,n-2\} \cup \{n-1\}$.

In the former mod $3$ situation,
since $n + (n-3) = (n-1) + (n-2)$,
so $n$ must be in the same box as $n-3$.
In the latter case and for $n > 4$,
since $n + 1 = 2 + (n-1)$,
$n$ must be in the same box as $1$.
But now $n + 2 = (n-1) + 3$ for $n > 4$, contradiction.

The case where $1$ is in a box by itself is analogous.

This exhausts all cases, completing the proof.

Second solution.:
Let $A$, $B$, $C$ be the sets of cards in the three boxes.
Then $A+B$, $B+C$, $C+A$ should be disjoint,
and contained in $\{3, 4, \dots, 199\}$.
On the other hand, we have the following famous fact.

Let $X$ and $Y$ be finite nonempty sets of real numbers.
We have $|X+Y| \ge |X|+|Y|-1$,
with equality if and only if $X$ and $Y$ are arithmetic
progressions with the same common difference,
or one of $X$ and $Y$ is a singleton set.

Putting these two together gives the estimates
$ 197 \ge |A+B| + |B+C| + |C+A|
\ge 2( |A|+|B|+|C| )-3 = 197. $
So all the inequalities must be sharp.
Consequently we conclude that:

Either the sets $A$, $B$, $C$ are disjoint arithmetic progressions
with the same common difference
$d = \min_{x \neq y \text{ in same set}} |x-y|$,
or two of the sets are two singleton.
Moreover, $\{3, 4, \dots, 199\}
= (A+B) \sqcup (B+C) \sqcup (C+A)$.

From here it is not hard to deduce the layouts above are the only ones,
but there are some details.
First, we make the preliminary observation that
$3=1+2$, $4=1+3$, $198=98+100$, $199=99+100$
and these numbers can't be decomposed in other ways;
thus from the remark about the disjoint union:

[Convenient corollary]
The pairs $(1,2)$, $(1,3)$, $(98,100)$, $(99,100)$
are all in different sets.

We now consider the four cases.

If two of the boxes are singletons,
it follows from the corollary that we should have $A = \{1\}$,
$B = \{100\}$ and $C = \{2, \dots, 99\}$, up to permutation.
Otherwise $A$, $B$, $C$ are disjoint arithmetic
progressions with the same common difference $d$.
As two of $\{1,2,3,4\}$ are in the same box
(by pigeonhole), we must have $d \le 3$.

If $d=3$, then no two elements of different residues
modulo $3$ can be in the same box,
so we must be in the first construction claimed earlier.

If $d=2$, then the convenient corollary
tells us we may assume WLOG that $1 \in A$ and $2 \in B$,
hence $3 \in C$
(since $3 \notin A$ by convenient corollary,
and $3 \notin B$ because common difference $2$).
Thus we must have $A = \{1\}$, $B = \{2, 4, \dots, 100\}$
and $C = \{3, 5, \dots 99\}$
which does not work since $1+4 = 2+3$.
Therefore there are no solutions in this case.

If $d=1$, then by convenient corollary
the numbers $1$ and $2$ are in different sets,
as are $99$ and $100$.
So we must have $A = \{1\}$, $B = \{2, \dots, 99\}$, $C = \{100\}$
which we have already seen is valid.


Does there exist a positive integer $n$
such that $n$ has exactly 2000 distinct prime divisors
and $n$ divides $2^n + 1$?

Solution:
Answer: Yes.

We say that $n$ is Korean if $n \mid 2^n+1$.
First, observe that $n=9$ is Korean.
Now, the problem is solved upon the following claim:

If $n > 3$ is Korean,
there exists a prime $p$ not dividing $n$
such that $np$ is Korean too.

I claim that one can take any primitive prime divisor $p$ of $2^{2n}-1$,
which exists by Zsigmondy theorem.
Obviously $p \neq 2$.
Then:

Since $p \nmid 2^{\varphi(n)}-1$ it follows then that $p \nmid n$.
Moreover, $p \mid 2^n+1$ since $p \nmid 2^n-1$.

Hence $np \mid 2^n+1 \mid 2^{np} + 1$ by Chinese Theorem,
since $\gcd(n,p) = 1$.


Let $AH_1$, $BH_2$, and $CH_3$ be the
altitudes of an acute triangle $ABC$.
The incircle $\omega$ of triangle $ABC$ touches the sides
$BC$, $CA$ and $AB$ at $T_1$, $T_2$ and $T_3$, respectively.
Consider the reflections of the lines $H_1H_2$, $H_2H_3$, and
$H_3H_1$ with respect to the lines $T_1T_2$, $T_2T_3$, and $T_3T_1$.
Prove that these images form a triangle whose vertices lie on $\omega$.

Solution:
We use complex numbers with $\omega$ the unit circle.
Let $T_1 = a$, $T_2 = b$, $T_3 = c$.
The main content of the problem is to show that
the triangle in question has vertices
$ab/c$, $bc/a$, $ca/b$
(which is evident from a good diagram).

Since $A = \frac{2bc}{b+c}$, we have
$ H_1 = 1/2 ( \frac{2bc}{b+c} + a + a - a^2 \cdot
\frac{2}{b+c} )
= \frac{ab+bc+ca-a^2}{b+c}. $
The reflection of $H_1$ over $T_1 T_2$ is

H_1^C &= a + b - ab H_1
= a + b - b \cdot \frac{ac+ab+a^2-bc}{a(b+c)} \\
&= \frac{a(a+b)(b+c) - b(a^2+ab+ac-bc)}{a(b+c)}
= \frac{c(a^2+b^2)}{a(b+c)}.

Now, we claim that $H_1^C$ lies on the chord joining
$\frac{ca}{b}$ and $\frac{cb}{a}$;
by symmetry so will $H_2^C$
and this will imply the problem
(it means that the desired triangle has vertices
$ab/c$, $bc/a$, $ca/b$).
A cartoon of this is shown below.
[Figure omitted]
To see this, it suffices to compute

H_1^C + ( \frac{ca}{b} )( \frac{cb}{a} ) H_1^C
&= \frac{c(a^2+b^2)}{a(b+c)}
+ c^2 \frac{\frac 1c \cdot \frac{a^2+b^2}{a^2b^2}}
{\frac1a( \frac{b+c}{bc} )} \\
&= \frac{c(a^2+b^2)}{a(b+c)}
+ \frac{c(a^2+b^2)}{abc\inv(b+c)} \\
&= \frac{c(a^2+b^2)}{a(b+c)} ( \frac{b+c}{b} ) \\
&= \frac{c(a^2+b^2)}{ab}= \frac{ca}{b} + \frac{cb}{a}

as desired.


Let $ABC$ be an acute-angled triangle with $O$ as its circumcenter.
Let $P$ on line $BC$ be the foot of the altitude from $A$.
Assume that $\angle BCA \ge \angle ABC + 30\dg$.
Prove that $\angle CAB + \angle COP < 90\dg$.

Solution:
The conclusion rewrites as

\angle COP &< 90\dg - \angle A = \angle OCP \\
\iff PC &< PO \\
\iff PC^2 &< PO^2 \\
\iff PC^2 &< R^2 - PB \cdot PC \\
\iff PC \cdot BC &< R^2 \\
\iff ab \cos C &< R^2 \\
\iff \sin A \sin B \cos C & < \frac14.

Now
$ \cos C \sin B
= 1/2 ( \sin(C+B)-\sin(C-B) )
\le 1/2 ( 1 - 1/2 ) = \frac 14 $
which finishes when combined with $\sin A < 1$.

If we allow $ABC$ to be right then
equality holds when $\angle A = 90\dg$,
$\angle C = 60\dg$, $\angle B = 30\dg$.
This motivates the choice of estimates
after reducing to a trig inequality.


Let $a$, $b$, $c$ be positive reals. Prove that
$ \frac{a}{\sqrt{a^2+8bc}} + \frac{b}{\sqrt{b^2+8ca}} + \frac{c}{\sqrt{c^2+8ab}} \ge 1. $

Solution:
By Holder, we have
$
( \sum_{\text{cyc}} \frac{a}{\sqrt{a^2+8bc}} )^2
( \sum_{\text{cyc}} a(a^2+8bc) )
\ge (a+b+c)^3.
$
So it suffices to show $(a+b+c)^3 \ge a^3+b^3+c^3+24abc$ which is clear by expanding.


Twenty-one girls and twenty-one boys took part in a mathematical competition.
It turned out that each contestant solved at most six problems,
and for each pair of a girl and a boy,
there was at least one problem that was solved by both the girl and the boy.
Show that there is a problem that was solved by at least three girls and at least three boys.

Solution:
We will show the contrapositive.
That is, assume that

For each pair of a girl and a boy,
there was at least one problem that was
solved by both the girl and the boy.
Assume every problem is either solved
mostly by girls (at most two boys)
or mostly by boys (at most two girls).

Then we will prove that then some contestant
solved more than six problems.

Create a $21 \times 21$ grid with boys as columns
and girls as rows, and in each cell
write the name of a problem solved by the pair.
Color the cell \textbf{green} if at most two girls solved that problem,
and color it \textbf{blue} if at most two boys solved that problem.
(G for girl, B for boy.
It's possible both colors are used for some cell.)

WLOG, there are more green cells than blue,
so (by pigeonhole) take a column (boy) with that property.
That means the boy's column has at least $11$ green squares.
By hypothesis, those corresponds to at least $6$ different problems
solved. Now there are two cases:

If there are any blue-only squares,
then that square means a seventh distinct problems.
If the entire column is green,
then among the $21$ green squares
there are at least $11$ distinct problems solved
in that column.

The number $21$ cannot be decreased.
Here is an example of $20$ boys and $20$ girls
who solve problems named $A$-$J$
and $0$-$9$, which motivates the solution to begin with.
[Figure omitted]

This took me embarrassingly long,
but part of the work of the problem seemed to be
finding the right ``data structure'' to get a foothold.
I think the grid is good because we want to fill each intersection,
then we consider for each cell a problem to put.

I initially wanted to capture the full data by writing
in each green cell the row index of the other girl who solved it,
and similarly for the blue cells.
(That led naturally to the colors, there were two types of cells.)
This was actually helpful for finding the equality case above,
but once I realized the equality case
I also realized that I could discard the extra information
and only remember the colors.


Let $n > 1$ be an odd integer and let $c_1$, $c_2$, \dots, $c_n$ be integers.
For each permutation $a = (a_1, a_2, \dots, a_n)$
of $\{1,2,\dots,n\}$, define $S(a) = \sum_{i=1}^n c_i a_i$.
Prove that there exist two permutations $a \neq b$
of $\{1,2,\dots,n\}$ such that $n!$ is a divisor of $S(a)-S(b)$.

Solution:
Assume for contradiction that all the $S(a)$ are distinct modulo $n!$.
Then summing across all permutations gives

1 + 2 + \dots + n!
&\equiv \sum_a S(a) \\
&= \sum_a \sum_{i=1}^n c_i a_i \\
&= \sum_{i=1}^n c_i \sum_a a_i \\
&= \sum_{i=1}^n c_i \cdot ( (n-1)! \cdot (1+\dots+n) ) \\
&= (n-1)! \cdot \frac{n(n+1)}{2} \sum_{i=1}^n c_i \\
&= n! \cdot \frac{n+1}{2} \sum_{i=1}^n c_i \\
&\equiv 0

since $1/2(n+1)$ is an integer.
But on the other hand
$1 + 2 + \dots + n! = \frac{n!(n!+1)}{2}$
which is not divisible by $n!$ if $n > 1$,
as the quotient is the non-integer $\frac{n!+1}{2}$.
This is a contradiction.


Let $ABC$ be a triangle.
Let $AP$ bisect $\angle BAC$ and let $BQ$ bisect $\angle ABC$,
with $P$ on $BC$ and $Q$ on $AC$.
If $AB + BP = AQ + QB$ and $\angle BAC = 60\dg$,
what are the angles of the triangle?

Solution:
The answer is $\angle B = 80\dg$ and $\angle C = 40\dg$.
Set $x = \angle ABQ = \angle QBC$, so that $\angle QCB = 120\dg - 2x$.
We observe $\angle AQB = 120\dg - x$ and $\angle APB = 150\dg - 2x$.

[Figure omitted]

Now by the law of sines, we may compute

BP &= AB \cdot \frac{\sin 30\dg}{\sin (150\dg- 2x)} \\
AQ &= AB \cdot \frac{\sin x}{\sin (120\dg- x)} \\
QB &= AB \cdot \frac{\sin 60\dg}{\sin (120\dg- x)}.

So, the relation $AB + BP = AQ + QB$ is exactly
$ 1 + \frac{\sin 30\dg}{\sin (150\dg - 2x)}
= \frac{\sin x + \sin 60\dg}{\sin (120\dg - x)}. $
This is now a trig problem, and we simply solve for $x$.
There are many possible approaches
and we just present one.

First of all, we can write
$ \sin x + \sin 60\dg
= 2\sin ( 1/2 (x+60\dg) )
\cos ( 1/2 (x-60\dg) ). $
On the other hand, $\sin (120\dg - x) = \sin(x+60\dg)$ and
$ \sin (x+60\dg)
= 2 \sin ( 1/2 (x+60\dg) )
\cos ( 1/2(x+60\dg) ) $
so
$ \frac{\sin x + \sin 60\dg}{\sin (120\dg - x)}
= \frac{\cos ( 1/2 x - 30\dg )}
{\cos ( 1/2 x + 30\dg )}. $
Let $y = 1/2 x$ for brevity now. Then

\frac{\cos(y-30\dg)}{\cos(y+30\dg)} - 1
&= \frac{\cos(y-30\dg)-\cos(y+30\dg)}{\cos(y+30\dg)} \\
&= \frac{2 \sin (30\dg) \sin y}{\cos(y+30\dg)} \\
&= \frac{\sin y}{\cos (y+30\dg)}.

Hence the problem is just

\frac{\sin 30\dg}{\sin(150\dg - 4y)} &= \frac{\sin y}{\cos(y+30\dg)}. \\
\intertext{Equivalently,}
\cos(y+30\dg) &= 2\sin y \sin (150\dg -4y) \\
&= \cos(5y-150\dg) - \cos(150\dg-3y) \\
&= -\cos(5y+30\dg) + \cos(3y+30\dg).

Now we are home free, because $3y+30\dg$
is the average of $y+30\dg$ and $5y+30\dg$.
That means we can write
$ \frac{\cos(y+30\dg)+\cos(5y+30\dg)}{2} = \cos(3y+30\dg) \cos(2y). $
Hence
$ \cos(3y+30\dg) ( 2\cos(2y)-1 ) = 0. $
Recall that
$ y = 1/2 x = \frac 14 \angle B
< \frac 14 ( 180\dg - \angle A ) = 30\dg. $
Hence it is not possible that $\cos(2y) = 1/2$,
since the smallest positive value of $y$
that satisfies this is $y=30\dg$.
So $\cos (3y+30\dg) = 0$.

The only permissible value of $y$ is then $y = 20\dg$,
giving $\angle B = 80\dg$ and $\angle C = 40\dg$.


Let $a > b > c > d > 0$ be integers satisfying
$ ac + bd = (b+d+a-c)(b+d-a+c). $
Prove that $ab + cd$ is not prime.

Solution:
The problem condition is equivalent to
$ ac + bd = (b+d)^2 - (a-c)^2 $
or
$ a^2-ac+c^2 = b^2+bd+d^2. $

Let us construct a quadrilateral $WXYZ$ such that
$WX = a$, $XY = c$, $YZ = b$, $ZW = d$,
and $ WY = \sqrt{a^2-ac+c^2} = \sqrt{b^2+bd+d^2}.$
Then by the law of cosines, we obtain $\angle WXY = 60\dg$
and $\angle WZY = 120\dg$.
Hence this quadrilateral is cyclic.

[Figure omitted]

By the more precise version of Ptolemy's theorem,
we find that
$ WY^2 = \frac{(ab+cd)(ad+bc)}{ac+bd}. $

Now assume for contradiction that that $ab+cd$ is a prime $p$.
Recall that we assumed $a > b > c > d$.
It follows, for example by rearrangement inequality, that
$ p = ab+cd > ac+bd > ad+bc. $
Let $y = ac+bd$ and $x = ad+bc$ now.
The point is that $ p \cdot \frac xy $
can never be an integer if $p$ is prime and $x < y < p$.
But $WY^2 = a^2-ac+c^2$ is clearly an integer, and this is a contradiction.

Hence $ab+cd$ cannot be prime.

It may be tempting to try to apply the more typical form of
Ptolemy to get $ab+cd = WY \cdot XZ$;
the issue with this approach is that $WY$ and $XZ$ are usually not integers.


Let $n$ be a positive integer.
Let $T$ be the set of points $(x,y)$ in the plane
where $x$ and $y$ are non-negative integers with $x+y<n$.
Each point of $T$ is coloured red or blue, subject to the following condition:
if a point $(x,y)$ is red,
then so are all points $(x',y')$ of $T$ with $x'\leq x$ and $y'\leq y$.
Let $A$ be the number of ways to choose $n$ blue points with distinct $x$-coordinates,
and let $B$ be the number of ways to choose $n$ blue points with distinct $y$-coordinates.
Prove that $A=B$.

Solution:
Let $a_x$ denote the number of blue points
with a given $x$-coordinate.
Define $b_y$ to be the number of blue points
with a given $y$-coordinate.

We actually claim that

The multisets $\mathcal A \coloneq \{ a_x \mid x \}$
and $\mathcal B \coloneq \{ b_y \mid y \}$ are equal.

By induction on the number of red points.
If there are no red points at all,
then $\mathcal A = \mathcal B = \{1, \dots, n\}$.
[Figure omitted]
The proof consists of two main steps.
First, suppose we color a single point $P = (x,y)$
from blue to red (while preserving the condition).
Before the coloring, we have $a_x = b_y = n-(x+y)$;
afterwards $a_x = b_y = n-(x+y)-1$
and no other numbers change, as desired.

We also must show that this operation
(repeatedly adding a single point $P$) reaches all
possible shapes of red points.
This is well-known as the red points form a Young tableaux;
for example, one way is to add all the points with $x=0$
first one by one, then all the points with $x=1$, and so on.
So the induction implies the result.

Finally, $ A = \prod_{x=0}^{n-1} a_x = \prod_{y=0}^{n-1} b_y = B. $


Let $BC$ be a diameter of circle $\omega$ with center $O$. Let $A$ be a point
of circle $\omega$ such that $0^\circ < \angle AOB < 120^\circ$. Let $D$ be the midpoint
of arc $AB$ not containing $C$. Line $\ell$ passes through $O$ and is
parallel to line $AD$. Line $\ell$ intersects line $AC$ at $J$.
The perpendicular bisector of segment $OA$ intersects circle $\omega$ at $E$
and $F$. Prove that $J$ is the incenter of triangle $CEF$.

Solution:
By construction, $AEOF$ is a rhombus with $60\dg$-$120\dg$ angles.
Consequently, we may set $s = AO = AE = AF = EO = EF$.
[Figure omitted]

We have $AJ = s$ too.

It suffices to show $AJ = AO$ which is angle chasing.
Let $\theta = \angle BOD = \angle DOA$,
so $\angle BOA = 2\theta$.
Thus $\angle CAO = 1/2 \angle BOA = \theta$.
However $\angle AOJ = \angle OAD = 90\dg - 1/2 \theta$,
as desired.

Then, since $AE = AJ = AF$,
we are done by the infamous Fact 5.


Find all pairs of positive integers $m, n \ge 3$ for which there exist infinitely many
positive integers $a$ such that
$ \frac{a^m+a-1}{a^n+a^2-1} $
is itself an integer.

Solution:
The condition is equivalent to $a^n+a^2-1$
dividing $a^m+a-1$ as polynomials.
The big step is the following analytic one.

We must have $m \le 2n$.

Assume on contrary $m > 2n$
and let $0 < r < 1$ be the unique real number
with $r^n+r^2 = 1$, hence $r^m+r = 1$.
But now

0 &= r^m + r - 1 \le r^{2n+1} + r - 1 \\
&= r( (1-r^2)^2+1 ) - 1 \\
&= -(1-r)( r^4+r^3-r^2-r+1 ) \\
&= -(1-r)( r^4 + (1-r)(1-r^2) ).

Hewer, $1-r > 0$ and $r^4 + (1-r)(1-r^2) > 0$ are both obvious for $0 < r < 1$.
So this is a contradiction.

Now for the algebraic part.
Obviously $m > n$.

a^n+a^2-1 &\mid a^m+a-1 \\
\iff a^n+a^2-1 &\mid (a^m+a-1)(a+1) = a^m(a+1) + (a^2-1) \\
\iff a^n+a^2-1 &\mid a^m(a+1) - a^n \\
\iff a^n+a^2-1 &\mid a^{m-n}(a+1) - 1.

The right-hand side has degree $m-n+1 \le n+1$,
and the leading coefficients are both $+1$.
So the only possible situations are

a^{m-n}(a+1) - 1 &= (a+1)( a^n+a^2-1 ) \\
a^{m-n}(a+1) + 1 &= a^n+a^2-1.

The former fails by just taking $a=-1$;
the latter implies $(m,n) = (5,3)$.
As our work was reversible, this also implies $(m,n) = (5,3)$ works, done.


Let $n \ge 2$ be a positive integer
with divisors $1 = d_1 < d_2 < \dots < d_k = n$.
Prove that $d_1d_2 + d_2d_3 + \dots + d_{k-1} d_k$ is always less than $n^2$,
and determine when it is a divisor of $n^2$.

Solution:
We always have

d_k d_{k-1} + d_{k-1} d_{k-2} + \dots + d_2 d_1
&< n \cdot \frac n2 + \frac n2 \cdot \frac n3 + \dots \\
&= ( \frac{1}{1 \cdot 2} + \frac{1}{2 \cdot 3} + \dots ) n^2 = n^2.

This proves the first part.

For the second, we claim that this only happens
when $n$ is prime (in which case we get $d_1 d_2 = n$).
Assume $n$ is not prime (equivalently $k \ge 2$)
and let $p$ be the smallest prime dividing $n$.
Then
$ d_k d_{k-1} + d_{k-1} d_{k-2} + \dots + d_2 d_1
> d_k d_{k-1} = \frac{n^2}{p} $
exceeds the largest proper divisor of $n^2$,
but is less than $n^2$, so does not divide $n^2$.


Find all functions $f \colon \RR \to \RR$ such that
$ (f(x)+f(z))(f(y)+f(t))
= f(xy-zt)+f(xt+yz) $
for all real numbers $x$, $y$, $z$, $t$.

Solution:
The answer is $f(x) \equiv 0$, $f(x) \equiv 1/2$
and $f(x) \equiv x^2$ which are easily seen to work.
Let's prove they are the only ones;
we show two solutions.

First solution (multiplicativity).:
Let $P(x,y,z,t)$ denote the given statement.

By comparing $P(x,1,0,0)$ and $P(0,0,1,x)$
we get $\boxed{f \text{ even}}$.
By $P(0,y,0,t)$ we get for nonconstant $f$
that $f(0) = 0$.
If $f$ is constant we get the solutions earlier,
so in the sequel assume $\boxed{f(0) = 0}$.
By $P(x,y,0,0)$ we get $\boxed{f(xy) = f(x) f(y)}$.
Note in particular that for any real number $x$ we now have
$ f(x) = f(|x|) = f( \sqrt{|x|} )^2 \ge 0 $
that is, $f \ge 0$.

From $P(x,y,y,x)$ we now have
$ f(x^2 + y^2) = ( f(x) + f(y) )^2
= f(x^2) + 2f(x)f(y) + f(y^2) \ge f(x^2) $
so $f$ is weakly increasing.
Combined with $f$ multiplicative and nonconstant,
this implies $f(x) = |x|^r$ for some real number $r$.

Finally, $P(1,1,1,1)$ gives $f(2) = 4f(1)$,
so $f(x) \equiv x^2$.

Second solution (ELMO).:
Let $P(x,y,z,t)$ denote the statement.
Assume $f$ is nonconstant,
as before we derive that $f$ is even, $f(0) = 0$,
and $f(x) \ge 0$ for all $x$.

Now comparing $P(x,y,z,t)$ and $P(z,y,x,t)$ we obtain
$ f(xy-zt) + f(xt+yz) =
( f(x)+f(z) )
( f(y)+f(t) )
= f(xy+zt) + f(xt-yz) $
which in particular implies that
$ f(a-d) + f(b+c) = f(a+d) + f(b-c)
\qquad \text{ if } ad=bc \text{ and } a,b,c,d > 0. $
Thus the restriction of $f$ to $(0,\infty)$ satisfies
\textbf{ELMO 2011, problem 4}
which implies that $f(x) = kx^2+\ell$ for constants $k$ and $\ell$.
From here we recover the original.

(Minor note: technically ELMO 2011/4 is $f \colon (0,\infty) \to (0,\infty)$
but we only have $f \ge 0$,
however the proof for the ELMO problem
works as long as $f$ is bounded below;
we could also just apply the ELMO problem to $f+0.01$ instead.)


Let $n \ge 3$ be a positive integer.
Let $C_1$, $C_2$, \dots, $C_n$ be unit circles in the plane,
with centers $O_1$, $O_2$, \dots, $O_n$ respectively.
If no line meets more than two of the circles, prove that
$ \sum_{1 \le i < j \le n } \frac{1}{O_i O_j}
\le \frac{(n-1)\pi}{4}. $

Solution:
For brevity, let $d_{ij}$ be the length of $O_{ij}$
and let $\angle(ijk)$ be shorthand for $\angle O_i O_j O_k$
(or its measure in radians).

First, we eliminate the circles completely
and reduce the problem to angles using the following fact
(which is in part motivated by the mysterious
presence of $\pi$ on right-hand side,
and also brings $d_{ij}\inv$ into the picture).

For any indices $i$, $j$, $m$ we have the inequalities
$ \angle (imj) \ge
\max ( \frac{2}{d_{mi}}, \frac{2}{d_{mj}} )
\quad\text{and}\quad
\pi - \angle (imj) \ge
\max ( \frac{2}{d_{mi}}, \frac{2}{d_{mj}} ). $

We first prove the former line.
Consider the altitude from $O_i$ to $O_m O_j$.
The altitude must have length at least $2$,
otherwise its perpendicular bisector passes
intersects all of $C_i$ , $C_m$, $C_j$.
Thus
$ 2 \le d_{mi} \sin \angle(imj) \le \angle(imj) $
proving the first line.
The second line follows by considering the external
angle formed by lines $O_m O_i$ and $O_m O_j$
instead of the internal one.

Our idea now is for any index $m$
we will make an estimate on
$\sum_{\substack{1 \le i \le n \\ i \neq b}} \frac{1}{d_{bi}}$
for each index $b$.
If the centers formed a convex polygon,
this would be much simpler,
but because we do not have this assumption some more care is needed.

Suppose $O_a$, $O_b$, $O_c$ are consecutive vertices
of the convex hull.
Then
$ \frac{n-1}{n-2} ∠(abc) \ge \frac{2}{d_{1b}} + \frac{2}{d_{2b}}
+ \dots + \frac{2}{d_{nb}} $
where the term $\frac{2}{d_{bb}}$ does not appear (obviously).

WLOG let's suppose $(a,b,c) = (2,1,n)$ and
that rotating ray $O_2 O_1$ hits $O_3$, $O_4$, \dots, $O_n$
in that order.
We have

\frac{2}{d_{12}} &\le \angle(213) \\
\frac{2}{d_{13}} &\le \min \left\{ \angle(213), \angle(314) \right\} \\
\frac{2}{d_{14}} &\le \min \left\{ \angle(314), \angle(415) \right\} \\
&\vdotswithin= \\
\frac{2}{d_{1(n-1)}} &\le
\min \left\{ \angle((n-2)1(n-1)), \angle((n-1)1n) \right\} \\
\frac{2}{d_{1n}} &\le \angle( (n-1) 1 n ).

Of the $n-1$ distinct angles appearing on the right-hand side,
we let $\kappa$ denote the smallest of them.
We have $\kappa \le \frac{1}{n-2} \angle(21n)$
by pigeonhole principle.
Then we pick the minimums on the right-hand side in
the unique way such that summing gives

\sum_{i=2}^n \frac{2}{d_{1i}}
&\ge ( \angle(213)+\angle(314)+\dots+\angle( (n-1)1n ) )
+ \kappa \\
&\ge \angle(21n) + \frac{1}{n-2} \angle(21n) = \frac{n-1}{n-2} \angle(21n)

as desired.

Next we show a bound that works for any center,
even if it does not lie on the convex hull $\mathcal H$.

For any index $b$ we have
$ \frac{n-1}{n-2} \pi \ge \frac{2}{d_{1b}} + \frac{2}{d_{2b}}
+ \dots + \frac{2}{d_{nb}} $
where the term $\frac{2}{d_{bb}}$ does not appear (obviously).

This is the same argument as in the previous proof,
with the modification that
because $O_b$ could lie inside the convex hull now,
our rotation argument should use lines instead of rays
(in order for the angle to be $\pi$ rather than $2\pi$).
This is why the first lemma is stated with two cases;
we need it now.

Again WLOG $b=1$.
Consider line $O_{1} O_2$ (rather than just the ray)
and imagine rotating it counterclockwise through $O_2$;
suppose that this line passes through $O_3$, $O_4$, \dots, $O_{n}$
in that order before returning to $O_{2}$ again.
We let $∠ (i1j) \in \{ \angle (i1j), \pi-\angle(i1j) \} \in [0, \pi)$
be the counterclockwise rotations obtained in this way,
so that
$ ∠(21n) = ∠(213) + ∠(314) +
+ \dots + ∠((n-1)1n). $
(This is not ``directed angles'', but related.)

Then we get bounds

\frac{2}{d_{12}} &\le ∠(213) \\
\frac{2}{d_{13}} &\le \min \left\{ ∠(213), ∠(314) \right\} \\
&\vdotswithin= \\
\frac{2}{d_{1(n-1)}} &\le
\min \left\{ ∠((n-2)1(n-1)), ∠((n-1)1n) \right\} \\
\frac{2}{d_{1n}} &\le ∠\left\{ (n-1) 1 n \right\}

as in the last proof, and so as before we get
$ \sum_{i=1}^n \frac{2}{d_{1i}} \le \frac{n-1}{n-2} ∠(21n) $
which is certainly less than $\frac{n-1}{n-2} \pi$.

Now suppose there were $r$ vertices in the convex hull.
If we sum the first claim across all $b$ on the hull,
and the second across all $b$ not on the hull (inside it),
we get

\sum_{1 \le i<j \le n} \frac{2}{d_{ij}}
&= 1/2 \sum_b \sum_{i \neq b} \frac{2}{d_{bi}} \\
&\le 1/2 \cdot \frac{n-1}{n-2} ( (r-2)\pi + (n-r)\pi ) \\
&= \frac{(n-1)\pi}{4}

as needed (with $(r-2)\pi$ being the sum of angles in the hull).


Let $A$ be a $101$-element subset of $S=\{1,2,\dots,10^6\}$.
Prove that there exist numbers $t_1$, $t_2, \dots, t_{100}$ in $S$ such that the sets
$ A_j=\{x+t_j\mid x\in A\},\qquad j=1,2,\dots,100 $
are pairwise disjoint.

Solution:
A greedy algorithm works: suppose we have picked
$ T = \left\{ t_1, \dots, t_n \right\} $
as large as possible, meaning it's impossible to add any more elements to $T$.
That means, for each $t \in \left\{ 1, \dots, 10^6 \right\}$ either $t \in T$ already
or there exists two distinct elements $a, b \in A$ and $t_i \in T$ such that
$ t = t_i + b - a \qquad (\star). $

There are at most
$|T| \cdot |A| \cdot ( |A|-1 ) = n \cdot 101 \cdot 100$
possible values for the right-hand side of $(\star)$.
So we therefore must have
$ 101 \cdot 100 \cdot n + n \ge 10^6 $
which implies $n > 99$, as desired.

It is possible to improve the bound significantly with a small optimization;
rather than adding any $t$, we require that $t_1 < \dots < t_n$
and that at each step we add the least $t \in S$ which is permitted.
In that case, one finds we only need to consider $b > a$ in $(\star)$,
and so this will save us a factor of $2+o(1)$
as the main term $101 \cdot 100$ becomes $\binom{101}{2}$ instead.
This proves it's possible to choose $198$ elements.

See, e.g., for such a write-up.


Determine all pairs of positive integers $(a,b)$ such that
$ \frac{a^2}{2ab^2-b^3+1} $
is a positive integer.

Solution:
The answer is $(a,b) = (2\ell, 1)$, $(a,b) = (\ell, 2\ell)$
and $(a,b) = (8\ell^4-\ell, 2\ell)$, for any $\ell$.
Check these work.

In the sequel, assume $b > 1$,
and integers $a$, $b$, $k$ obey $k = \frac{a^2}{2ab^2-b^3+1}$.
Expanding, we have the polynomial
$ X^2 - 2kb^2 \cdot X + k(b^3-1) = 0 $
has two integer roots, one of which is $X = a$.
This means solutions to the original problem come in pairs
(even with $k$ fixed):
$ (a,b) \longleftrightarrow
( 2kb^2 - a, b)
= ( \frac{k(b^3-1)}{a}, b). $
(Here, the first representation ensures
$2kb^2-a \in \ZZ$,
while the latter representation and the hypothesis $b > 1$ ensures
that $\frac{k(b^3-1)}{a} > 0$.)

On the other hand, we claim that:

For any solution $(a,b)$,
either $2a = b$ or $a > b$.

Since the denominator is positive, $a \ge b/2$.
Now,
$ a^2 \ge 2ab^2 - b^3 + 1 \iff a^2 \ge b^2(2a-b) + 1 $
and so if $2a - b > 0$ then $a^2 > b^2 \implies a > b$.

Now assume we have pair $(a_1, b)$ and $(a_2, b)$
of solutions with $b \neq 2a_1, 2a_2$.
Then assume $a_1 > a_2 > b$ and

a_1 + a_2 &= 2k \cdot b^2 \\
a_1a_2 &= k(b^3-1)

That's impossible, since then $a_1 > \frac{a_1+a_2}{2} = k b^2$
and hence $a_1a_2 > kb^2 \cdot b = kb^3$.
Thus the only solutions are the ones we claimed at the beginning.

Important to notice that the problem is positive divides,
not just divides.
There is an implicit inequality built in to the problem
statement and it is essentially impossible to solve without.
I would be interested in a pair $(a,b)$
for which $k < 0$, $k \in \ZZ$ yet $a, b > 0$.


Each pair of opposite sides of convex hexagon has the property that
the distance between their midpoints is $\frac{\sqrt3}{2}$
times the sum of their lengths.
Prove that the hexagon is equiangular.

Solution:
Unsurprisingly, this is a geometric inequality.
Denote the hexagon by $ABCDEF$.
Then we have that
$
\left|
\frac{\vec D + \vec E}{2} - \frac{\vec A + \vec B}{2}
\right|
= \sqrt3 \cdot \frac{\left| \vec B - \vec A \right|
+ \left| \vec E - \vec D \right|}{2}
\ge \sqrt 3 \cdot
\left| \frac{(\vec B - \vec A) - (\vec E - \vec D)}{2} \right|
$
and cyclic variations.
Suppose we define the right-hand sides as variables

\vec x = (\vec B - \vec A) - (\vec E - \vec D) \\
\vec y = (\vec D - \vec C) - (\vec A - \vec F) \\
\vec z = (\vec F - \vec E) - (\vec C - \vec B).

Then we now have

\left| \vec y - \vec z \right|
&\ge \sqrt 3 \left| \vec x \right| \\
\left| \vec z - \vec x \right|
&\ge \sqrt 3 \left| \vec y \right| \\
\left| \vec x - \vec y \right|
&\ge \sqrt 3 \left| \vec z \right|.

We square all sides (using
$\left| \vec v \right|^2 = \vec v \cdot \vec v$)
and then sum to get
$ \sum_{\text{cyc}} (\vec y - \vec z) \cdot (\vec y - \vec z)
\ge 3 \sum_{\text{cyc}} \vec x \cdot \vec x $
which rearranges to
$- \left| \vec x + \vec y + \vec z \right|^2 \ge 0. $
This can only happen if $\vec x + \vec y + \vec z =0$,
and moreover all the inequalities above were actually equalities.
That means that our triangle inequalities above were actually sharp
(and already we have $AB \parallel DE$ and so on).

Working with just $x$ and $y$ now we have

3 (\vec x \cdot \vec x) &= (2 \vec y - \vec x) \cdot (2 \vec y - \vec x) \\
&= \vec x \cdot \vec x - 4 \vec y \cdot \vec x + 4 \vec y \cdot \vec y \\
\implies
-\vec x \cdot \vec x + 2 (\vec y \cdot \vec y) &= 2 \vec x \cdot \vec y \\
2 (\vec x \cdot \vec x) - \vec y \cdot \vec y &= 2 \vec x \cdot \vec y.

which implies $\vec x \cdot \vec x = \vec y \cdot \vec y$,
that is, $\vec x$ and $\vec y$ have the same magnitude.
In this way we find $\vec x$, $\vec y$, $\vec z$ all
have the same magnitude,
and since $\vec x + \vec y + \vec z = 0$
they are related by $120\dg$ rotations, as desired.

In fact one can show further that the equiangular hexagons
which work are exactly those formed by taking an equilateral triangle
and cutting off equally sized corners.
This equality case helps motivate the solution.

One can note this ``must'' be an inequality
because the space of such hexagons is $2$-dimensional,
even though a priori the space of hexagons satisfying
three given conditions should have dimension $9-3=6$.


Let $ABCD$ be a cyclic quadrilateral.
Let $P, Q$ and $R$ be the feet of perpendiculars
from $D$ to lines $BC$, $CA$ and $AB$, respectively.
Show that $PQ = QR$ if and only if the
bisectors of angles $ABC$ and $ADC$ meet on segment $AC$.

Solution:
Let $\gamma$ denote the circumcircle of $ABCD$.
The condition on bisectors is equivalent to $(AC;BD)_\gamma = -1$.
Meanwhile if $\infty$ denotes the point at infinity along Simson line $PQR$
then $PQ = QR$ if and only if $(PR;Q\infty) = -1$.

Let rays $BQ$ and $DQ$ meet the circumcircle again at $F$ and $E$.

[Figure omitted]

[EGMO Proposition 4.1]
Then $BE \parallel PQR$.

Since $∠ DPR = ∠ DAR = ∠ DAB = ∠ DEB$.

Now we have
$ (PR;Q\infty) \overset{B}{=} (CA;FE)_\gamma
\overset{Q}{=} (AC;BD)_\gamma $
as desired.


Let $n$ be a positive integer and
let $x_1 \le x_2 \le \dots \le x_n$ be real numbers.
Prove that
$ (\sum_{i=1}^{n}\sum_{j=1}^{n} |x_i - x_j|)^2
\le \frac{2(n^2-1)}{3}\sum_{i=1}^{n}\sum_{j=1}^{n} (x_i - x_j)^2 $
with equality if and only if $x_1$, $x_2$, \dots, $x_n$
form an arithmetic sequence.

Solution:
Let $d_1 = x_2 - x_1$, \dots, $d_{n-1} = x_n - x_{n-1}$.
The inequality in question becomes:
$
( \sum_i i(n-i) d_i )^2
\le
\frac{n^2-1}{3} \cdot
( \sum_i i(n-i) d_i^2 + 2\sum_{i<j} i(n-j) d_i d_j ).
$
Clearing the square on the right-hand side we want to show
$
\sum_{i<j} ( 3ij(n-i)(n-j) - (n^2-1)i(n-j) ) \cdot 2d_i d_j
\le \sum_i (n^2-1-3i(n-i)) \cdot i(n-i) d_i^2.
$
We use AM-GM directly on $2d_i d_j \le d_i^2 + d_j^2$:
this actually solves the problem.
The annoying part is to check that the coefficients actually match:

[Big bash]
For an index $1 \le k \le n-1$, we have

&\sum_{i<k} ( 3ik(n-i)(n-k) - (n^2-1)i(n-k) ) \\
+& \sum_{j>k} ( 3kj(n-k)(n-j) - (n^2-1)k(n-j) ) \\
= & (n^2-1-3k(n-k)) \cdot k(n-k).

Rewrite as:

3k(n-k) ( -k(n-k) + \sum_i i(n-i) )
&= (n^2-1)( (n-k)\sum_{i<k} i + k\sum_{j>k} (n-j) ) \\
&+ (n^2-1-3k(n-k)) \cdot k(n-k) \\
\iff 3k(n-k) \sum_i i(n-i)
&= (n^2-1) ( (n-k)\sum_{i<k} i + k\sum_{j>k}(n-j) ) \\
&+ (n^2-1)k(n-k) - 3k^2(n-k)^2 \\
\iff 3k(n-k) ( \sum_{i} i(n-i) )
&= (n^2-1) ( (n-k)\sum_{i \le k} i + k \sum_{i < n-k} i ) \\
\iff 3k(n-k) \frac{(n-1)n(n+1)}{6}
&= (n^2-1) ( (n-k)\frac{k(k+1)}{2} ) \\
& + (n^2-1) ( k \frac{(n-k)(n-k-1)}{2} ) \\
\iff 3k(n-k) \frac{(n-1)n(n+1)}{6}
&= (n^2-1)k(n-k) \cdot \frac n2

which is visibly true.

Equality occurs only if all $d_i$ are equal
because the coefficient of $d_i d_j$ is nonzero
for any $i \le n/2$ and $j \ge n/2$.


Let $p$ be a prime number.
Prove that there exists a prime number $q$ such that for every integer $n$,
the number $n^p-p$ is not divisible by $q$.

Solution:
By orders, we must have $q=pk+1$ for this to be possible
(since if $q \not \equiv 1 \pmod p$, then $n^p$ can be any residue modulo $q$).
Since $p \equiv n^p \pmod q \implies p^k \equiv 1 \pmod q$,
it suffices to prevent the latter situation from happening.

So we need a prime $q \equiv 1 \pmod p$ such that $p^k \not\equiv 1 \pmod q$.
To do this, we first recall the following lemma.

Let $\Phi_p(X) = 1 + X + X^2 + \dots + X^{p-1}$.
For any integer $a$, if $q$ is a prime divisor of $\Phi_p(a)$ other than $p$,
then $a \pmod q$ has order $p$. (In particular, $q \equiv 1 \pmod p$.)

We have $a^p-1 \equiv 0 \pmod q$, so either the order is $1$ or $p$.
If it is $1$, then $a \equiv 1 \pmod q$, so $q \mid \Phi_p(1) = p$, hence $q = p$.

Now the idea is to extract a prime factor $q$
from the cyclotomic polynomial
$ \Phi_p(p) = \frac{p^p-1}{p-1} \equiv 1+p \pmod{p^2} $
such that $q \not\equiv 1 \pmod{p^2}$;
hence $k \not\equiv 0 \pmod p$,
and as $p \pmod q$ has order $p$ we have $p^k \not\equiv 1 \pmod q$.


Let $ABC$ be an acute-angled triangle with $AB\neq AC$.
The circle with diameter $BC$ intersects the sides $AB$ and $AC$
at $M$ and $N$ respectively.
Denote by $O$ the midpoint of the side $BC$.
The bisectors of the angles $\angle BAC$ and $\angle MON$ intersect at $R$.
Prove that the circumcircles of the triangles $BMR$ and $CNR$
have a common point lying on the side $BC$.

Solution:
By Miquel's theorem it's enough to show $AMRN$ is cyclic.
[Figure omitted]
In fact, since the bisector of $\angle MON$
is just the perpendicular bisector of $MN$,
the point $R$ is actually just the arc midpoint
of $\widehat{MN}$ of $(AMN)$ as desired.


Find all polynomials $P$ with real coefficients such that
for all reals $a$, $b$, $c$ such that $ab+bc+ca = 0$, we have
$ P(a-b) + P(b-c) + P(c-a) = 2P(a+b+c). $

Solution:
The answer is $ P(x) = \alpha x^4 + \beta x^2 $
which can be checked to work, for any real numbers $\alpha$ and $\beta$.

It is easy to obtain that $P$ is even and $P(0) = 0$.
The trick is now to choose $(a,b,c) = (6x,3x,-2x)$
and then compare the leading coefficients to get
$ 3^n + 5^n + 8^n = 2 \cdot 7^n $
for $n = \deg f$ (which is even).
As $n \ge 7 \implies (8/7)^n > 2$, this means that we must have $n \le 6$.
Moreover, taking modulo $7$ we have $3^n + 5^n \equiv 6 \pmod 7$
which gives $n \equiv 2, 4 \pmod 6$.

Thus $\deg P \le 4$, which (combined with $P$ even) resolves the problem.


Define a ``hook'' to be a figure made up of six unit squares
as shown below in the picture,
or any of the figures obtained by applying rotations
and reflections to this figure.
[Figure omitted]
Which $m \times n$ rectangles can be tiled by hooks?

Solution:
The answer is that one requires:

$\{1,2,5\} \notin \{m,n\}$,
$3 \mid m$ or $3 \mid n$,
$4 \mid m$ or $4 \mid n$.

First, we check all of these work, in fact we claim:

Any rectangle satisfying these conditions
can be tiled by $3 \times 4$ rectangles (and hence by hooks).

If $3 \mid m$ and $4 \mid n$, this is clear.
Else suppose $12 \mid m$ but $3 \nmid n$, $4 \nmid n$.
Then $n \ge 7$, so it can be written in the form
$3a+4b$ for nonnegative integers $a$ and $b$, which permits a tiling.

We now prove these conditions are necessary.
It is not hard to see that $m,n \notin \{1,2,5\}$ is necessary.

We thus turn our attention to divisibility conditions.
Each hook has a hole, and if we associate each hook with
the one that fills its hole, we get a bijective pairing of hooks.
Thus the number of cells is divisible by $12$,
and the cells come grouped into two possible shapes,
which we will call \textbf{tiles} shown below,
(rotations and reflections permitted).
[Figure omitted]

In particular, the total number of cells is divisible by $12$.
Thus the problem is reduced to proving that:

if a $6a \times 2b$ rectangle is tiled by tiles,
then at least one of $a$ and $b$ is even.

Note that the tiles can be further classified into two types:

\textbf{First type}: These tiles have exactly four columns,
each with exactly three cells (an odd number).
Moreover, all rows have an even number of cells (either $2$ or $4$).
\textbf{Second type}: vice-versa.
These tiles have exactly four rows,
each with exactly three cells (an odd number).
Moreover, all rows have an odd number of cells.

We claim that any tiling uses an even number of each type, which is enough.

By symmetry we prove an even number of first-type tiles.
Color red every fourth column of the rectangle.
The number of cells colored red is even.
The tiles of the second type cover an even number of red cells,
and the tiles of the first type cover an odd number of red cells.
Hence the number of tiles of the first type must be even.

This shows that a rectangle can be tiled by hooks
if and only if it can be tiled by $3 \times 4$ rectangles.
But there exist tilings which do not decompose into $3 \times 4$;
see e.g.\ .


Let $n \ge 3$ be an integer
and $t_1$, $t_2$, \dots, $t_n$ positive real numbers such that
$ n^2+1 > (t_1 + t_2 + \dots + t_n)
( \frac{1}{t_1} + \frac{1}{t_2} + \dots + \frac{1}{t_n} ). $
Show that $t_i$, $t_j$, $t_k$ are the sides of a triangle
for all $i$, $j$, $k$ with $1 \le i < j < k \le n$.

Solution:
Let $a = t_1$, $b = t_2$, $c = t_3$.
Expand:

n^2+1 &> (t_1 + t_2 + \dots + t_n)
( \frac{1}{t_1} + \dots + \frac{1}{t_n} ) \\
&= n + \sum_{1 \le i < j \le n}
( \frac{t_i}{t_j} + \frac{t_j}{t_i} ) \\
&= n + \sum_{1 \le i < j \le n}
( \frac{t_i}{t_j} + \frac{t_j}{t_i} ) \\
&\ge n + \sum_{1 \le i < j \le 3}
( \frac{t_i}{t_j} + \frac{t_j}{t_i} )
+ \sum_{\substack{1 \le i < j \le n \\ j > 3 }} 2 \\
&= n + 2( \binom n2-3 )
+ ( \frac ab + \frac ba )
+ \frac{a+b}{c} + \frac{c}{b} + \frac{c}{a} \\
&\ge n + 2( \binom n2-3 ) + 2
+ \frac{a+b}{c} + c \cdot \frac{4}{a+b}

So, we conclude that
$ \frac{a+b}{c} + \frac{4c}{a+b} < 5 $
which rearranges to
$ ( 4c-(a+b) )( c-(a+b) ) < 0. $
This is enough to imply $c \le a+b$.

A variant of the same argument allows one to improve
the left-hand side to $(n+\sqrt{10}-3)^2$.
One does so by writing
$ \text{RHS} \ge ( \sqrt{( a+b+c )
( \frac1a+\frac1b+\frac1c )} + (n-3) )^2 $
and estimating the square root as in the previous approach.

In addition, $(n+\sqrt{10}-3)^2$ is best possible,
as seen by taking $(a,b,c) = (2,1,1)$ and $t_4 = t_5 = \dots = \frac25 \sqrt{10}$.


In a convex quadrilateral $ABCD$,
the diagonal $BD$ bisects neither the angle $ABC$ nor the angle $CDA$.
The point $P$ lies inside $ABCD$ and satisfies
$\angle PBC=\angle DBA \quad\text{and}\quad \angle PDC=\angle BDA. $
Prove that $ABCD$ is a cyclic quadrilateral if and only if $AP=CP$.

Solution:
We show two solutions.
We note that the first hypothesis cannot be dropped, because $ABCD$ being a kite
with $BA=BC$ and $DA=DC$ with center $P$ is a counterexample
(where $AP=CP$ but $ABCD$ is not cyclic).
However, the condition that $BD$ bisects neither angle $\angle B$ nor $\angle D$
is equivalent to requiring that the point $P$ does not lie on line $BD$
and we assume this henceforth.

Barycentric solution (from teenager Evan).:
Apply barycentric coordinates to $\triangle PBD$
(nondegenerate by the non-bisect condition)
with $P = (1,0,0)$, $B = (0,1,0)$ and $D = (0,0,1)$.
Define $a = BD$, $b = DP$ and $c = PB$.

Since $A$ and $C$ are isogonal conjugates with respect to $\triangle PBD$,
we set $ A = (au : bv : cw) \qquad\text{and}\qquad
C = ( \frac au : \frac bv : \frac cw ). $
For brevity define $M = au + bv + cw$ and $N = avw + bwu + cuv$.

We now compute each condition.

Quadrilateral $ABCD$ is cyclic if and only if $N^2 = u^2 M^2$.

W know a circle through $B$ and $D$
is a locus of points
with $ \frac{a^2yz+b^2zx+c^2xy}{x(x+y+z)} $
is equal to some constant.
Therefore quadrilateral $ABCD$ is cyclic if and only if
$\frac{abc \cdot N}{au \cdot M}$
is equal to $\frac{abc \cdot uvw \cdot M}{avw \cdot N}$
which rearranges to $N^2 = u^2M^2$.

We have $PA = PC$ if and only if $N^2 = u^2 M^2$.

We have the displacement vector
$\overrightarrow{PA}
= \tfrac{1}{M} ( bv+cw , -bv ,-cw )$.
Therefore,

M^2 \cdot \left| PA \right|^2
&= -a^2(bv)(cw) + b^2(cw)(bv+cw) + c^2(bv)(bv+cw) \\
&= bc(-a^2vw + (bw+cv)(bv+cw)).

In a similar way
(by replacing $u$, $v$, $w$ with their inverses)
we have

( \frac{N}{uvw} )^2 \cdot \left| PC \right|^2
&= (vw)^{-2} \cdot bc(-a^2vw + (bv+cw)(bw+cv)) \\
\iff N^2 \cdot \left| PC \right|^2
& = u^2 bc(-a^2vw + (bw+cv)(bv+cw))

These are equal if and only if $N^2 = u^2M^2$, as desired.

Angle chasing solution (Evan Chen and Petko Lazarov).:
The solution consists of two parts.
The first part is that by angle chasing, we will prove that
$ ∠ PAC = ∠ ACP \iff ∠ BAC + ∠ CBD + ∠ DCA + ∠ ADB = 0.
\qquad (\spadesuit). $
A careless reader would be forgiven for thinking that $(\spadesuit)$
implies the problem or at least one direction,
but it turns out the situation is more subtle.
The second part analyzes the angle conditions more carefully
and provides a complete proof.

\subparagraph{Proof of the equivalence $(\spadesuit)$ by angle chasing.}
We start with the following unconditional claim, valid for any quadrilateral.

[Isogonal conjugation]
Let $ABCD$ and $P$ be as in the problem statement.
Then $∠ APB + ∠ CPD = 180\dg$.

The angles in the statement imply that $A$ and $C$
are isogonal conjugates with respect to $\triangle PBC$.
Thus, lines $PA$ and $PC$ are isogonal with respect to $\angle BPC$, as needed.

[Figure omitted]

Next we rewrite the two angles $∠ APB$ and $∠ CPD$ in the claim
(colored green with three rings)
so that their only dependence on $P$
is through the angles $∠ PAC$ and $∠ CAP$ (colored red with two rings),
as follows:

-∠ APB &= ∠ PBA + ∠ BAP = ∠ PBA + (∠ BAC - ∠ PAC) \\
&= ∠ CBD + ∠ BAC - ∠ PAC \\
-∠ CPD &= ∠ PDC + ∠ DCP = ∠ PDC + (∠ DCA + ∠ ACP) \\
&= ∠ ADB + ∠ DCA + ∠ ACP.

Since the claim says $∠ APB + ∠ CPD = 0$, summing
lets us finally rewrite $∠ PAC - ∠ APC$ in terms of only $A$, $B$, $C$, $D$:

0 &= (∠ ACP - ∠ PAC) + ∠ ADB + ∠ DCA + ∠ CBD + ∠ BAC \\
\implies ∠ PAC - ∠ ACP &= ∠ ADB + ∠ DCA + ∠ CBD + ∠ BAC.

These four latter angles are colored blue with one ring in the figure.
This proves $(\spadesuit)$.

\subparagraph{Quasi-harmonic quadrilaterals.}
To interpret the condition $(\spadesuit)$, we define a new term:
a quadrilateral $ABCD$ is quasi-harmonic if $AB \cdot CD = BC \cdot DA$.
(See IMO 2018/6 for another problem involving quasi-harmonic quadrilaterals.)
The following two lemmas show why this condition is relevant:

The condition
$ ∠ BAC + ∠ CBD + ∠ DCA + ∠ ADB = 0 $
is equivalent to $ABCD$ being either cyclic or quasi-harmonic or both.

A clean approach with complex numbers
(posted at ) goes as follows:
define complex numbers $\mu = (a-b)(c-d) \neq 0$ and $\nu = (b-c)(d-a) \neq 0$.
Then $ \mu-\nu = (a-c)(b-d) \neq 0. $

Now the angle condition is equivalent to

\RR &\ni \frac{a-b}{d-b} \cdot \frac{b-c}{a-c} \cdot \frac{c-d}{b-d} \cdot \frac{d-a}{c-a} \\
&= \frac{\mu \nu}{(\mu - \nu)^2} \\
&= \frac{1}{\frac{\mu}{\nu} + \frac{\nu}{\mu} - 2} \\
\iff \RR &\ni \frac{\mu}{\nu} + \frac{\nu}{\mu}.

In general, though $z+1/z$ is real exactly when either $|z|=1$ or $z \in \RR$.
Note $\mu/\nu \in \RR$ is equivalent to $ABCD$ cyclic
and $|\mu| = |\nu|$ is equivalent to $ABCD$ being quasiharmonic; the proof follows.

This can be also proved by inversion at $A$, though we don't write the details here.
(See also ).

Quadrilateral $ABCD$ is quasi-harmonic if and only if $P$ lies on line $AC$.

Let $X = BD \cap AC$.
If the isogonal of line $BD$ with respect to $\angle B$ meets line $AC$ at $Y$, then
$\frac{AX}{CX} \frac{AY}{CY} = ( \frac{BA}{BC} )^2$.
Similarly if the isogonal to $\angle D$ meets line $AC$ at $Y'$, then
$\frac{AX}{CX} \frac{AY'}{CY'} = ( \frac{DA}{DC} )^2$.
Hence $ABCD$ is quasi-harmonic if and only if $Y = Y'$ (that is, $Y=Y'=P$).

\subparagraph{Wrap-up.}
We now show that $PA = PC$ if and only if $ABCD$ is cyclic
by cases on whether $P$ lies on $AC$.

If $ABCD$ is not quasi-harmonic,
then $(\spadesuit)$ implies the problem statement immediately.
Indeed, $∠ PAC = ∠ ACP$ if and only if $PA = PC$
(as $\triangle PAC$ is not degenerate)
and the second lemma turns our angle condition into $ABCD$ cyclic.

Now assume $ABCD$ is quasi-harmonic and $P$ lies on line $AC$.
We ignore $(\spadesuit)$.
Instead, note that if $ABCD$ is also cyclic then
$BD$ is a symmedian of $\triangle ABC$ and hence $P$ is the midpoint.
Conversely, suppose we know $BD$ is a symmedian of $\triangle ABC$.
Let $D' \neq B$ be the point for which $ABCD'$ is cyclic and harmonic;
then $B$, $D$, $D'$ are collinear and $\frac{BD}{CD} = \frac{BD'}{CD'} = \frac{BA}{CA}$.
So $D' = D$ (the corresponding Apollonian circle only meets line $BD$ twice), as needed.


We call a positive integer alternating if every two consecutive digits
in its decimal representation are of different parity.
Find all positive integers $n$ which have an alternating multiple.

Solution:
If $20 \mid n$, then clearly $n$ has no alternating
multiple since the last two digits are both even.
We will show the other values of $n$ all work.

The construction is just rush-down do-it.
The meat of the solution is the two following steps.

[Tail construction]
For every even integer $w \ge 2$,

there exists an even alternating multiple $g(w)$ of $2^{w+1}$
with exactly $w$ digits, and
there exists an even alternating multiple $h(w)$ of $5^{w}$
with exactly $w$ digits.

(One might note this claim is implied by the problem, too.)

We prove the first point by induction on $w$.
If $w = 2$, take $g(2) = 32$.
In general, we can construct $g(w+2)$ from $g(w)$
by adding some element in
$ 10^w \cdot \{10, 12, 14, 16, 18, 30, \dots, 98\} $
to $g(w)$, corresponding to the digits
we want to append to the start.
This multiple is automatically divisible by $2^{w+1}$,
and also can take any of the four possible values modulo $2^{w+3}$.

The second point is a similar induction,
with base case $h(2) = 50$.
The same set above consists of numbers divisible by $5^w$,
and covers all residues modulo $5^{w+2}$.
Careful readers might recognize the second part
as essentially USAMO 2003/1.

[Head construction]
If $\gcd(n,10) = 1$, then for any $b$,
there exists an even alternating number $f(b \bmod n)$ which is
$b \pmod n$.

A standard argument shows that
$ 10 \cdot \frac{100^m-1}{99}
= \underbrace{1010\dots10}_{m\ 10\text{'s}}
\equiv 0 \pmod n $
for any $m$ divisible by $\varphi(99n)$.
Take a very large such $m$,
and then add on $b$ distinct numbers of the form $10^{\varphi(n)r}$
for various even values of $r$; these all are $1 \pmod n$
and change some of the $1$'s to $3$'s.

Now, we can solve the problem.
Consider three cases:

If $n = 2^k m$ where $\gcd(m,10) = 1$ and $k \ge 2$ is even,
then the concatenated number
$ 10^k f( -\frac{g(k)}{10^k} \bmod m ) + g(k) $
works fine.

If $n = 5^k m$ where $\gcd(m,10) = 1$ and $k \ge 2$ is even,
then the concatenated number
$ 10^k f( -\frac{h(k)}{10^k} \bmod m ) + h(k) $
works fine.

If $n = 50m$ where $\gcd(m,10) = 1$,
then the concatenated number
$ 100 f( -\frac{1}{2} \bmod m ) + 50 $
works fine.

Since every non-multiple of $20$ divides such a number, we are done.


Six points are chosen on the sides of an equilateral triangle $ABC$:
$A_1$, $A_2$ on $BC$, $B_1$, $B_2$ on $CA$ and $C_1$, $C_2$ on $AB$,
such that they are the vertices of a
convex hexagon $A_1A_2B_1B_2C_1C_2$ with equal side lengths.
Prove that the lines $A_1B_2$, $B_1C_2$ and $C_1A_2$ are concurrent.

Solution:
The six sides of the hexagon, when oriented, comprise
six vectors with vanishing sum.
However note that $ \overrightarrow{A_1A_2}
+ \overrightarrow{B_1B_2}
+ \overrightarrow{C_1C_2} = 0. $
Thus
$ \overrightarrow{A_2B_1} + \overrightarrow{B_2C_1} +
\overrightarrow{C_2A_1} = 0 $
and since three unit vectors with vanishing sum
must be rotations of each other by $120\dg$,
it follows they must also form an equilateral triangle.

[Figure omitted]

Consequently, triangles $A_1A_2B_1$, $B_1B_2C_1$, $C_1C_2A_1$
are congruent, as $\angle A_2 = \angle B_2 = \angle C_2$.
So triangle $A_1 B_1 C_1$ is equilateral and the
diagonals are concurrent at the center.


Let $a_1$, $a_2$, \dots\ be a sequence of integers
with infinitely many positive and negative terms.
Suppose that for every positive integer $n$
the numbers $a_1$, $a_2$, \dots, $a_n$
leave $n$ different remainders upon division by $n$.
Prove that every integer occurs exactly once in the sequence.

Solution:
Obviously every integer appears at most once
(otherwise take $n$ much larger).
So we will prove every integer appears at least once.

For any $i < j$ we have $\left| a_i-a_j \right| < j$.

Otherwise, let $n = \left| a_i-a_j \right| \neq 0$.
Then $i,j \in [1,n]$ and $a_i \equiv a_j \pmod n$,
contradiction.

For any $n$, the set $\{a_1, \dots, a_n\}$
is of the form $\{k+1, \dots, k+n\}$ for some integer $k$.

By induction, with the base case $n=1$ being vacuous.
For the inductive step,
suppose $\{a_1, \dots, a_n\} = \{k+1, \dots, k+n\}$ are determined.
Then
$ a_{n+1} \equiv k \pmod{n+1}. $
Moreover by the earlier claim we have
$ \left| a_{n+1}-a_1 \right| < n+1. $
From this we deduce $a_{n+1} \in \{k, k+n+1\}$ as desired.

This gives us actually a complete description
of all possible sequences satisfying the hypothesis:
choose any value of $a_1$ to start.
Then, for the $n$th term,
the set $S = \{a_1, \dots, a_{n-1}\}$
is (in some order) a set of $n-1$ consecutive integers.
We then let $a_n = \max S + 1$ or $a_n = \min S - 1$.
A picture of six possible starting terms is shown below.

[Figure omitted]

Finally, we observe that the condition that
the sequence has infinitely many positive and negative terms
(which we have not used until now)
implies it is unbounded above and below.
Thus it must contain every integer.


Solution:
Negating both sides and adding $3$ eliminates the minus signs:
$ \sum_{\text{cyc}} \frac{1}{x^5+y^2+z^2}
\le \frac{3}{x^2+y^2+z^2}. $
Thus we only need to consider the case $xyz = 1$.

Direct expansion and Muirhead works now!
As advertised, once we show it suffices to analyze if $xyz=1$
the inequality becomes more economically written as
$ S = \sum_{\text{cyc}} x^2(x^2-yz)(y^4+x^3z+xz^3)(z^4+x^3y+xy^3)
\overset{?}{\ge} 0. $
So, clearing all the denominators gives

S &= \sum_{\text{cyc}} x^2(x^2-yz)
[ y^4z^4 + x^3y^5 + xy^7 + x^3z^5 + x^6yz + x^4y^3z
+ xz^7 + x^4yz^3 + x^2y^3z^3 ] \\
&= \sum_{\text{cyc}}
[ x^4y^4z^4 + x^7y^5 + x^5y^7 + x^7z^5 + x^{10}yz + x^8y^3z
+ x^5z^7 + x^8yz^3 + x^6y^3z^3 ] \\
&- \sum_{\text{cyc}}
[ x^2y^5z^5 + x^5y^6z + x^3y^8z + x^5yz^6 + x^8y^2z^2 + x^6y^4z^2
+ x^3yz^8 + x^6y^2z^4 + x^4y^4z^4 ] \\
&= \sum_{\text{cyc}}
[ x^7y^5 + x^5y^7 + x^7z^5 + x^{10}yz
+ x^5z^7 + x^6y^3z^3 ] \\
&- \sum_{\text{cyc}}
[ x^2y^5z^5 + x^5y^6z + x^5yz^6 + x^8y^2z^2 + x^6y^4z^2
+ x^6y^2z^4 ]

In other words we need to show
$
\sum_{\text{sym}} ( 2x^7y^5
+1/2 x^{10}yz + 1/2 x^6y^3z^3 )
\ge
\sum_{\text{sym}} ( 1/2 x^8 y^2 z^2
+ 1/2 x^5 y^5 z^2 + x^6 y^4 z^2 + x^6 y^5 z ).
$
which follows by summing

\sum_{\text{sym}} \frac{x^{10} yz + x^6 y^3 z^3}{2}
&\ge \sum_{\text{sym}} x^8 y^2 z^2 \\
1/2 \sum_{\text{sym}} x^8 y^2 z^2
&\ge 1/2 \sum_{\text{sym}} x^6 y^4 z^2 \\
1/2 \sum_{\text{sym}} x^7y^5
&\ge 1/2 \sum_{\text{sym}} x^5 y^5 z^2 \\
1/2 \sum_{\text{sym}} x^7y^5
&\ge 1/2 \sum_{\text{sym}} x^6 y^4 z^2 \\
\sum_{\text{sym}} x^7y^5
&\ge \sum_{\text{sym}} x^6 y^5 z.

The first line here comes from AM-GM,
the rest come from Muirhead.

More elegant approach is to use Cauchy in the form
$ \frac{1}{x^5+y^2+z^2} \le \frac{x\inv+y^2+z^2}{(x^2+y^2+z^2)^2}. $


Determine all positive integers relatively
prime to all the terms of the infinite sequence
$ a_n = 2^n+3^n+6^n-1, \quad n \ge 1. $

Solution:
The answer is $1$ only (which works).

It suffices to show there are no primes.
For the primes $p=2$ and $p=3$, take $a_2=48$.
For any prime $p \ge 5$ notice that

a_{p-2} &= 2^{p-2} + 3^{p-2} + 6^{p-2} - 1 \\
&\equiv \frac 12 + \frac 13 + \frac 16 - 1 \pmod p \\
&\equiv 0 \pmod p

so no other larger prime works.


Let $ABCD$ be a fixed convex quadrilateral
with $BC=DA$ and $BC \nparallel DA$.
Let two variable points $E$ and $F$ lie on the
sides $BC$ and $DA$, respectively, and satisfy $BE=DF$.
The lines $AC$ and $BD$ meet at $P$,
the lines $BD$ and $EF$ meet at $Q$,
the lines $EF$ and $AC$ meet at $R$.
Prove that the circumcircles of the triangles $PQR$,
as $E$ and $F$ vary, have a common point other than $P$.

Solution:
Let $M$ be the Miquel point of complete quadrilateral $ADBC$;
in other words, let $M$ be the second intersection point
of the circumcircles of $\triangle APD$ and $\triangle BPC$.
(A good diagram should betray this secret;
all the points are given in the picture.)
This makes lots of sense since we know $E$ and $F$
will be sent to each other under the spiral similarity too.

[Figure omitted]

Thus $M$ is the Miquel point of complete quadrilateral $FACE$.
As $R = FE \cap AC$ we deduce $FARM$ is a cyclic quadrilateral
(among many others, but we'll only need one).

Now look at complete quadrilateral $AFQP$.
Since $M$ lies on $(DFQ)$ and $(RAF)$,
it follows that $M$ is in fact the Miquel point of $AFQP$ as well.
So $M$ lies on $(PQR)$.

Thus $M$ is the fixed point that we wanted.

Naturally, the congruent length
condition can be relaxed to $DF/DA = BE/BC$.


In a mathematical competition $6$ problems were posed to the contestants.
Each pair of problems was solved by more than $\frac{2}{5}$ of the contestants.
Nobody solved all 6 problems.
Show that there were at least $2$ contestants
who each solved exactly $5$ problems.

Solution:
Assume not and at most one contestant solved five problems.
By adding in solves,
we can assume WLOG that one contestant solved problems one through five,
and every other contestant solved four of the six problems.

We split the remaining contestants based on whether they solved P6.
Let $a_i$ denote the number of contestants who solved
$\{1,2,\dots,5\} \setminus \{i\}$ (and missed P6).
Let $b_{ij}$ denote the number of contestants who solved
$\{1,2,\dots,5,6\} \setminus \{i,j\}$, for $1 \le i < j \le 5$
(thus in particular they solved P6).
Thus
$ n = 1 + \sum_{1 \le i \le 5} a_i + \sum_{1 \le i < j \le 5} b_{ij} $
denotes the total number of contestants.

Considering contestants who solved P1/P6 we have
$ t_1 \coloneq b_{23} + b_{24} + b_{25} + b_{34} + b_{35} + b_{45} \ge \frac25n + \frac15 $
and we similarly define $t_2$, $t_3$, $t_4$, $t_5$.
(We have written $\frac25n+\frac15$ since we know
the left-hand side is an integer strictly larger than $\frac25n$.)
Also, by considering contestants who solved P1/P2 we have
$ t_{12} = 1 + a_{3} + a_{4} + a_{5} + b_{34} + b_{35} + b_{45}
\ge \frac25n + \frac15 $
and we similarly define $t_{ij}$ for $1 \le i < j \le 5$.

The number $\frac{2n+1}{5}$ is equal to some integer $k$,
fourteen of the $t$'s are equal to $k$,
and the last one is equal to $k+1$.

First, summing all fifteen equations gives

6n+4 = 10 + 6(n-1) &= 10
+ \sum_{1 \le i \le 5} 6a_i + \sum_{1 \le i < j \le 5} 6b_{ij} \\
&= \sum_{1 \le i \le 5} t_i + \sum_{1 \le i < j \le 5} t_{ij}.

Thus the sum of the $15$ $t$'s is $6n+4$.
But since all the $t$'s are integers at least
$\frac{2n+1}{5} = \frac{6n+3}{15}$, the conclusion follows.

However, we will also manipulate the equations to get the following.

We have
$ t_{45} \equiv 1 + t_1 + t_2 + t_3 + t_{12} + t_{23} + t_{31} \pmod 3. $

This follows directly by computing the coefficient of the $a$'s and $b$'s.
We will nonetheless write out a derivation of this equation, to
motivate it, but the proof stands without it.

Let $B = \sum_{1 \le i < j \le 5} b_{ij}$ be the sum of all $b$'s.
First, note that

t_1 + t_2 &= B + b_{34} + b_{45} + b_{35} - b_{12} \\
&= B + ( t_{12}-1-a_3-a_4-a_5 ) - b_{12} \\
\implies b_{12} &= B - (t_1 + t_2) + t_{12} - 1 - (a_3+a_4+a_5).

This means we have more or less solved for each $b_{ij}$
in terms of only $t$ and $a$ variables.
Now

t_{45} &= 1 + a_1 + a_2 + a_3 + b_{12} + b_{23} + b_{31} \\
&= 1 + a_1 + a_2 + a_3 \\
&+ [B - (t_1 + t_2) + t_{12} - 1 - (a_3+a_4+a_5)] \\
&+ [B - (t_2 + t_3) + t_{23} - 1 - (a_1+a_4+a_5)] \\
&+ [B - (t_3 + t_1) + t_{13} - 1 - (a_2+a_4+a_5)] \\
&\equiv 1 + t_1 + t_2 + t_3 + t_{12} + t_{23} + t_{31} \pmod 3

as desired.

However, we now show the two claims are incompatible
(and this is easy, many ways to do this).
There are two cases.

Say $t_5 = k+1$ and the others are $k$.
Then the equation for $t_{45}$ gives that $k \equiv 6k+1 \pmod 3$.
But now the equation for $t_{12}$ give $k \equiv 6k \pmod 3$.
Say $t_{45} = k+1$ and the others are $k$.
Then the equation for $t_{45}$ gives that $k+1 \equiv 6k \pmod 3$.
But now the equation for $t_{12}$ give $k \equiv 6k+1 \pmod 3$.

It is significantly easier to prove that there
is at least one contestant who solved five problems.
One can see it by dropping the $+10$ in the proof of the claim,
and arrives at a contradiction.
In this situation it is not even necessary to set up
the many $a$ and $b$ variables;
just note that the expected number of contestants
solving any particular pair of problems is
$\frac{\binom42n}{\binom62} = \frac25n$.

The fact that $\frac{2n+1}{5}$
should be an integer also follows quickly,
since if not one can improve the bound to $\frac{2n+2}{5}$
and quickly run into a contradiction.
Again one can get here without setting up $a$ and $b$.

The main difficulty seems to be the precision required
in order to nail down the second $5$-problem solve.

The second claim may look miraculous,
but the proof shows that it is not too unnatural
to consider $t_1 + t_2 - t_{12}$ to isolate $b_{12}$
in terms of $a$'s and $t$'s.
The main trick is: why mod $3$?

The reason is that if one looks closely, for a
fixed $k$ we have a system of $15$ equations in $15$ variables.
Unless the determinant $D$ of that system happens to be zero,
this means there will be a rational solution in $a$ and $b$,
whose denominators are bounded by $D$.
However if $p \mid D$ then we may conceivably run into mod $p$
issues.

This motivates the choice $p = 3$,
since it is easy to see the determinant is divisible by $3$,
since constant shifts of $\vec a$ and $\vec b$ are also solutions mod $3$.
(The choice $p = 2$ is a possible guess as well for this reason,
but the problem seems to have better $3$-symmetry.)


Let $ABC$ be a triangle with incenter $I$.
A point $P$ in the interior of the triangle satisfies
$ \angle PBA + \angle PCA = \angle PBC + \angle PCB. $
Show that $AP \ge AI$ and that equality holds if and only if $P=I$.

Solution:
The condition rewrites as
$
\angle PBC + \angle PCB
= (\angle B - \angle PBC)
+ (\angle C - \angle PCB)
\implies
\angle PBC + \angle PCB = \frac{\angle B + \angle C}{2}
$
which means that
$ \angle BPC = 180\dg - \frac{\angle B + \angle C}{2}
= 90\dg + \frac{\angle A}{2}
= \angle BIC.
$
Since $P$ and $I$ are both inside $\triangle ABC$
that implies $P$ lies on the circumcircle of $\triangle BIC$.

It's well-known (by ``Fact 5'') that the circumcenter
of $\triangle BIC$ is the arc midpoint $M$ of $\widehat{BC}$.
Therefore
$ AI + IM = AM \le AP + PM \implies AI \le AP $
with equality holding iff $A$, $P$, $M$ are collinear, or $P=I$.


Let $P$ be a regular $2006$-gon.
A diagonal is called good if its endpoints
divide the boundary of $P$ into two parts,
each composed of an odd number of sides of $P$.
The sides of $P$ are also called good.
Suppose $P$ has been dissected into triangles by $2003$ diagonals,
no two of which have a common point in the interior of $P$.
Find the maximum number of isosceles triangles having two good
sides that could appear in such a configuration.

Solution:
Call a triangle with the desired property special.
We prove the maximum number of special triangles is $1003$,
achieved by paring up the sides of the polygon.

We present two solutions for the upper bound.
Both of them rely first on two geometric notes:

In a special triangle, the good sides are congruent
(and not congruent to the third side).
No two isosceles triangles share a good side.

Solution using bijections.:
Call a good diagonal \textbf{special} if it's part of a special triangle;
special diagonals come in pairs.
Consider the minor arc cut out by a special diagonal $d$,
which has an odd number of sides.
Since special diagonals come in pairs,
one can associate to $d$ a side of the polygon
not covered by any special diagonals from $d$.
Hence there are at most $2006$ special diagonals,
so at most $1003$ special triangles.

Solution using graph theory.:
Consider the tree $T$ formed by the $2004$
triangles in the dissection, with obvious adjacency.
Let $F$ be the forest obtained by deleting
any edge corresponding to a good diagonal.
Then the resulting graph $F$ has only degrees $1$ and $3$,
with special triangles only occurring at degree $1$ vertices.

If there are $k$ good diagonals drawn,
then this forest consists of $k+1$ trees.
A tree with $n_i$ vertices ($0 \le i \le k$)
consequently has $\frac{n_i+2}{2}$ leaves.
However by the earlier remark at least $k$ leaves
don't give special triangles
(one on each side of a special diagonal);
so the number of leaves that do give good triangles is at most
$ -k + \sum_i \frac{n_i+2}{2}
= -k + \frac{2004 + 2(k+1)}{2} = 1003. $


Determine the least real number $M$ such that the inequality
$ \left| ab(a^2-b^2)+bc(b^2-c^2)+ca(c^2-a^2) \right|
\leq M( a^2+b^2+c^2 )^2 $
holds for all real numbers $a$, $b$ and $c$.

Solution:
It's the same as
$ \left| (a-b)(b-c)(c-a)(a+b+c) \right|
\le M ( a^2+b^2+c^2 )^2. $
Let $x=a-b$, $y=b-c$, $z=c-a$, $s=a+b+c$.
Then we want to have
$
\left| xyzs \right|
\le \frac{M}{9} (x^2+y^2+z^2+s^2)^2.
$
Here $x+y+z=0$.

Now if $x$ and $y$ have the same sign,
we can replace them with the average
(this increases the LHS and decreases RHS).
So we can have $x=y$, $z=-2x$.
Now WLOG $x > 0$ to get
$ 2x^3 \cdot s \le \frac{M}{9} ( 6x^2+s^2 )^2. $
After this routine calculation gives
$M = \frac{9}{32}\sqrt2$ works and is optimal
(by $6x^2+s^2 = 2x^2 + 2x^2 + 2x^2 + s^2$ and AM-GM).


Determine all pairs $(x,y)$ of integers such that
$ 1 + 2^x + 2^{2x+1} = y^2. $

Solution:
Answers: $(0, \pm 2)$, $(4, \pm 23)$, which work.

Assume $x \ge 4$.
$ 2^x ( 1 + 2^{x+1} )
= 2^x + 2^{2x+1} = y^2 - 1 = (y-1)(y+1). $
So either:

$y = 2^{x-1} m + 1$ for some odd $m$, so
$ 1 + 2^{x+1} = m( 2^{x-2}m+1 )
\implies 2^x = \frac{4(1-m)}{m^2-8}. $
$y = 2^{x-1} m - 1$ for some odd $m$, so
$ 1 + 2^{x+1} = m( 2^{x-2}m-1 )
\implies 2^x = \frac{4(1+m)}{m^2-8}. $

In particular we need $4|1 \pm m| \ge 2^4 |m^2-8|$,
which is enough to imply $m < 5$.
From here easily recover $x = 4$, $m = 3$ as the last solution
(in the second case).


Let $P(x)$ be a polynomial of degree $n > 1$
with integer coefficients and let $k$ be a positive integer.
Consider the polynomial
$ Q(x) = P(P(\dots P(P(x)) \dots )) $ where $P$ occurs $k$ times.
Prove that there are at most $n$ integers $t$ such that $Q(t) = t$.

Solution:
First, we prove that:

[Putnam 2000 et al]
If a number is periodic under $P$
then in fact it's fixed by $P \circ P$.

Let $x_1$, $x_2$, \dots, $x_n$ be a minimal orbit.
Then
$ x_i - x_{i+1} \mid P(x_i) - P(x_{i+1})
= x_{i+1} - x_{i+2} $
and so on cyclically.

If any of the quantities are zero we are done.
Else, we must eventually have $x_i - x_{i+1} = -(x_{i+1} - x_{i+2})$,
so $x_i = x_{i+2}$ and we get $2$-periodicity.

The tricky part is to study the $2$-orbits.
Suppose there exists a fixed pair $u \neq v$
with $P(u) = v$, $P(v) = u$.
(If no such pair exists, we are already done.)
Let $(a,b)$ be any other pair with $P(a) = b$, $P(b) = a$,
possibly even $a = b$, but $\{a,b\} \cap \{u,v\} = \varnothing$.
Then we should have
$ u-a \mid P(u)-P(a) = v-b
\mid P(v) - P(b) = u-a $
and so $u-a$ and $v-b$ divide each other (and are nonzero).
Similarly, $u-b$ and $v-a$ divide each other.

Hence $u-a = \pm (v-b)$ and $u-b = \pm (v-a)$.
We consider all four cases:

If $u-a = v-b$ and $u-b = v-a$
then $u-v = b-a = a-b$, contradiction.
If $u-a = -(v-b)$ and $u-b = -(v-a)$
then $u+v = u-v = a+b$.
If $u-a = -(v-b)$ and $u-b = v-a$,
we get $a+b = u+v$ from the first one
(discarding the second).
If $u-a = v-b$ and $u-b = -(v-a)$,
we get $a+b = u+v$ from the second one
(discarding the first one).

Thus in all possible situations we have
$ a+b = c \coloneq u+v $
a fixed constant.

Therefore, any pair $(a,b)$ with $P(a) = b$
and $P(b) = a$ actually satisfies $P(a) = c-a$.
And since $\deg P > 1$,
this means there are at most $n$ roots to $a+P(a)=c$, as needed.