22DSJ_Wu_Yongping @ 2023-03-30 23:10:31
import random
import time
import math
def leap_number(x):
number_size=0
number_judge=0
temp=x
while True:
number_size+=1
temp//=10
if temp==0:
break
if x>=5 and x<=9:
return x
else:
for i in range(number_size//2):
if x//math.pow(10,i)%10==x//math.pow(10,number_size-i-1)%10:
number_judge+=0
else:
return -1
break
if number_judge==0:
return x
else:
return -1
def prime_number(x):
if x%2==0:
return -1
if x>=5 :
for i in range(2,int(math.sqrt(x))+1,1):
if x%i==0:
return -1
break
return x
a,b=map(int,input().split())
for i in range(a,b+1,2):
if i%2!=0 and leap_number(i)==i and prime_number(i)==i:
print(i)