Skip to content

Instantly share code, notes, and snippets.

@de-sh
Last active August 12, 2020 07:58
Show Gist options
  • Save de-sh/4a8c3053fbb3d399e264794404727edd to your computer and use it in GitHub Desktop.
Save de-sh/4a8c3053fbb3d399e264794404727edd to your computer and use it in GitHub Desktop.
def is_prime(n):
if n == 1:
return False
i = 2
while i*i <= n:
if n % i == 0:
return False
i += 1
return True
c = 0
for i in range(99999, 10000, -1):
x = str(i)
x+= x[-2::-1]
x = int(x)
if is_prime(x):
c+=1
print(x)
if c >= 3:
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment