TITLE: Prove that there are infinitely many primes ending in either 1 or 9.
QUESTION [5 upvotes]: Prove that there are infinitely many primes either ending in 1 or 9. 
I think a good starting point could be to consider that there are only finitely such primes $p_{1},...,p_{k}$ and consider the number $m = (2p_{1}...p_{k})^{2} - 5$. 
Not quite sure where to go from here. Any hints or approaches would be appreciated.

REPLY [2 votes]: HINT: If $q$ is an odd prime divisor of a number of the form $n^2 - 5$, then $5$ is a quadratic residue $\mod q$. By the quadratic reciprocity theorem  we conclude that $q$ is a quadratic residue modulo $5$.