Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i.e. is is possible for

  • $g$ to be a generator$\mod{p}$, and
  • $g \equiv x^2 \mod{p}$ for some $x$

I'm guessing not, as I think $x$ can't be expressed as a power of $g$, contradicting g being a generator?

share|cite|improve this question
Dear malikyo_o: Your argument is almost complete! You should try harder! – Pierre-Yves Gaillard Feb 5 '12 at 14:15
up vote 4 down vote accepted

If $p$ is an odd prime, then no. $\varphi(p)=p-1$ is even and the multiplicative group $\!\!\!\pmod{p}$ has order $\varphi(p)$. If $g=x^2$, then $g^{(p-1)/2}=x^{p-1}=1\pmod{p}$. But if $g$ is a generator of the multiplicative group $\!\!\!\pmod{p}$, $g^k\not=1\pmod{p}$ for $0<k<p-1$.

In fact, the only $p$ for which $\varphi(p)$ is odd is $p=2$, and $1=1^2$ is a generator for the multiplicative group $\!\!\!\pmod{2}$. For all other $p$, $g=x^2$ cannot be a generator of the multiplicative group $\!\!\!\pmod{p}$.

share|cite|improve this answer

If you consider $p=2$ to be a prime number (and I wouldn't know how you could defend not doing so) then you will see that $1$ is both a quadratic residue and a generator mod $2$ (admittedly not very spectacular, but true nontheless). This is the only case, as explained the answer by robjohn.

share|cite|improve this answer
I have added that $p$ is an odd prime in the first paragraph. Thanks for keeping me on my toes. – robjohn Feb 5 '12 at 14:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.