Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- backwardsPrime(2, 100) => 13, 17, 31, 37, 71, 73, 79, 97
- backwardsPrime(9900, 10000) => 9923, 9931, 9941, 9967
- backwardsPrime(501, 599) => None
- def bakcwardsPrime(start,stop):
- for i in range(start,stop):
- if i > 1:
- for j in list(range(2,i)):
- if(i%j==0):
- break
- else:
- reversed=int(str(i)[::-1])
- for k in range(2,reversed):
- if reversed%k==0:
- break
- else:
- if i!=reversed:
- return i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement