can_i_ @ 2024-11-13 21:44:22
import math
def is_huiwen(n):
n = str(n)
if n == n[::-1]:
return True
return False
def is_prime(n):
if n <= 1:
return False
if n == 2 or n == 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
for i in range(5, int(math.sqrt(n)) + 1, 6):
if n % i == 0 or n % (i + 2) == 0:
return False
return True
a, b = map(int, input().split())
ret = []
for i in range(a, b + 1):
if is_huiwen(i) and is_prime(i):
ret.append(i)
for i in ret:
print(i)