Problem

Source: Australia MO 2024 P5

Tags: number theory



The sequence of positive integers $a_1, a_2, \ldots, a_{2025}$ is defined as follows: $a_1=2^{2024}+1$ and $a_{n+1}$ is the greatest prime factor of $a_n^2-1$ for $1 \leq n \leq 2024$. Find the value of $a_{2024}+a_{2025}$.