Are there primes of every possible number of digits?

That is, is it the case that for every natural number $n$, there is a prime number of $n$ digits? Or, is there some $n$ such that no primes of $n$-digits exist?

I am wondering this because of this Project Euler problem: https://projecteuler.net/problem=37. I find it very surprising that there are only a finite number of truncatable primes (and even more surprising that there are only 11)! However, I was thinking that result would make total sense if there is an $n$ such that there are no $n$-digit primes, since any $k$-digit truncatable prime implies the existence of at least one $n$-digit prime for every $n\leq k$.

If not, does anyone have insight into an intuitive reason why there are finitely many trunctable primes (and such a small number at that)? Thanks!


Solution 1:

Yes, there is always such a prime. Bertrand's postulate states that for any $k>3$, there is a prime between $k$ and $2k-2$. This specifically means that there is a prime between $10^n$ and $10\cdot 10^n$.

To commemorate $50$ upvotes, here are some additional details: Bertrand's postulate has been proven, so what I've written here is not just conjecture. Also, the result can be strengthened in the following sense (by the prime number theorem): For any $\epsilon > 0$, there is a $K$ such that for any $k > K$, there is a prime between $k$ and $(1+\epsilon)k$. For instance, for $\epsilon = 1/5$, we have $K = 24$ and for $\epsilon = \frac{1}{16597}$ the value of $K$ is $2010759$ (numbers gotten from Wikipedia).

Solution 2:

While the answer using Bertrand's postulate is correct, it may be misleading. Since it only guarantees one prime between $N$ and $2N$, you might expect only three or four primes with a particular number of digits. This is very far from the truth.

The primes do become scarcer among larger numbers, but only very gradually. An important result dignified with the name of the ``Prime Number Theorem'' says (roughly) that the probability of a random number of around the size of $N$ being prime is approximately $1/\ln(N)$.

To take a concrete example, for $N = 10^{22}$, $1/\ln(N)$ is about $0.02$, so one would expect only about $2\%$ of $22$-digit numbers to be prime. In some sense, $2\%$ is small, but since there are $9\cdot 10^{21}$ numbers with $22$ digits, that means about $1.8\cdot 10^{20}$ of them are prime; not just three or four! (In fact, there are exactly $180,340,017,203,297,174,362$ primes with $22$ digits.)

In short, the number of $n$-digit numbers increases with $n$ much faster than the density of primes decreases, so the number of $n$-digit primes increases rapidly as $n$ increases.