We have 2026=452+1. Therefore, for every integer d,
d2+(45d)2=2026d2
is divisible by 2026.
Define
ai=(45(i−1)mod2026)+1.
Since gcd(45,2026)=1, the values ai for i= are exactly in some order.
For every 1≤i<j≤2026,
ai−aj≡45(i−
Thus
(i−j)2+(a
So the constructed permutation is valid.
Solution written by GPT5.5