"0811 coprime test"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
잔글
잔글
1번째 줄: 1번째 줄:
 
<pre>
 
<pre>
 
#coprime test
 
#coprime test
def gcd(a,b):
+
def gcd(m,n):
 
     q = m%n
 
     q = m%n
 
     if q ==0:
 
     if q ==0:

2017년 8월 11일 (금) 16:08 판

#coprime test
def gcd(m,n):
    q = m%n
    if q ==0:
        return n
    else:
        return gcd(n, q)

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