If $p$ is a prime number, what is the product of elements like $g$ such that $1\le g\le p^2$ and $g$ is a primitive root modulo $p$ but it's not a primitive root modulo $p^2$?
I am interested in the above problem. My attempt shows that $\boxed{\text{ord}_{p} (g)=\text{ord}_{p^2} (g)}$ by the help of the argument below:
If $g$ is primitive root $\pmod{p}$, then suppose $\text{ord}_{p^2} (g) =r$ $\implies$ $g^r \equiv 1 \pmod{p^2}$. So $r \mid \phi(p^2)=p(p-1)$. But, $g^r \equiv 1 \pmod{p^2}$ $\implies$ $g^r \equiv 1 \pmod{p}$. So $p-1 \mid r $ $\implies$ $r=p-1$ or $r=p(p-1)$. But, now $g$ shouldn't be primitive root $\pmod{p^2}$, so $r= p-1$....
From here I have no idea how to proceed further. Any help will be highly appreciated.