Consider a prime number $p$ with the property that every time you remove an arbitrary number of its digits from the left, you still get a prime.

For example, let $p=3947$, which is prime. $p$ has this property, since $947$, $47$ and $7$ are all primes. It is also clear that the first right digit has to be either $3$ or $7$, except the simple cases when $p\in\{2,5\}$.

I wrote a small code that constructs the biggest prime with this property from given primes with the same property (the code adds digits to the left of the given prime). Furthermore, the given primes are small and ordered, so that the code eventually covers all possible cases (inclduing numbers with $0$ in their digits). Here are some of the primes I found, of different digit lengths $$ 2\\5\\773\\ 3947\\ 15647\\ 121997\\ 5138053\\ 61812347\\ 76579907\\ 7686463823\\ 4818372912366173 $$ Regarding this construction, I have four questions:

  • Are there infinitely many primes with such property?
  • What if we disregard the cases with $0$ in their digits?
  • In case of a positive answer to either question, is there a way of constructing an arbitrarily big prime with such property?
  • If the removal is done from the right, how different does this problem become?

I guess a way to answer the first question would be to show that, for any $n\in\mathbb{N}$, there is always a prime of the form $$ p=a\,\underbrace{0\cdots 0}_\text{$m$ zeros}\,b , $$ where $1\leq a\leq 9$, $b\in\{3,7\}$ and $m\geq n$. Is this true?

Anyway, I know there might be too many questions at once, but I want to learn how to approach such kind of problems. Any ideas and insights are appreciated.

  • 1
    $\begingroup$ There’s a video about these on numberphile.... $\endgroup$ Sep 20, 2019 at 21:53
  • $\begingroup$ The random model for the primes predicts that for all $n$ coprime with $10$ there are infinitely many primes of the form $a 10^k + n$ because the probability it is prime is $\frac1{\log (a10^k +n)}$ and the probability that none of them is prime is $\prod_{a,k} (1-\frac1{\log (a10^k +n)})=0$ $\endgroup$
    – reuns
    Sep 20, 2019 at 23:50

1 Answer 1


These are known as left-truncatable primes

There are $4260$ such primes when no digit is zero (numbers are not usually written with leading zeros) and they are listed by P. De Geest. The largest is $357686312646216567629137$

If you allow zeros then the list is apparently infinite and you can find the small values at OEIS A033664 which also provides some code for finding more (essentially you find some small cases and then try to prepend another digit or another digit and some zeros)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .