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
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Carole Dubois, Jun 08 2022
STATUS
approved