#coprime test def gcd(m,n): while m%n != 0: m, n = n, m%n return n def iscoprime(a,b): return gcd(a,b) == 1