A384979 a(n) is the smallest (n+2)-digit prime consisting of a string of n identical digits d sandwiched between two digits different from d, or -1 if no such prime exists.
11, 101, 1009, 10007, 100003, 1000003, 13333339, 100000007, 1000000007, 13333333339, 100000000003, 1333333333337, 13333333333339, 122222222222227, 1555555555555553, 16666666666666661, 100000000000000003, 1000000000000000003, 15555555555555555557
Offset: 0
Links
- Gonzalo MartÃnez, Table of n, a(n) for n = 0..1000
Programs
-
Python
from sympy import isprime def a(n): return next((t for l in "123456789" for d in "0123456789" if d!=l for r in "123456789" if r!=d and isprime(t:=int(l+d*n+r))), -1) print([a(n) for n in range(20)]) # Michael S. Branicky, Jun 14 2025
Comments