problem: A function $f: \mathbb{N} \rightarrow \mathbb{N}$ satisfies  $$ \underbrace{f(f(\ldots f}_{f(n) \text { times }}(n) \ldots))=\frac{n^{2}}{f(f(n))} $$  for all positive integers $n$. What are all possible values of $f(1000)$ ?

solution: Actually, we classify all such functions: $f$ can be any function which fixes odd integers and acts as an involution on the even integers. In particular, $f(1000)$ may be any even integer.  It's easy to check that these all work, so now we check they are the only solutions. Claim - $f$ is injective.   Claim - $f$ fixes the odd integers.  Assume $f$ fixes $S=\{1,3, \ldots, n-2\}$ now (allowing $S=\varnothing$ for $n=1$ ). Now we have that  $$ f^{f(n)}(n) \cdot f^{2}(n)=n^{2} . $$  However, neither of the two factors on the left-hand side can be in $S$ since $f$ was injective. Therefore they must both be $n$, and we have $f^{2}(n)=n$.  Now let $y=f(n)$, so $f(y)=n$. Substituting $y$ into the given yields  $$ y^{2}=f^{n}(y) \cdot y=f^{n+1}(n) \cdot y=n y $$  since $n+1$ is even. We conclude $n=y$, as desired.  Remark (Motivation). After obtaining $f(1)=1$ and $f$ injective, here is one way to motivate where the above proof comes from. From the equation  $$ f^{f(n)}(n) \cdot f^{2}(n)=n^{2} $$  it would be natural to consider the case where $n$ is prime, because $p^{2}$ only has a few possible factorizations. In fact, actually because of injectivity and $f(1)=1$, we would need to have  $$ f^{f(p)}(p)=f^{2}(p)=p $$  in order for the equation to be true. Continuing on as in the proof above, one then gets $f(p)=p$ for odd primes $p$ (but no control over $f(2)$ ).  The special case of prime $n$ then serves as a foothold by which one can continue the induction towards all numbers $n$, finding the induction works out exactly when the prime 2 never appears.  As a general point, in mathematical problem-solving, one often needs to be willing to try out a proof idea or strategy and then retroactively determine what hypothesis is needed, rather than hoping one will always happen to guess exactly the right claim first. In other words, it may happen that one begins working out a proof of a claim before knowing exactly what the claim will turn out to say, and this is the case here (despite the fact the proof strategy uses induction).  Thus, $f$ maps even integers to even integers. In light of this, we may let $g:=f(f(n))$ (which is also injective), so we conclude that  $$ g^{f(n) / 2}(n) g(n)=n^{2} \quad \text { for } n=2,4, \ldots $$  Claim - The function $g$ is the identity function.   $$ g^{f(n) / 2}(n) \cdot g(n)=n^{2} $$  neither of the two factors may be less than $n$. So they must both be $n$. Remark. The last claim is not necessary to solve the problem; after realizing $f$ and injective fixes the odd integers, this answers the question about the values of $f(1000)$. However, we chose to present the "full" solution anyways.  Remark. After noting $f$ is injective, another approach is outlined below. Starting from any $n$, consider the sequence  $$ n, f(n), f(f(n)) $$  and so on. We may let $m$ be the smallest term of the sequence; then $m^{2}=f(f(m)) \cdot f^{f(m)}(m)$ which forces $f(f(m))=f^{f(m)}(m)=m$ by minimality. Thus the sequence is 2 -periodic. Therefore, $f(f(n))=n$ always holds, which is enough to finish. \ Authorship comments. I will tell you a great story about this problem. Two days before the start of grading of USAMO 2017, I had a dream that I was grading a functional equation. When I woke up, I wrote it down, and it was  $$ f^{f(n)}(n)=\frac{n^{2}}{f(f(n))} $$  You can guess the rest of the story (and imagine how surprised I was the solution set was interesting). I guess some dreams do come true, huh?


problem: Let $A B C D$ be a cyclic quadrilateral satisfying $A D^{2}+B C^{2}=A B^{2}$. The diagonals of $A B C D$ intersect at $E$. Let $P$ be a point on side $\overline{A B}$ satisfying $\angle A P D=\angle B P C$. Show that line $P E$ bisects $\overline{C D}$.

solution: 【 First solution using symmedians. We define point $P$ to obey  $$ \frac{A P}{B P}=\frac{A D^{2}}{B C^{2}}=\frac{A E^{2}}{B E^{2}} $$  so that $\overline{P E}$ is the $E$-symmedian of $\triangle E A B$, therefore the $E$-median of $\triangle E C D$. Now, note that  $$ A D^{2}=A P \cdot A B \quad \text { and } \quad B C^{2}=B P \cdot B A $$  This implies $\triangle A P D \sim \triangle A D B$ and $\triangle B P C \sim \triangle B C A$. Thus  $$ \measuredangle D P A=\measuredangle A D B=\measuredangle A C B=\measuredangle B C P $$  and so $P$ satisfies the condition as in the statement (and is the unique point to do so), as needed.


solution: 【 Second solution using only angle chasing (by proposer). We again re-define $P$ to obey $A D^{2}=A P \cdot A B$ and $B C^{2}=B P \cdot B A$. As before, this gives $\triangle A P D \sim \triangle A B D$ and $\triangle B P C \sim \triangle B D P$ and so we let  $$ \theta:=\measuredangle D P A=\measuredangle A D B=\measuredangle A C B=\measuredangle B C P . $$  Our goal is to now show $\overline{P E}$ bisects $\overline{C D}$. Let $K=\overline{A C} \cap \overline{P D}$ and $L=\overline{A D} \cap \overline{P C}$. Since $\measuredangle K P A=\theta=\measuredangle A C B$, quadrilateral $B P K C$ is cyclic. Similarly, so is $A P L D$. ![](https://cdn.mathpix.com/cropped/2024_11_19_dab316fe5a4e03dd61cdg-06.jpg?height=804&width=798&top_left_y=249&top_left_x=635)  Finally $A K L B$ is cyclic since  $$ \measuredangle B K A=\measuredangle B K C=\measuredangle B P C=\theta=\measuredangle D P A=\measuredangle D L A=\measuredangle B L A . $$  This implies $\measuredangle C K L=\measuredangle L B A=\measuredangle D C K$, so $\overline{K L} \| \overline{B C}$. Then $P E$ bisects $\overline{B C}$ by Ceva's theorem on $\triangle P C D$.


solution: 【 Third solution (using inversion). By hypothesis, the circle $\omega_{a}$ centered at $A$ with radius $A D$ is orthogonal to the circle $\omega_{b}$ centered at $B$ with radius $B C$. For brevity, we let $\mathbf{I}_{a}$ and $\mathbf{I}_{b}$ denote inversion with respect to $\omega_{a}$ and $\omega_{b}$.  We let $P$ denote the intersection of $\overline{A B}$ with the radical axis of $\omega_{a}$ and $\omega_{b}$; hence $P=\mathbf{I}_{a}(B)=\mathbf{I}_{b}(A)$. This already implies that  $$ \measuredangle D P A \stackrel{\mathbf{I}_{a}}{=} \measuredangle A D B=\measuredangle A C B \stackrel{\mathbf{I}_{b}}{=} \measuredangle B P C $$  so $P$ satisfies the angle condition. ![](https://cdn.mathpix.com/cropped/2024_11_19_dab316fe5a4e03dd61cdg-06.jpg?height=732&width=1014&top_left_y=1844&top_left_x=521)  Claim - The point $K=\mathbf{I}_{a}(C)$ lies on $\omega_{b}$ and $\overline{D P}$. Similarly $L=\mathbf{I}_{b}(D)$ lies on $\omega_{a}$ and $\overline{C P}$.   Finally, since $C, L, P$ are collinear, we get $A$ is concyclic with $K=\mathbf{I}_{a}(C), L=\mathbf{I}_{a}(L)$, $B=\mathbf{I}_{a}(P)$, i.e. that $A K L B$ is cyclic. So $\overline{K L} \| \overline{C D}$ by Reim's theorem, and hence $\overline{P E}$ bisects $\overline{C D}$ by Ceva's theorem.


problem: Let $K$ be the set of positive integers not containing the decimal digit 7. Determine all polynomials $f(x)$ with nonnegative coefficients such that $f(x) \in K$ for all $x \in K$.

solution: The answer is only the obvious ones: $f(x)=10^{e} x, f(x)=k$, and $f(x)=10^{e} x+k$, for any choice of $k \in K$ and $e>\log _{10} k$ (with $e \geq 0$ ).  Now assume $f$ satisfies $f(K) \subseteq K$; such polynomials will be called stable. We first prove the following claim which reduces the problem to the study of monomials.  Lemma (Reduction to monomials) If $f(x)=a_{0}+a_{1} x+a_{2} x^{2}+\ldots$ is stable, then each monomial $a_{0}, a_{1} x, a_{2} x^{2}, \ldots$ is stable.   Let's tackle the linear case next. Here is an ugly but economical proof. Claim (Linear classification) - If $f(x)=c x$ is stable, then $c=10^{e}$ for some nonnegative integer $e$.   - For $9 \cdot 10^{e} \leq c<10 \cdot 10^{e}$, pick $x=8$. - For $8 \cdot 10^{e} \leq c<9 \cdot 10^{e}$, pick $x=88$. - For $7 \cdot 10^{e} \leq c<8 \cdot 10^{e}$, pick $x=1$. - For $4.4 \cdot 10^{e} \leq c<7 \cdot 10^{e}$, pick $11 \leq x \leq 16$. - For $2.7 \cdot 10^{e} \leq c<4.4 \cdot 10^{e}$, pick $18 \leq x \leq 26$. - For $2 \cdot 10^{e} \leq c<2.7 \cdot 10^{e}$, pick $28 \leq x \leq 36$. - For $1.6 \cdot 10^{e} \leq c<2 \cdot 10^{e}$, pick $38 \leq x \leq 46$. - For $1.3 \cdot 10^{e} \leq c<1.6 \cdot 10^{e}$, pick $48 \leq x \leq 56$. - For $1.1 \cdot 10^{e} \leq c<1.3 \cdot 10^{e}$, pick $58 \leq x \leq 66$. - For $1 \cdot 10^{e} \leq c<1.1 \cdot 10^{e}$, pick $x=699 \ldots 9$ for suitably many 9 's.  The hardest part of the problem is the case where $\operatorname{deg} f>1$. We claim that no solutions exist then:  Claim (Higher-degree classification) - No monomial of the form $f(x)=c x^{d}$ is stable for any $d>1$.   $$ f(10 x+3)=3^{d}+10 d \cdot 3^{d-1} x+100\binom{d}{2} \cdot 3^{d-1} x^{2}+\ldots $$  is stable. By applying the lemma the linear monomial $10 d \cdot 3^{d-1} x$ is stable, so $10 d \cdot 3^{d-1}$ is a power of 10 , which can only happen if $d=1$.  Thus the only nonconstant stable polynomials with nonnegative coefficients must be of the form $f(x)=10^{e} x+k$ for $e \geq 0$. It is straightforward to show we then need $k<10^{e}$ and this finishes the proof.


problem: Let $n$ be a nonnegative integer. Determine the number of ways to choose sets $S_{i j} \subseteq\{1,2, \ldots, 2 n\}$, for all $0 \leq i \leq n$ and $0 \leq j \leq n$ (not necessarily distinct), such that  - $\left|S_{i j}\right|=i+j$, and - $S_{i j} \subseteq S_{k l}$ if $0 \leq i \leq k \leq n$ and $0 \leq j \leq l \leq n$.

solution: The answer is $(2 n)!\cdot 2^{n^{2}}$. First, we note that $\varnothing=S_{00} \subsetneq S_{01} \subsetneq \cdots \subsetneq S_{n n}=\{1, \ldots, 2 n\}$ and thus multiplying by (2n)! we may as well assume $S_{0 i}=\{1, \ldots, i\}$ and $S_{i n}=\{1, \ldots, n+i\}$. We illustrate this situation by placing the sets in a grid, as below for $n=4$; our goal is to fill in the rest of the grid. $\left[\begin{array}{ccccc}1234 & 12345 & 123456 & 1234567 & 12345678 \\ 123 & & & & \\ 12 & & & & \\ 1 & & & & \\ \varnothing & & & & \end{array}\right]$  We claim the number of ways to do so is $2^{n^{2}}$. In fact, more strongly even the partial fillings are given exactly by powers of 2 .  Claim - Fix a choice $T$ of cells we wish to fill in, such that whenever a cell is in $T$, so are all the cells above and left of it. (In other words, $T$ is a Young tableau.) The number of ways to fill in these cells with sets satisfying the inclusion conditions is $2^{|T|}$ 。  An example is shown below, with an indeterminate set marked in red (and the rest of $T$ marked in blue). $\left[\begin{array}{ccccc}1234 & 12345 & 123456 & 1234567 & 12345678 \\ 123 & 1234 & 12346 & 123467 & \\ 12 & 124 & 1234 \text { or } 1246 & & \\ 1 & 12 & & & \\ \varnothing & 2 & & & \end{array}\right]$  Now suppose we have a corner $\left[\begin{array}{ll}B & C \\ A & S\end{array}\right]$ where $A, B, C$ are fixed and $S$ is to be chosen. Then we may write $B=A \cup\{x\}$ and $C=A \cup\{x, y\}$ for $x, y \notin A$. Then the two choices of $S$ are $A \cup\{x\}$ (i.e. $B$ ) and $A \cup\{y\}$, and both of them are seen to be valid.  In this way, we gain a factor of 2 any time we add one cell as above to $T$. Since we can achieve any Young tableau in this way, the induction is complete.


problem: Let $m$ and $n$ be relatively prime positive integers. The numbers $\frac{m}{n}$ and $\frac{n}{m}$ are written on a blackboard. At any point, Evan may pick two of the numbers $x$ and $y$ written on the board and write either their arithmetic mean $\frac{1}{2}(x+y)$ or their harmonic mean $\frac{2 x y}{x+y}$. For which $(m, n)$ can Evan write 1 on the board in finitely many steps?

solution: We claim this is possible if and only $m+n$ is a power of 2 . Let $q=m / n$, so the numbers on the board are $q$ and $1 / q$. \I Impossibility. The main idea is the following. Claim - Suppose $p$ is an odd prime. Then if the initial numbers on the board are $-1(\bmod p)$, then all numbers on the board are $-1(\bmod p)$.   Thus if there exists any odd prime divisor $p$ of $m+n$ (implying $p \nmid m n$ ), then  $$ q \equiv \frac{1}{q} \equiv-1 \quad(\bmod p) . $$  and hence all numbers will be $-1(\bmod p)$ forever. This implies that it's impossible to write 1 , whenever $m+n$ is divisible by some odd prime.  【 Construction. Conversely, suppose $m+n$ is a power of 2 . We will actually construct 1 without even using the harmonic mean. ![](https://cdn.mathpix.com/cropped/2024_11_19_dab316fe5a4e03dd61cdg-11.jpg?height=152&width=1004&top_left_y=1786&top_left_x=526)  Note that  $$ \frac{n}{m+n} \cdot q+\frac{m}{m+n} \cdot \frac{1}{q}=1 $$  and obviously by taking appropriate midpoints (in a binary fashion) we can achieve this using arithmetic mean alone.


problem: Find all polynomials $P$ with real coefficients such that  $$ \frac{P(x)}{y z}+\frac{P(y)}{z x}+\frac{P(z)}{x y}=P(x-y)+P(y-z)+P(z-x) $$  for all nonzero real numbers $x, y, z$ obeying $2 x y z=x+y+z$.

solution: The given can be rewritten as saying that  $$ \begin{aligned} Q(x, y, z) & :=x P(x)+y P(y)+z P(z) \\ & -x y z(P(x-y)+P(y-z)+P(z-x)) \end{aligned} $$  is a polynomial vanishing whenever $x y z \neq 0$ and $2 x y z=x+y+z$, for real numbers $x, y$, $z$.  Claim - This means $Q(x, y, z)$ vanishes also for any complex numbers $x, y, z$ obeying $2 x y z=x+y+z$.   $$ R(x, y):=Q\left(x, y, \frac{x+y}{2 x y-1}\right) $$  vanishes for any real numbers $x$ and $y$ such that $x y \neq \frac{1}{2}, x \neq 0, y \neq 0, x+y \neq 0$. This can only occur if $R$ is identically zero as a rational function with real coefficients. If we then regard $R$ as having complex coefficients, the conclusion then follows.  Remark (Algebraic geometry digression on real dimension). Note here we use in an essential way that $z$ can be solved for in terms of $x$ and $y$. If $s(x, y, z)=2 x y z-(x+y+z)$ is replaced with some general condition, the result may become false; e.g. we would certainly not expect the result to hold when $s(x, y, z)=x^{2}+y^{2}+z^{2}-(x y+y z+z x)$ since for real numbers $s=0$ only when $x=y=z$ !  The general condition we need here is that $s(x, y, z)=0$ should have "real dimension two". Here is a proof using this language, in our situation.  Let $M \subset \mathbb{R}^{3}$ be the surface $s=0$. We first contend $M$ is two-dimensional manifold. Indeed, the gradient $\nabla s=\langle 2 y z-1,2 z x-1,2 x y-1\rangle$ vanishes only at the points $( \pm 1 / \sqrt{2}, \pm 1 / \sqrt{2}, \pm 1 / \sqrt{2}$ ) where the $\pm$ signs are all taken to be the same. These points do not lie on $M$, so the result follows by the regular value theorem. In particular the topological closure of points on $M$ with $x y z \neq 0$ is all of $M$ itself; so $Q$ vanishes on all of $M$.  If we now identify $M$ with the semi-algebraic set consisting of maximal ideals ( $x-a, y-$ $b, z-c)$ in Spec $\mathbb{R}[x, y, z]$ satisfying $2 a b c=a+b+c$, then we have real dimension two, and thus the Zariski closure of $M$ is a two-dimensional closed subset of $\operatorname{Spec} \mathbb{R}[x, y, z]$. Thus it must be $Z=\mathcal{V}(2 x y z-(x+y+z))$, since this $Z$ is an irreducible two-dimensional closed subset (say, by Krull's principal ideal theorem) containing $M$. Now $Q$ is a global section vanishing on all of $Z$, therefore $Q$ is contained in the (radical, principal) ideal $(2 x y z-(x+y+z))$ as needed. So it is actually divisible by $2 x y z-(x+y+z)$ as desired.  Now we regard $P$ and $Q$ as complex polynomials instead. First, note that substituting $(x, y, z)=(t,-t, 0)$ implies $P$ is even. We then substitute  $$ (x, y, z)=\left(x, \frac{i}{\sqrt{2}}, \frac{-i}{\sqrt{2}}\right) $$  to get  $$ \begin{aligned} & x P(x)+\frac{i}{\sqrt{2}}\left(P\left(\frac{i}{\sqrt{2}}\right)-P\left(\frac{-i}{\sqrt{2}}\right)\right) \\ = & \frac{1}{2} x(P(x-i / \sqrt{2})+P(x+i / \sqrt{2})+P(\sqrt{2} i)) \end{aligned} $$  which in particular implies that  $$ P\left(x+\frac{i}{\sqrt{2}}\right)+P\left(x-\frac{i}{\sqrt{2}}\right)-2 P(x) \equiv P(\sqrt{2} i) $$  identically in $x$. The left-hand side is a second-order finite difference in $x$ (up to scaling the argument), and the right-hand side is constant, so this implies $\operatorname{deg} P \leq 2$.  Since $P$ is even and $\operatorname{deg} P \leq 2$, we must have $P(x)=c x^{2}+d$ for some real numbers $c$ and $d$. A quick check now gives the answer $P(x)=c\left(x^{2}+3\right)$ which all work.