mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
49 lines (29 loc) • 943 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
Calculate the least common multiple for two or more values or arrays.
lcm is defined as:
lcm(a, b) = abs(a * b) / gcd(a, b)
For matrices, the function is evaluated element wise.
```js
math.lcm(a, b)
math.lcm(a, b, c, ...)
```
Parameter | Type | Description
--------- | ---- | -----------
`args` | ... number &
Type | Description
---- | -----------
number &
```js
math.lcm(4, 6) // returns 12
math.lcm(6, 21) // returns 42
math.lcm(6, 21, 5) // returns 210
math.lcm([4, 6], [6, 21]) // returns [12, 42]
```
[ ](gcd.md),
[ ](xgcd.md)