# Last digits of primes (without Dirichlet's theorem)

How can I prove that the last digit of a prime number other than $$2$$ and $$5$$ can be $$1,3,7,9$$ without using Dirichlet's theorem?

It occurs to me to try to prove that

$$4n + 1 \equiv a_n \pmod {10}$$

$$4n + 3 \equiv a_n \pmod {10}$$

with $$a_n = \{1,3,7,9 \}$$

• As stated, you just need to exhibit primes with those last digits, like $11,13,7,19$ and you are done. I believe you mean to ask how to prove that all primes other than $2$ and $5$ end in one of those digits. – Ross Millikan Oct 31 at 4:21

If the last digit is $$2,4,6,8,0$$ the number is even. If the last digit is $$5$$ the number is divisible by $$5$$. Thus, if the number is prime it can only end in $$1,3,7,9$$.
In general, primes in base $$n$$ that are greater than $$n$$ can only have last digits coprime to $$n$$.
Specific primes that end in $$1,3,7,9$$ are $$11,13,17$$ and $$19$$.
• (at)ParclyTaxel for anybody. What's the function $f:\mathbb N \to 2^{\mathbb N}$ such that $f(n)\subseteq\{0,\ldots,n-1\}$ is the appropriate subset? – John Forkosh Oct 31 at 4:35