Created
November 15, 2014 12:16
-
-
Save orisano/d45c13117523056adfdb to your computer and use it in GitHub Desktop.
This file contains 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
#coding:utf-8 | |
import random | |
def is_prime(n): | |
i = 2 | |
while i * i <= n: | |
if n % i == 0: | |
return False | |
i += 1 | |
return True | |
def main(): | |
while True: | |
r = random.randint(2 ** 29, 2 ** 31) | |
if is_prime(r): | |
print r | |
break | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment