Greatest common divisor in Prolog
1 2 | gcd(A,0,A) :- !.
gcd(A,B,R) :- T is A mod B, gcd(B,T,R).
|
1 2 | gcd(A,0,A) :- !.
gcd(A,B,R) :- T is A mod B, gcd(B,T,R).
|
In mathematics, the greatest common divisor (gcd), sometimes known as the greatest common factor (gcf) or highest common factor (hcf), of two non-zero integers, is the largest positive integer that divides both numbers without remainder.
