The least common multiple: lcm

### 5.5.3 The least common multiple: lcm

The lcm command finds the least common multiple (LCM) of a set of integers or polynomials. (See also Section 5.28.8 for polynomials.)

With one argument:

- lcm takes one argument:
  seq, a sequence or list of integers or polynomials.
- lcm(seq) returns the LCM of the elements of s.

#### Examples.

- Input:
  lcm(18,15)
  Output:

  90

- Input:
  lcm(-5-12*i,11-10*i)
  Output:

  −53+8 i

- Input:
  lcm(18,15,21,36)
  Output:

  1260

- Input:
  lcm([18,15,21,36])
  Output:

  1260

With two arguments:

- lcm takes two arguments:
  s and t, two lists of the same length containing integers or polynomials (alternatively, a matrix m with two rows whose elements are integers or polynomials).
- lcm(s,t) (or lcm(m)) returns the list whose kth element is the LCM of the kth elements of s and t (or the kth column of m).

#### Example.

Input:

lcm([6,10,12],[21,5,8])

or:

lcm([[6,10,12],[21,5,8]])

Output:

⎡ ⎣ | 42,10,24 | ⎤ ⎦