0811 coprime test

ph
Maintenance script (토론 | 기여)님의 2026년 10월 27일 (화) 10:39 판 (사용자 요청에 따라 Disqus 댓글 기능 및 삽입 태그 제거)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
다음으로 이동: 둘러보기, 검색
#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

precisely,

def iscoprime(m,n): # m>n test is not required.
    while m%n != 0:
        m, n = n, m%n
    return n==1

is가 아니고 are인가...