Product of quadratic residues in terms of primitive root Let $a$ be a primitive root for prime $p(\geq 3)$. Show that the product of all non-zero quadratic residues is
congruent to $a^\frac{p^2−1}{4}$ and that the product of quadratic nonresidues is congruent to $a^\frac{(p−1)^2}{4}$ modulo $p$.    
I know that the product of the non-zero residues is $(1^2).(2^2)...((p-1)/2)^2$, and that every number from $1, 2, ... p-1$ can be written as $a, a^2, a^3, ..., a^{p-1}$, if $a$ is a primitive root. I think I'm just missing one link to convert the product of some form of powers of $a$ to the final answer
 A: The missing link: If $a$ is a primitive root, then the squares are exactly $a^2, a^4, a^6, \ldots, a^{2n}, \ldots a^{p-1}$.
A: Hint: If $a$ is a primitive root mod $p$, $p$ is an odd prime, then all the non-zero quadratic residues mod $p$ are exactly $a^2,a^4,\ldots,a^{p-1}$.
Proof: $a$ is not a quadratic residue because if $a\equiv b^2\pmod{p}$, then by Fermat's little theorem $a^{\frac{p-1}{2}}\equiv b^{p-1}\equiv 1 \pmod {p}$, contradiction. $a^{2k}\equiv (a^k)^2\pmod{p}$. If $a^{2k+1}\equiv c^2\pmod{p}$, then $a\equiv (c\cdot a^{-k})^2\pmod{p}$, contradiction.
Edit: here's another proof. $x^2\equiv y^2\pmod p$ $\iff p\mid x^2-y^2$ $=(x-y)(x+y)$ and by Euclid's lemma $\iff (x\equiv y\pmod p$ or $x\equiv -y\pmod p)$. So there are exactly $\frac{p-1}{2}$ non-zero quadratic residues mod $p$ and they are $(\pm 1)^2, (\pm 2)^2,\ldots$ $, \left(\pm \frac{p-1}{2}\right)^2$ mod $p$. If $a^{2i}\equiv a^{2j}\pmod p$, $i> j$, $i,j\in\{1,2,\ldots, \frac{p-1}{2}\}$, then $a^{2(i-j)}\equiv 1\pmod p$, contradiction. $a^{2k}\equiv (a^k)^2\pmod p$. There are $\frac{p-1}{2}$ different non-zero quadratic residues in the list $a^2, a^4,\ldots, a^{p-1}$.
