How to evaluate $ \prod_{1\le i While doing my research on elementary number theory, I came across the following problem which I cannot overcome: Let $p$ be an odd prime, $g$ be any primitive of $p$. Define
$$f(p)=\prod_{1\le i <j\le\frac{p-1}{2}}j^2-i^2\pmod p$$ and
$$h(p,g)=\prod_{1\le i <j\le\frac{p-1}{2}}g^{2j}-g^{2i} \pmod p .$$  What I want to know is the relationship between $f(p)$ and $h(p,g)$. I calculated the first one hundred primes and find that either $f(p)+h(p,g)=p $ or $f(p)=h(p,g) $.  For example $f(17)=4 $ , $h(17,5)=13 $ and $f(73)=h(73,11)=46 $.  I believe that this is true for all primes $p$ and all primitives $g$.
Now my questions are :

*

*Does it true that we always have $f(p)+h(p,g)=p $ or $f(p)=h(p,g) $


*Is it possible to evaluate $f(p)$ and $h(p,g)$ and find the condition when does $f(p)+h(p,g)=p $ and $f(p)=h(p,g) $
I am eager to know any answer, link, or hints to this problem, thank you!!
 A: I presume you are doing the calculations modulo $p$. In the first case
the admissible $i^2$ are the quadratic residues modulo $p$.
In the second case
the admissible $g_{2i}$ are also the quadratic residues modulo $p$.
Both products have the form $\prod_{1\le i<j\le m}(a_j-a_i)$
where $a_1,\ldots,a_m$ ($m=\frac12(p-1)$) are the distinct quadratic
residues modulo $p$. But the ordering of the $a_i$ differs. If
the first product is $\prod_{1\le i<j\le m}(a_j-a_i)$
and the second is $\prod_{1\le i<j\le m}(b_j-b_i)$, then
$b_j=a_{\tau(j)}$ for some permutation $\tau\in S_m$ and then
$\prod_{1\le i<j\le m}(b_j-b_i)=\text{sgn}(\tau)
\prod_{1\le i<j\le m}(a_j-a_i)$ (at least modulo $p$).
Here $\text{sgn}(\tau)$ is the sign of the permutation $\tau$.
A: We are working in the field $F=\Bbb F_p$ for a prime $p$.
Let $g$ be a multiplicative generator, a generator of the cyclic group
$(\Bbb F_p^\times, \cdot)$. Then $g$ is also generating the $-1$ in the field, and of course $g^{p-1}=1$, $g^{(p-1)/2}=-1$.
Now let us consider the set $S$ of the elements $1,2,\dots,(p-1)/2$ considered in $F$. These are representatives of $F^\times/\{\pm 1\}$. The class of $k$ is covered by $k, p-k$. Taking the squares, we obtain a list of all squares in $F$.
And also the set $T$ of the elements 
$g^1,g^2,\dots,g^{(p-1)/2}$ considered in $F$. 
These are also representatives of $F^\times/\{\pm 1\}$.
The class of $k=g^u$ (for a suitable unique $u$) is covered by 
$k=g^u,\ -k=g^{u+(p-1)/2}$. (And $u$, $u+(p-1)/2$ are not both in the list.)
Taking squares, we have as sets the equality $\{ j^2\ :\ 1\le j\le (p-1)/2\ \}=\{\ g^u\ :\ 1 \le u\le (p-1)/2\ \}$, but for the products in the OP we also have to use the orderings of the sets, as inherited by the ones of the parametrizing indices $j$, respectively $u$.
The products differ then by the sign of the reordering.   
