summaryrefslogtreecommitdiff
path: root/prolog/problems/clp_fd/gcd_3/en.py
blob: d6c92b77d58ec20bdf35a4b643c91043eb99b62a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# coding=utf-8

id = 149
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 = {}