Prime Numbers – Last Digits of Primes

prime numbers

A prime number not equal to $2$ and $5$ can't have last digit equal to $2,4,5,6$ and $8$.

Is it true that this is the only restriction on last digits of prime numbers?
I mean if its true that for any sequence of digits with last digit not equal to $2,4,5,6$ and $8$
there exists a prime number with given sequence of digits?

Best Answer

I think that you forgot about zero. It's clear that prime number can't have zero as last digit. And if you add zero to your list then your statement is true.

Let $x_1, x_2, \cdots x_n$ be your sequence. Take $x = x_1 10^{n-1} + \cdots + x_n$ --- number formed by this sequence. Then $x$ and $10^n$ are coprime since last digit of $x$ is odd and is not divisible by 5. Hence by Dirichlet theorem there exists infinitely many primes $p$ with $p \equiv x \pmod {10^n}$. Those primes have required last digits.

Related Question