# Primes That Do Not Generate Primes When Any Single Digit Is Prepended

Giving a quick inspection at the list of prime numbers, you’d notice that 2 is the first prime number. However, prepending any single decimal digit to it would not produce other primes, that is, 12, 22, 32, 42, 52, 62, 72, 82 and 92 are composite numbers.

Likewise, the third prime number, 5, also shares a similar property. Thus, 15, 25, 35, 45, 55, 65 ,75, 85 and 95 are not primes.

Of course, this is not the case for all primes. For instance, 7 is prime and 17 is also prime. So, it’s not a valid example. Similarly, 11 is prime and while 111 is composite, 211 is prime.

So, my question is, can you figure out the next prime number (after 2 and 5) that has the same property described above?

Solution (Click to Show)

The next number is 149. So, 1149, 2149, 3149, 4149, 5149, 6149, 7149, 8149 and 9149 are all composite numbers.

This sequence is labeled as A155762 in OEIS. Here is the continuation of the sequence:

2, 5, 149, 401, 509, 773, 809, 1021, 1103, 1289, 1301, 1451, 1697, 1709, 1747, 1877, 1889, 2087, 2389, 2521, 2663, 3373, 3511, 3631, 3733, 3779, 3821, 3919, 3947, 3989, 4003, 4073, 4241, 4289, 4339, 4637, 4643, 4801, 4931, 5039, 5113, 5387, 5417, 5477…