Garkovv S.B.

The sequence $\left(a_{n}\right)$ is such that $a_{n}=n^{2}$ for $1 \leq n \leq 5$ and for all natural $n$ the equality $a_{n+5} + a_{n+1} = a_{n+4} + a_{n}$ holds. Find $a_{2015}$.
$a_{n+4}+a_{n}=a_{n+3}+a_{n-1}=\ldots=a_{5}+a_{1}=25+1=26$. Therefore, $a_{n}=26-a_{n+4}=26-\left(26-a_{n+8}\right)=a_{n+8}$, which means the sequence $\left(a_{n}\right)$ is periodic with a period of 8. Since the remainder of 2015 divided by 8 is 7, $a_{2015}=a_{7}=26-a_{3}=17$