Problem

Source: Brazil EGMO TST1 2024 #4

Tags: number theory, Sequence, Perfect Squares



The infinite sequence a1,a2, is defined by a1=1 and, for each n1, the number an+1 is the smallest positive integer greater than an that has the following property: for each k{1,2,,n}, the number an+1+ak is not a perfect square. Prove that, for all n, it holds that an(n1)2+1.