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!!

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.   
