## `igcd` -- the greatest common divisor of integers

#### Introduction

`igcd(`i1, i2...`)` computes the greatest common divisor of the integers i1, i2, ...

#### Call(s)

`igcd(i1, i2...)`

#### Parameters

`i1, i2...` | - | arithmetical expressions representing integers

#### Returns

a nonnegative integer, or a symbolic `igcd` call.

#### Related Functions

`content`, `div`, `divide`, `factor`, `gcd`, `gcdex`, `icontent`, `ifactor`, `igcdex`, `ilcm`, `lcm`, `mod`

#### Details

- `igcd` computes the greatest common nonnegative divisor of a sequence of integers. `igcd` with a single numeric argument returns its absolute value. `igcd` returns `0` when all arguments are `0` or no argument is given.
- `igcd` returns an error message if one argument is a number but not an integer. If at least one of the arguments is `1` or `-1`, then `igcd` returns `1`. Otherwise, if one argument is not a number, then a symbolic `igcd` call is returned.

- `igcd` is a function of the system kernel.

#### Example 1

We compute the greatest common divisor of some integers:

    >> igcd(-10, 6), igcd(6, 10, 15)

                                       2, 1

    >> a := 4420, 128, 8984, 488:
       igcd(a), igcd(a, 64)

                                       4, 4

The next example shows some special cases:

    >> igcd(), igcd(0), igcd(1), igcd(-1), igcd(2)

                                   0, 0, 1, 1, 2

If one argument is not a number, then the result is a symbolic `igcd` call, except in some special cases:

    >> delete x:
       igcd(a, x), igcd(1, x), igcd(-1, x)

                        igcd(4420, 128, 8984, 488, x), 1, 1

    >> type(igcd(a, x))

                                      "igcd"

#### Changes

- If one of the arguments is `1` or `-1`, then `igcd` returns `1`.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000