# Determine all primes p for which 5 is a quadratic residue modulo p

I need to determine all primes $p$ for which $5$ is a quadratic residue modulo p.

I think I'll need to use quadratic recprocity laws to do this, i.e., I need to need to find numbers $p$ where $x^2$ is congruent to $5 \bmod p$. I'm ok doing this for single values of $p$. But how do I find all primes for which this holds?

Thanks.

-
Depending on where your investigation leads you, the answer to a question like this could be a finite list of prime numbers. Or it could be some kind of formula in $n$ that outputs all such primes sequentially. Or it could just be another way to describe the set of such primes that is somehow more direct, like "all primes that are 3 modulo 8" or something similar. Without knowing where this will go it is not clear that it will literally be possible to "find" all such primes and write them all down. –  alex.jordan Nov 13 '12 at 1:10
The question just says "all primes". I don't think it'd be enough to say all primes p that are a quadratic residue of 5 lol –  Chloe.H Nov 13 '12 at 1:32
But would it be enough to say "all primes that are $\pm1\mod{5}$? –  alex.jordan Nov 13 '12 at 1:38
I can't see any other way it could be put lol. I'll just do this. Thank you!!! –  Chloe.H Nov 13 '12 at 1:48

@Chloe.H I'm not quite sure I follow that. It is important that $5-1$ is divisible by $4$. That makes $\left(\frac{5}{p}\right)\cdot\left(\frac{p}{5}\right)=1$ for sure. So $5$ is a quadratic residue mod $p$ exactly when $p$ is quadratic residue mod $5$, which happens exactly when $p$ is $1$ or $4$ mod $5$. (Aka $\pm1$ mod $5$.) –  alex.jordan Nov 13 '12 at 1:36
@Chloe.H Oh yes. Lots of things about primes work differently if it's $2$ we are talking about. For example, quadratic reciprocity ;) –  alex.jordan Nov 13 '12 at 4:19