# One more time

Algebra Level 5

$\large x_1x_3+\sum_{k=2}^{2015}x_kx_{k+1}$

Let $$M$$ denote the maximum value of the expression above, where $$x_1, x_2,\ldots, x_{2016}$$ are real numbers satisfying the condition $$\displaystyle \sum_{k=1}^{2016} x_k^2 = 1$$.

Given that $$M = \cos\left( \dfrac \pi n\right)$$ for some positive integer $$n$$, find $$n$$.

×