Source: IMO-2024-P3
Category: Extremal Problems

Problem:
Let $a_1,a_2,a_3,\dots$ be an infinite sequence of positive integers, and let $N$ be a positive integer. Suppose that, for each $n>N$, the number $a_n$ is equal to the number of times $a_{n-1}$ appears in the list $(a_1,a_2,\dots,a_{n-1})$. Prove that at least one of the sequences $a_1,a_3,a_5,\dots$ and $a_2,a_4,a_6,\dots$ is eventually periodic.

Solution:
Let $M=\max(a_1,\dots,a_N)$. We can organize the process by building towers: when the term $a_i$ appears, place a block $B_i$ on top of tower $a_i$. For $i>N$, the sequence rule states that if $B_i$ is added to tower $a_i$, then the next block $B_{i+1}$ is added to the tower whose index equals the height reached by tower $a_i$.

We first establish two basic structural facts.

1. If tower $k+1$ grows arbitrarily high, then tower $k$ also grows arbitrarily high. In fact, there is a constant $C$ such that at every time,
\[
h_k \ge h_{k+1}-C,
\]
where $h_j$ denotes the current height of tower $j$. This holds because almost every sufficiently high block in tower $k+1$ can be traced back injectively to a block in tower $k$.

2. If $a_n>M$, then $a_{n+1}\le M$. Otherwise, there would be a first moment when two consecutive terms both exceed $M$. This would force more than $M$ towers to have height greater than $M$ before that time, which is impossible by the minimality of the first such moment.

From the second fact, terms at most $M$ occur with density at least $1/2$, so some values occur infinitely often. Let $L$ be the largest index such that towers $1,2,\dots,L$ are unbounded, while towers $L+1,\dots,M$ are eventually frozen. After some time $N'>N$, we may assume that:
- towers $1$ through $L$ are already very tall;
- towers $L+1$ through $M$ will never receive another block;
- $a_{N'}\le L$.

From that point onward, the terms alternate between small and big: if $n\equiv N' \pmod 2$, then $a_n\le L$, while if $n\equiv N'+1 \pmod 2$, then $a_n>M$. Thus, one parity subsequence consists of all the small terms.

Consider only indices $n\equiv N' \pmod 2$. At such a time, define the state
\[
S(n)=(h_1,h_2,\dots,h_L; a_n).
\]
The next two steps are completely determined by this state: the intermediate large term is the height of the tower just hit, and the following small term is the number of towers among $1,\dots,L$ whose heights are at least that large. Thus, $S(n+2)$ depends only on $S(n)$.

Because only relative heights matter, it is enough to replace $S(n)$ by
\[
T(n)=(h_1-h_2, h_2-h_3, \dots, h_{L-1}-h_L; a_n).
\]
Using the first structural fact repeatedly, one obtains upper bounds for these differences. A second contradiction argument gives lower bounds as well: for every $1\le \ell<L$, there is a uniform bound
\[
h_\ell \le h_{\ell+1}+C(L-1).
\]
Hence, each coordinate of $T(n)$ is bounded, so $T(n)$ takes only finitely many values. Since the transition $T(n)\mapsto T(n+2)$ is deterministic, the sequence $T(n)$ is eventually periodic. Therefore, the subsequence $a_{N'},a_{N'+2},a_{N'+4},\dots$ is eventually periodic.

Consequently, at least one of the two parity subsequences $a_1,a_3,a_5,\dots$ and $a_2,a_4,a_6,\dots$ is eventually periodic, as required.

Answer: At least one of the two subsequences $a_1,a_3,a_5,\dots$ or $a_2,a_4,a_6,\dots$ is eventually periodic

Grading guidelines:
(Partial) 1. Proved that if some value >M:=max(a1,…,aN) occurs at position n, then an adjacent term must be ≤M (e.g. established a statement of the form: there cannot be a first time when both an and a_{n+1} exceed M). 2. Showed that at least one integer occurs infinitely often (for instance, deduced from the previous item that terms ≤M occur infinitely often / with density ≥1/2, hence by pigeonhole some value repeats infinitely many times). 3. Introduced a meaningful global organizing structure (e.g. “towers/blocks” where tower k counts occurrences of k) and proved at least one nontrivial monotonicity/comparison fact between towers (such as: unboundedness of tower k+1 forces unboundedness of tower k, or a uniform bound h_k ≥ h_{k+1}−C). (Almost) 1. Reduced to a late stage N′ where the set of “unbounded small values” is {1,…,L} and values >L never reappear among ≤M, and correctly deduced the alternation pattern from that point: one parity consists entirely of terms ≤L and the other parity consists entirely of terms >M, but did not finish the periodicity-from-finite-states step. 2. Defined a correct finite state (e.g. T(n) built from bounded height differences and the current small term) and proved that T(n+2) is a deterministic function of T(n), and that the coordinates of T(n) are bounded so only finitely many states occur, but left a localized gap in bounding the differences or in justifying that only relative heights matter. 3. Completed the argument that the deterministic finite-state evolution forces eventual periodicity of one parity subsequence, but omitted/garbled one boundary case (e.g. L=1, or the justification that towers L+1,…,M are eventually frozen) or made a small but non-negligible logical slip near the end.