"0811 coprime test"의 두 판 사이의 차이
ph
잔글 |
잔글 |
||
12번째 줄: | 12번째 줄: | ||
precisely, | precisely, | ||
<pre> | <pre> | ||
− | def iscoprime(m,n): # m>n test is | + | def iscoprime(m,n): # m>n test is not required. |
while m%n != 0: | while m%n != 0: | ||
m, n = n, m%n | m, n = n, m%n |
2017년 9월 3일 (일) 17:17 기준 최신판
#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인가...