login
A068160
Smallest prime beginning and ending in exactly n 1's and containing at least one digit != 1.
6
2, 101, 11311, 1114111, 111181111, 111110611111, 1111118111111, 111111151111111, 111111110911111111, 11111111128111111111, 111111111161111111111, 111111111110911111111111, 11111111111104111111111111, 1111111111111031111111111111, 11111111111111611111111111111, 11111111111111173111111111111111
OFFSET
0,1
COMMENTS
a(499) has 1001 digits. - Michael S. Branicky, Oct 02 2024
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..498
EXAMPLE
a(2) = 11311 is a prime that starts with 11 and ends in 11 (two 1's).
PROG
(Python)
from gmpy2 import is_prime
def a(n):
suffix, d = (10**n-1)//9, 2*n+1
while True:
prefix = 10**(d-n)*suffix
for mid in range(0, 10**(d-n), 10**n):
s = str(mid//10**n)
if s[0] == "1" or s[-1] == "1": continue
t = prefix + mid + suffix
if is_prime(t): return t
d += 1
print([a(n) for n in range(16)]) # Michael S. Branicky, Oct 02 2024
CROSSREFS
Cf. A366416.
Sequence in context: A266457 A028989 A113575 * A173640 A111012 A256516
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, Feb 24 2002
EXTENSIONS
Corrected and extended by Sascha Kurz, Jan 03 2003
More precise name and more terms from Hugo Pfoertner, Oct 11 2023
a(0) = 2 inserted by Michael S. Branicky, Oct 02 2024
STATUS
approved