Skip to content

Instantly share code, notes, and snippets.

@orisano
Created November 15, 2014 12:16
Show Gist options
  • Save orisano/d45c13117523056adfdb to your computer and use it in GitHub Desktop.
Save orisano/d45c13117523056adfdb to your computer and use it in GitHub Desktop.
#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