Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gmpy
- def test(n):
- if (not gmpy.is_prime(n)) and n != 1:
- return False
- s = str(n)
- if len(s) == 1:
- return True
- for i in xrange(len(s)):
- if not test(int(s[:i] + s[i+1:])):
- return False
- return True
- print filter(test, xrange(10000000))
Add Comment
Please, Sign In to add comment