# 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('c2086fb1-2993-4b65-a828-306ff13f4af1','4a0fbac2-d9ff-43fb-962b-b9eedb7dc546','77a7ad3b-0d88-4f24-9000-2bb33e9cd690','../lite/tree/../notebooks/index.html?path=0c429f70_a6ab_4b30_b47a_8c3af81b7bf8.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="77a7ad3b-0d88-4f24-9000-2bb33e9cd690" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('c2086fb1-2993-4b65-a828-306ff13f4af1','77a7ad3b-0d88-4f24-9000-2bb33e9cd690')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('c2086fb1-2993-4b65-a828-306ff13f4af1','77a7ad3b-0d88-4f24-9000-2bb33e9cd690')">Open In Tab</button></div><div id="4a0fbac2-d9ff-43fb-962b-b9eedb7dc546" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
