0811 coprime test

ph
Admin (토론 | 기여)님의 2017년 8월 11일 (금) 14:54 판 (새 문서: <pre> #coprime test def gcd(a,b): [n, m] = sorted([a,b]) q = m%n if q ==0: return n else: return gcd(n, q) def iscoprime(a,b): return gcd(a,b) ==...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
이동: 둘러보기, 검색
#coprime test
def gcd(a,b):
    [n, m] = sorted([a,b])
    q = m%n
    if q ==0:
        return n
    else:
        return gcd(n, q)

def iscoprime(a,b):
    return gcd(a,b) == 1