lcm(x1, x2, out=None, **kwargs)

Returns the lowest common multiple of |x1| and |x2|

  • x2 (x1,) – The arrays for computing lowest common multiple. If x1.shape != x2.shape, they must be broadcastable to a common shape (which may be the shape of one or the other).

  • out (ndarray or None, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.


y – The lowest common multiple of the absolute value of the inputs This is a scalar if both x1 and x2 are scalars.

Return type

ndarray or scalar

See also


The greatest common divisor


>>> np.lcm(12, 20)
>>> np.lcm(np.arange(6, dtype=int), 20)
array([ 0, 20, 20, 60, 20, 20], dtype=int64)