Use the law of quadratic reciprocity to show that if p is a prime with p > 5, then 5 is a quadratic residue modulo p if and only if the last decimal digit of p is 1 or 9.
So far, I got x$^2$ = 5(mod) and p = 1(mod10) or p = 9(mod10)
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityLet $p$ be a prime greater than $5$. Since $5\equiv 1\pmod{4}$, by Quadratic Reciprocity the Legendre symbol $(5/p)$ is equal to $(p/5)$.
But $(p/5)=(a/5)$, where $a$ is the remainder of $p$ on division by $5$.
Note that $(1/5)=1$ and $(4/5)=1$ and $(2/5)=(3/5)=-1$.
So $5$ is a QR of the prime $p\gt 5$ if and only if $p\equiv 1\pmod{5}$ or if $p\equiv 4\pmod{5}$.
Since $p$ is odd, this is the case if and only if $p\equiv 1\pmod{10}$ or $p\equiv 9\pmod{10}$.
Using QR, you have that
$$\begin{cases}5=1\pmod 4\\{}\\p=*...*9\;\text{ a prime}\end{cases}\;\;\implies p=4\pmod 5\;,\;\text{ so}\;\;\left(\frac5p\right)=\left(\frac p5\right)=\left(\frac45\right)=1$$
Likewise if the last digit is one, then $\;p=1\pmod 5\;$ and thus a quadratic residue