Problem

Source: Brazil EGMO TST1 2024 #4

Tags: number theory, Sequence, Perfect Squares



The infinite sequence \( a_1, a_2, \ldots \) is defined by \( a_1 = 1 \) and, for each \( n \geq 1 \), the number \( a_{n+1} \) is the smallest positive integer greater than \( a_n \) that has the following property: for each \( k \in \{1, 2, \ldots, n\} \), the number \( a_{n+1} + a_k \) is not a perfect square. Prove that, for all \( n \), it holds that \( a_n \leq (n - 1)^2 + 1 \).