# 5.28 Lcm

`Lcm( r1, r2... )`
`Lcm( R, r1, r2... )`

In the first form `Lcm` returns the least common multiple of the ring elements r1, r2... etc. in their default ring (see DefaultRing). In the second form `Lcm` returns the least common multiple of the ring elements r1, r2,... etc. in the ring R. R must be a Euclidean ring (see IsEuclideanRing) so that `Gcd` (see Gcd) can be applied to its elements. `Lcm` returns the standard associate (see StandardAssociate) of the least common multiples.

A least common multiple of the elements r_1, r_2... etc. of the ring R is an element of smallest Euclidean degree (see EuclideanDegree) that is a multiple of r_1, r_2... etc. We define lcm( r, 0_R ) = lcm( 0_R, r ) = StandardAssociate( r ) and Lcm( 0_R, 0_R ) = 0_R.

`Lcm` uses the equality lcm(m,n) = m*n / gcd(m,n) (see Gcd).

```    gap> Lcm( Integers, 123, 66 );
2706 ```

`Lcm` calls `R.operations.Lcm` 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.Lcm`, which simply returns the product of r with the quotient of s and the greatest common divisor of r and s. Special categories of rings overlay this default function with more efficient functions.

GAP 3.4.4
April 1997