%I #28 Apr 23 2023 17:11:21
%S 1,3,5,7,20,11,9,13,15,19,50,111,30,113,51,31,35,37,53,57,59,70,115,
%T 73,75,91,95,97,201,119,120,130,131,135,137,301,150,151,153,157,311,
%U 159,191,195,197,313,501,315,319,511,320,1111,350,1113,513,515,351,353
%N 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.
%C The integer 10 is the first one that will never appear in the sequence (as the result of 1 + 2*0 is not a prime). The next absent will be 14.
%C From _Michael S. Branicky_, Apr 19 2023: (Start)
%C The only allowed pairs of digits AB are 01, 11, 12, 13, 15, 16, 18, 19, 20, 30, 31, 32, 34, 35, 37, 38, 50, 51, 53, 54, 56, 57, 59, 70, 72, 73, 75, 76, 78, 91, 92, 94, 95, 97.
%C Further, any appearance of 4, 6, or 8 as a digit would end the sequence, as would a term with last digit 2 (since the next term cannot start with 0).
%C As long as no term ends in 2, 4, 6, or 8, the sequence is infinitely extensible since the edge and cycle 01 -> 13 -> 31 -> 13 (at least) can be used to extend terms ending in 0, 1, or 3; and 75 -> 59 -> 97 to extend terms ending in 5, 7, or 9. (End)
%e Digit A = 1 and B = 3 lead to 7 (prime) = A+2B;
%e Digit A = 3 and B = 5 lead to 13 (prime) = A+2B;
%e Digit A = 5 and B = 7 lead to 19 (prime) = A+2B;
%e Digit A = 7 and B = 2 lead to 11 (prime) = A+2B;
%e Digit A = 2 and B = 0 lead to 2 (prime) = A+2B;
%e Digit A = 0 and B = 1 lead to 2 (prime) = A+2B;
%e Digit A = 1 and B = 1 lead to 3 (prime) = A+2B; etc.
%o (Python)
%o from sympy import isprime
%o from itertools import islice
%o def c(s):
%o if s[-1] == "2" or "4" in s or "6" in s or "8" in s: return False
%o return all(isprime(int(s[i])+2*int(s[i+1])) for i in range(len(s)-1))
%o def agen(): # generator of terms
%o last, aset = "1", {1}
%o yield 1
%o while True:
%o k = 2
%o while k in aset or not c(last+str(k)): k += 1
%o an = k; yield an; last += str(an); aset.add(an)
%o print(list(islice(agen(), 58))) # _Michael S. Branicky_, Apr 19 2023
%Y Cf. A182178 (B is multiplied by 1), A362418 (B is multiplied by 3).
%K base,nonn
%O 1,2
%A _Eric Angelini_, Apr 19 2023
%E a(7) inserted and a(30) and beyond from _Michael S. Branicky_, Apr 19 2023