On a circle are placed nonnegative real numbers
$$\nwith indices taken modulo $n$ (so $x_{n+1}=x_1$, $x_{n+2}=x_2$, etc.).\nThey satisfy the local constraint $$\nx_i + x_{i+1} + x_{i+2} \le 1 \qquad\text{for all } i=1,2,\dots,n.\nFor such a configuration define
$$\nLet $M_n$ be the maximal possible value of $S$ over all admissible configurations $(x_1,\dots,x_n)$ satisfying the above condition. \nIt can be shown that for each positive integer $n$, the maximum $M_n$ is a rational number.\nFor the specific case $n=2026$, write $$\nM_{2026} \;=\; \frac{p}{q} $$\nin lowest terms, where $p$ and $q$ are coprime positive integers. \nDetermine the integer $p+q$.[THOUGHT] To solve the problem, we need to maximize the sum under the constraint that for all , with indices taken modulo . For even , a two-periodic pattern where variables alternate between and is optimal. This pattern satisfies the constraints and . The sum becomes . The maximum value of under these constraints is , achieved when and (or vice versa). Thus, .
For , the maximum value . Since 1013 is a prime number, the fraction is in lowest terms. Therefore, and , giving . [/THOUGHT]
[PYTHON]
Verify the calculation for n=2026
n = 2026 p = n // 2 # Since 2026 / 8 = 1013 / 4, p=1013, q=4 q = 4
Check if 1013 and 4 are coprime
from math import gcd assert gcd(p, q) == 1, "p and q are not coprime" print(p + q) [/PYTHON]
[THOUGHT] The Python code confirms that and are coprime, leading to . This matches the derived result for . [/THOUGHT]