1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% 980202, 980311 Thom Fruehwirth, LMU
4 %% computes greatest common divisor of positive numbers written each as gcd(N)
6 %% ported to hProlog by Tom Schrijvers
10 :- use_module( library(chr)).
15 %%gcd(N) \ gcd(M) <=> N=<M | L is M-N, gcd(L).
16 gcd(N) \ gcd(M) <=> N=<M | L is M mod N, gcd(L). % faster variant
25 X is 37*11*11*7*3, Y is 11*7*5*3, Z is 37*11*5,gcd(X),gcd(Y),gcd(Z).