coprime python

Solutions on MaxInterview for coprime python by the best coders in the world

showing results for - "coprime python"
Trevor
29 May 2017
1def gcd(p,q):
2# Create the gcd of two positive integers.
3    while q != 0:
4        p, q = q, p%q
5    return p
6def is_coprime(x, y):
7    return gcd(x, y) == 1
8print(is_coprime(17, 13))
9print(is_coprime(17, 21))
10print(is_coprime(15, 21))
11print(is_coprime(25, 45))
12