blob: 8891d54d5ea3935878e22c47ae8c6bb42375b782 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# coding=utf-8
name = 'gcd/3'
slug = 'greatest common divisor'
description = '''\
<p><code>gcd(X, Y, GCD)</code>: <code>GCD</code> is the greatest common divisor of <code>X</code> and <code>Y</code>. Implement this predicate using constraints.</p>
<p>Hint: try writing a predicate to find <em>all</em> common divisors of two numbers first.</p>
<pre>
?- gcd(36, 84, GCD).
GCD = 12.
</pre>'''
hint = {}
|