$\newcommand\Legendre{\genfrac(){}{}}$Let $p\equiv 1\pmod 4$ be a prime number, and $x_{i}\ge 0$ be such that $$x_{1}+x_{2}+\dotsb+x_{p}=1.$$ Show that $$\sum_{1\le i<j\le p}\Legendre{i-j}{p}x_{i}x_{j}\le\dfrac{p-1}{2p+6}$$ Here $\Legendre\cdot\cdot$ is the Legendre symbol. This problem was encountered by a colleague of mine when he was writing a paper, and we couldn't prove this inequality. So I ask it. We found the constant in the right-hand side seems to be the best one because when $p = 5$ it can be reached: $$p=5,x_{1}=x_{2}=0.5,x_{3}=x_{4}=\dotsb=0.$$