Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (16 sloc) 505 Bytes
module Y2018.M02.D15.Exercise where
Another problem from P99: the late, great Prolog 99 problems set, reposed at:
(**) Determine the greatest common divisor of two positive integer numbers.
Use Euclid's algorithm.
?- gcd(36, 63, G).
G = 9
Define gcd as an arithmetic function; so you can use it like this:
?- G is gcd(36,63).
G = 9
gcd :: Int -> Int -> Int
gcd x y = undefined
-- hint: there is always a GCD.
You can’t perform that action at this time.