login
A354839
Beginning with 0, smallest positive integer not yet in the sequence such that the concatenation of two digits of the sequence separated by a comma is prime.
0
0, 2, 3, 1, 7, 9, 70, 5, 30, 20, 21, 10, 22, 31, 11, 12, 32, 33, 13, 14, 15, 34, 16, 17, 18, 35, 36, 19, 71, 37, 38, 39, 72, 90, 23, 73, 74, 75, 91, 76, 77, 92, 93, 78, 94, 79, 700, 24, 100, 25, 95, 96, 101, 97, 98, 99, 701, 102, 300, 26, 103, 104, 105, 301
OFFSET
0,2
EXAMPLE
a(4)=1 because this is the first number not in the sequence whose first digit is 3 (last digit of a(3)), concatenated with its first digit 1, is prime: 31.
a(14)=31 because this is the first number not in the sequence whose first digit is 2 (last digit of a(13)), concatenated with its first digit 3, is prime: 23.
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
aset, k, mink = {0}, 0, 1; yield 0
for n in count(2):
k, prevdig = mink, str(k%10)
while k in aset or not isprime(int(prevdig+str(k)[0])): k += 1
aset.add(k); yield k
while mink in aset: mink += 1
print(list(islice(agen(), 64))) # Michael S. Branicky, Jun 09 2022
KEYWORD
nonn,easy,base
AUTHOR
Carole Dubois, Jun 08 2022
STATUS
approved