Last active
August 12, 2020 07:58
-
-
Save de-sh/4a8c3053fbb3d399e264794404727edd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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