# xarray.ufuncs.lcm

### xarray.ufuncs.lcm *= <xarray.ufuncs._binary_ufunc object>*

xarray specific variant of `numpy.lcm()`. Handles xarray objects by dispatching to the appropriate function for the underlying array type.

Documentation from numpy:

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

* **Parameters:**
  **x1, x2** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like), [`int`](https://docs.python.org/3/builtins/functions.html#int)) – Arrays of values.
  If `x1.shape != x2.shape`, they must be broadcastable to a common
  shape (which becomes the shape of the output).
* **Returns:**
  **y** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) or [scalar](../user-guide/terminology.html.md#term-scalar)) – The lowest common multiple of the absolute value of the inputs
  This is a scalar if both x1 and x2 are scalars.

#### SEE ALSO
[`gcd`](xarray.ufuncs.gcd.html.md#xarray.ufuncs.gcd)
: The greatest common divisor

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('14b891b9-fc51-4227-bab3-2f5d9602a230','f5d3dd44-4443-44ac-a297-4fd4013f3049','5b8caf24-5596-480c-bb92-bae95952ad47','../lite/tree/../notebooks/index.html?path=a90296be_8213_49e4_8b3c_0ae5dbb81b18.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> import numpy as np
>>> np.lcm(12, 20)
60
>>> np.lcm.reduce([3, 12, 20])
60
>>> np.lcm.reduce([40, 12, 20])
120
>>> np.lcm(np.arange(6), 20)
array([ 0, 20, 20, 60, 20, 20])
```

<div id="5b8caf24-5596-480c-bb92-bae95952ad47" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('14b891b9-fc51-4227-bab3-2f5d9602a230','5b8caf24-5596-480c-bb92-bae95952ad47')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('14b891b9-fc51-4227-bab3-2f5d9602a230','5b8caf24-5596-480c-bb92-bae95952ad47')">Open In Tab</button></div><div id="f5d3dd44-4443-44ac-a297-4fd4013f3049" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
