GCD and LCM in prolog

784 Views Asked by At

Some code could help

%addition
sum(X,nil,X).
sum(X,s(Y),s(Z)) :- sum(X,Y,Z).

%Product
mult(X,nil,nil).
mult(X,s(Y),W) :- mult(X,Y,Z),sum(X,Z,W).

I am trying to solve a simple problem in prolog "GCD and LCM peano number "

I don't know how to start ?

How to compare piano's number in prolog Thank you so much for your help

0

There are 0 best solutions below