A381130 a(n) is the smallest prime not yet in the sequence that contains a substring of size 2 from a(n-1); a(1)=11.
11, 113, 13, 131, 31, 311, 211, 421, 521, 523, 23, 223, 227, 127, 271, 71, 571, 157, 151, 251, 257, 457, 557, 577, 277, 677, 67, 167, 163, 263, 269, 569, 563, 463, 461, 61, 613, 137, 37, 337, 233, 239, 139, 313, 317, 17, 173, 73, 373, 379, 79, 179, 479, 47
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Python
from itertools import count, islice from sympy import isprime, nextprime def agen(): # generator of terms aset, an, minp = set(), 11, 13 while True: yield an aset.add(an) s = str(an) targets = set(s[i:i+2] for i in range(len(s)-1)) p = minp w = str(p) while p in aset or not any(t in w for t in targets): p = nextprime(p) w = str(p) while minp in aset: minp = nextprime(minp) an = p print(list(islice(agen(), 54))) # Michael S. Branicky, Apr 15 2025