while a > b:
    if a == 0:
        return b
    a-=b
return gcd(a,b)

이게 문제되는 부분이라는데 반복이 천번 넘어간다고 그럼...