A362417 Beginning with 1, smallest positive integer not yet in the sequence such that two adjacent digits A and B of the sequence (also ignoring commas between terms) produce a prime = A + 2B. This is the earliest infinitely extensible such sequence.
1, 3, 5, 7, 20, 11, 9, 13, 15, 19, 50, 111, 30, 113, 51, 31, 35, 37, 53, 57, 59, 70, 115, 73, 75, 91, 95, 97, 201, 119, 120, 130, 131, 135, 137, 301, 150, 151, 153, 157, 311, 159, 191, 195, 197, 313, 501, 315, 319, 511, 320, 1111, 350, 1113, 513, 515, 351, 353
Offset: 1
Examples
Digit A = 1 and B = 3 lead to 7 (prime) = A+2B; Digit A = 3 and B = 5 lead to 13 (prime) = A+2B; Digit A = 5 and B = 7 lead to 19 (prime) = A+2B; Digit A = 7 and B = 2 lead to 11 (prime) = A+2B; Digit A = 2 and B = 0 lead to 2 (prime) = A+2B; Digit A = 0 and B = 1 lead to 2 (prime) = A+2B; Digit A = 1 and B = 1 lead to 3 (prime) = A+2B; etc.
Programs
-
Python
from sympy import isprime from itertools import islice def c(s): if s[-1] == "2" or "4" in s or "6" in s or "8" in s: return False return all(isprime(int(s[i])+2*int(s[i+1])) for i in range(len(s)-1)) def agen(): # generator of terms last, aset = "1", {1} yield 1 while True: k = 2 while k in aset or not c(last+str(k)): k += 1 an = k; yield an; last += str(an); aset.add(an) print(list(islice(agen(), 58))) # Michael S. Branicky, Apr 19 2023
Extensions
a(7) inserted and a(30) and beyond from Michael S. Branicky, Apr 19 2023
Comments