2024 IMO Problems/Problem 3
Let be an infinite sequence of positive integers, and let be a positive integer. Suppose that, for each , is equal to the number of times appears in the list .
Prove that at least one of the sequence and is eventually periodic.
(An infinite sequence is eventually periodic if there exist positive integers and such that for all .)