login
A392246
Smallest prime number whose decimal digits include the consecutive pattern 0, 1, 2, ..., n.
1
101, 101, 20123, 20123, 3012343, 10123457, 201234563, 401234567, 50123456783, 100123456789, 101234567891071, 1012345678910119, 101234567891011123, 1012345678910111213, 10123456789101112131421, 101234567891011121314157, 100123456789101112131415163, 1012345678910111213141516171
OFFSET
0,1
COMMENTS
a(368) has 1001 digits. - Michael S. Branicky, Jan 04 2026
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..367
PROG
(Python)
from gmpy2 import is_prime, mpz
from itertools import count, product
def a(n):
s = "".join(str(i) for i in range(n+1))
cands = set()
for d in count(1):
for f in "123456789":
for w in product("0123456789", repeat=d-1):
w = "".join(w)
for i in range(d):
v = f + w[:i] + s + w[i:]
if is_prime(t:=mpz(v)):
cands.add(t)
if cands:
return int(min(cands))
print([a(n) for n in range(19)]) # Michael S. Branicky, Jan 04 2026
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jean-Marc Rebert, Jan 04 2026
STATUS
approved