A068160 Smallest prime beginning and ending in exactly n 1's and containing at least one digit != 1.
2, 101, 11311, 1114111, 111181111, 111110611111, 1111118111111, 111111151111111, 111111110911111111, 11111111128111111111, 111111111161111111111, 111111111110911111111111, 11111111111104111111111111, 1111111111111031111111111111, 11111111111111611111111111111, 11111111111111173111111111111111
Offset: 0
Examples
a(2) = 11311 is a prime that starts with 11 and ends in 11 (two 1's).
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..498
Crossrefs
Cf. A366416.
Programs
-
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
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
Comments