For each positive integer $n$, let $s(n)$ be the sum of the squares of the digits of $n$. For example, $s(15)=1^2+5^2=26$. Determine all integers $n\geq 1$ such that $s(n)=n$.
2019 IberoAmerican
Day 1
Determine all polynomials $P(x)$ with degree $n\geq 1$ and integer coefficients so that for every real number $x$ the following condition is satisfied $$P(x)=(x-P(0))(x-P(1))(x-P(2))\cdots (x-P(n-1))$$
Let $\Gamma$ be the circumcircle of triangle $ABC$. The line parallel to $AC$ passing through $B$ meets $\Gamma$ at $D$ ($D\neq B$), and the line parallel to $AB$ passing through $C$ intersects $\Gamma$ to $E$ ($E\neq C$). Lines $AB$ and $CD$ meet at $P$, and lines $AC$ and $BE$ meet at $Q$. Let $M$ be the midpoint of $DE$. Line $AM$ meets $\Gamma$ at $Y$ ($Y\neq A$) and line $PQ$ at $J$. Line $PQ$ intersects the circumcircle of triangle $BCJ$ at $Z$ ($Z\neq J$). If lines $BQ$ and $CP$ meet each other at $X$, show that $X$ lies on the line $YZ$.
Day 2
Let $ABCD$ be a trapezoid with $AB\parallel CD$ and inscribed in a circumference $\Gamma$. Let $P$ and $Q$ be two points on segment $AB$ ($A$, $P$, $Q$, $B$ appear in that order and are distinct) such that $AP=QB$. Let $E$ and $F$ be the second intersection points of lines $CP$ and $CQ$ with $\Gamma$, respectively. Lines $AB$ and $EF$ intersect at $G$. Prove that line $DG$ is tangent to $\Gamma$.
Don Miguel places a token in one of the $(n+1)^2$ vertices determined by an $n \times n$ board. A move consists of moving the token from the vertex on which it is placed to an adjacent vertex which is at most $\sqrt2$ away, as long as it stays on the board. A path is a sequence of moves such that the token was in each one of the $(n+1)^2$ vertices exactly once. What is the maximum number of diagonal moves (those of length $\sqrt2$) that a path can have in total?
Let $a_1, a_2, \dots, a_{2019}$ be positive integers and $P$ a polynomial with integer coefficients such that, for every positive integer $n$, $$P(n) \text{ divides } a_1^n+a_2^n+\dots+a_{2019}^n.$$Prove that $P$ is a constant polynomial.