Greatest common divisor of integers and complex numbers with integer real and imaginary parts
This functionality does not run in MATLAB.
igcd(i1, i2, …)
igcd(i1, i2, ...) computes the greatest common divisor of the integers i1, i2, …
igcd computes the greatest common nonnegative divisor of a sequence of integers. If an argument of igcd is a single integer number, the function returns the absolute value of that argument.
igcd also computes the greatest common divisor of a sequence of complex numbers of the domain DOM_COMPLEX. Both the real and the imaginary parts of all complex numbers in a sequence must be integers. The greatest common divisor is a complex number with a positive real part and a nonnegative imaginary part.
If all arguments are 0, igcd returns 0.
If there are no arguments, igcd also returns 0.
If at least one of the arguments is 1 or -1, igcd returns 1. Otherwise, if one argument is not a number, the igcd function returns a symbolic igcd call.
Compute the greatest common divisor of the following integers:
igcd(-10, 6), igcd(6, 10, 15)
a := 4420, 128, 8984, 488: igcd(a), igcd(a, 64)
Compute the greatest common divisor of the following complex numbers:
igcd(-10*I, 6), igcd(10 - 5*I, 20 - 10*I, 30 - 15*I)
The following example shows some special cases:
igcd(), igcd(0), igcd(1), igcd(-1), igcd(2)
If one argument is not a number, then the result is a symbolic igcd call. However, if at least one of the arguments is 1 or -1, the greatest common divisor is always 1:
delete x: igcd(a, x), igcd(1, x), igcd(-1, x)
i1, i2, …
Nonnegative integer, a complex number both the real and imaginary parts of which are integers, or a symbolic igcd call.