(expand 8) ; lcm expects two input expressions. Both should be positive integers. Lcm ; return the least common multiple of its two arguements. (defun lcm (m n) (* (/ m (gcd m n)) n)) ; Greatest common divisor in iterative form. (defun gcd (m n) (cond ((and (equal 0 m) (equal 0 n)) 1) ((equal 0 m) n) ((equal 0 n) m) (t (gcd2 (abs m) (abs n))) ) ) ; Does work of gcd. Gcd2 should not be called by any function except ; gcd. (defun gcd2 (m n) (progn (setq m1 m) (setq n1 n) (while (not (equal m1 n1)) (cond ((< m1 n1) (setq dif (- n1 m1))) (t (setq dif (- m1 n1)))) (cond ((< m1 n1) (setq n1 m1))) (setq m1 dif) ) m1) )