Greatest common divisor: Difference between revisions

no edit summary
No edit summary
Line 1:
{{task|Arithmetic operations}}[[Category:Recursion]]
This task requires the finding of the greatest common divisor of two integers.
 
=={{header|ACL2}}==
<lang Lisp>(include-book "arithmetic-3/floor-mod/floor-mod" :dir :system)
 
(defun gcd$ (x y)
(declare (xargs :guard (and (natp x) (natp y))))
(cond ((or (not (natp x)) (< y 0))
nil)
((zp y) x)
(t (gcd$ y (mod x y)))))</lang>
 
=={{header|ActionScript}}==
<lang ActionScript>//Euclidean algorithm
Anonymous user