zsl_ayt @ 2023-11-11 16:59:12
def is_prime(x):
i = 2
while i * i <= x:
if x % i == 0:
return False
i += 1
return True
def huiwen(x):
s = str(x)
if s == s[::-1]:
return True
return False
def check(x):
if x > 10 and x < 100 and x != 11 or x > 1000 and x < 10000:
return False
if x > 100000 and x < 1000000 or x > 10000000 and x < 100000000:
return False
return True
n, m = map(int, input().split())
for x in range(n, m + 1):
if x > 10000000:
break
if check(x) and huiwen(x) and is_prime(x):
print(x)