Skip to content

Instantly share code, notes, and snippets.

@shuson
Created July 21, 2013 13:28
Show Gist options
  • Select an option

  • Save shuson/6048576 to your computer and use it in GitHub Desktop.

Select an option

Save shuson/6048576 to your computer and use it in GitHub Desktop.
By reading RSA algorithm,to generate a series co-prime relation numbers is the basic task. So comes out of this basic method
#if the return is 1, the a b are in coprime relation
#else return the smallest common divisor
def checker(a,b):
while True:
c = a%b
if c == 0:
return b
a = b
b = c
@shuson
Copy link
Copy Markdown
Author

shuson commented Aug 27, 2014

def checker(a,b):
if a<=b:
return all([b%i for i in xrange(2,a)])
return False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment