TITLE: show that $a^2-1$ is a quadratic nonresidue mod $p$ if and only if $p\equiv 6\pmod 7$
QUESTION [7 upvotes]: Question: Let prime number $p>7$, for  positive integer $a,b,c$ such $1<a<b<c<p$, and
$$a+b+c\equiv a^3+b^3+c^3\equiv a^5+b^5+c^5\equiv\frac{p-1}{2}\pmod p$$
show that:
$a^2-1$ is a quadratic nonresidue mod $p$ if and only if $p\equiv 6\pmod 7$
I think following identity can work?

$$a^3+b^3+c^3=(a+b+c)^3-3(a+b)(b+c)(c+a)$$
  and
  $$a^5+b^5+c^5=(a+b+c)^5-5(a+b)(b+c)(c+a)(a^2+b^2+c^2+ab+bc+ac)$$

REPLY [5 votes]: Since $ab+bc+ac$ and $abc$ are rational fractions in $a+b+c,a^3+b^3+c^3,a^5+b^5+c^5$,
you can show that for $p \neq 2,3$, then $a,b,c$ satisfy these relations mod $p$ if and only if they are roots of a certain cubic equation.
(in fact, you get the equation $8a^3+4a^2-4a-1 = 0$) 
It turns out that over $\Bbb C$, its roots are $\cos(2\pi/7), \cos(4\pi/7), \cos(6\pi/7)$, so the Galois group of the cubic is cyclic, and we know how it factors mod $p$ according to $p$ mod $7$ :   
If $p \neq 7$, the cubic has $3$ roots mod $p$ iff $p \equiv \pm 1 \pmod 7$, and it has no root otherwise.
Moreover, $a^2-1 = \cos(2\pi/7)^2-1 = - \sin(2\pi/7)^2 = (i\sin(2\pi/7))^2$, so this has a square root $a'$ if and only if there is a $7$th root of unity $a+a' = \exp(2i\pi/7)$ if and only if $p \equiv 1 \pmod 7$.
Thus, the cubic splits and $a^2-1$ is a not square mod $p$ if and only if $p \equiv 6 \pmod 7$.