login
A392041
Smallest prime number whose decimal digits include the consecutive pattern 1, 2, ..., n.
2
11, 127, 1123, 12343, 123457, 12345623, 71234567, 1234567801, 1234567891, 1234567891003, 12345678910111, 12345678910111207, 912345678910111213, 123456789101112131449, 12345678910111213141523, 123456789101112131415161, 41234567891011121314151617, 31234567891011121314151617181
OFFSET
1,1
COMMENTS
a(369) has 1002 digits. - Michael S. Branicky, Dec 29 2025
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..368
FORMULA
A007908(n) <= a(n) <= A053546(n). - Michael S. Branicky, Dec 29 2025
PROG
(Python)
from gmpy2 import is_prime, mpz
from itertools import count, product
def a(n):
s = "".join(str(i) for i in range(1, n+1))
t = mpz(s)
if is_prime(t): return int(t)
cands = set()
for d in count(1):
for w in product("0123456789", repeat=d):
w = "".join(w)
for i in range(d+1):
v = w[:i] + s + w[i:]
if v[0] != "0" and is_prime(t:=mpz(v)):
cands.add(t)
if cands:
return int(min(cands))
print([a(n) for n in range(1, 19)]) # Michael S. Branicky, Dec 29 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jean-Marc Rebert, Dec 29 2025
STATUS
approved