std-gcd


Synopsis

(std-gcd <intlst>)

Description

Returns the greatest common divisor of all given integer numbers.

It uses a tail-recursive Euler algorithm, so the number of numbers should not be too large on systems which limited stack size.

Note also the similar native function GCD which takes only two arguments but may be faster than std-gcd.

Examples

(std-gcd '(10 20 30))	=> 10
(std-gcd '(2 4 8))		=> 2
(std-gcd '(3 4 8))		=> 1
(std-gcd '(3 4 5))		=> 1

Arguments

intlst: A list of integer numbers.

Return Value

A integer number.

Side Effects

None.

Module

(std-require 'STDMATH)

Defined in STDMATH