Find all four digit positive integers such that the sum of the squares of the digits equals twice the sum of the digits.
2023 Mexico National Olympiad
Day 1
The numbers from $1$ to $2000$ are placed on the vertices of a regular polygon with $2000$ sides, one on each vertex, so that the following is true: If four integers $A, B, C, D$ satisfy that $1 \leq A<B<C<D \leq 2000$, then the segment that joins the vertices of the numbers $A$ and $B$ and the segment that joins the vertices of $C$ and $D$ do not intersect inside the polygon. Prove that there exists a perfect square such that the number diametrically opposite to it is not a perfect square.
Let $ABCD$ be a convex quadrilateral. If $M, N, K$ are the midpoints of the segments $AB, BC$, and $CD$, respectively, and there is also a point $P$ inside the quadrilateral $ABCD$ such that, $\angle BPN= \angle PAD$ and $\angle CPN=\angle PDA$. Show that $AB \cdot CD=4PM\cdot PK$.
Day 2
Let $n \ge 2$ be a positive integer. For every number from $1$ to $n$, there is a card with this number and which is either black or white. A magician can repeatedly perform the following move: For any two tiles with different number and different colour, he can replace the card with the smaller number by one identical to the other card. For instance, when $n=5$ and the initial configuration is $(1B, 2B, 3W, 4B,5B)$, the magician can choose $1B, 3W$ on the first move to obtain $(3W, 2B, 3W, 4B, 5B)$ and then $3W, 4B$ on the second move to obtain $(4B, 2B, 3W, 4B, 5B)$. Determine in terms of $n$ all possible lengths of sequences of moves from any possible initial configuration to any configuration in which no more move is possible.
Let $ABC$ be an acute triangle, $\Gamma$ is its circumcircle and $O$ is its circumcenter. Let $F$ be the point on $AC$ such that the $\angle COF=\angle ACB$, such that $F$ and $B$ lie in opposite sides with respect to $CO$. The line $FO$ cuts $BC$ at $G$. The line parallel to $BC$ through $A$ intersects $\Gamma$ again at $M$. The lines $CO$ and $MG$ meet at $K$. Show that the circumcircles of the triangles $BGK$ and $AOK$ meet on $AB$.
Find all functions $f: \mathbb{N} \rightarrow \mathbb {N}$ such that for all positive integers $m, n$, $f(m+n)\mid f(m)+f(n)$ and $f(m)f(n) \mid f(mn)$.