gcd(M, 0, M).
gcd(M, N, G) :- not(N = 0), Temp is M mod N, gcd(N, Temp, G).
