Gcd( r1, r2... )
Gcd( R, r1, r2... )
In the first form Gcd returns the greatest common divisor of the
ring elements r1, r2... etc. in their default ring (see
DefaultRing). In the second form Gcd returns the greatest common
divisor of the ring elements r1, r2... etc. in the ring
R. R must be a Euclidean ring (see IsEuclideanRing) so
that QuotientRemainder (see QuotientRemainder) can be applied to
its elements. Gcd returns the standard associate (see
StandardAssociate) of the greatest common divisors.
A greatest common divisor of the elements r_1, r_2... etc. of the ring R is an element of largest Euclidean degree (see EuclideanDegree) that is a divisor of r_1, r_2... etc. We define gcd( r, 0_R ) = gcd( 0_R, r ) = StandardAssociate( r ) and gcd( 0_R, 0_R ) = 0_R.
gap> Gcd( Integers, 123, 66 );
3
Gcd calls R.operations.Gcd repeatedly,
each time passing the result of the previous call and the next argument, and
returns the value of the last call.
The default function called this way is RingOps.Gcd, which
applies the Euclidean algorithm to compute the greatest common divisor.
Special categories of rings overlay this default function with more efficient
functions.