@skybloxsystems/ticket-bot
Version:
42 lines (26 loc) • 905 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
Calculate the extended greatest common divisor for two values.
See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm.
```js
math.xgcd(a, b)
```
Parameter | Type | Description
--------- | ---- | -----------
`a` | number &
`b` | number &
Type | Description
---- | -----------
Array | Returns an array containing 3 integers `[div, m, n]` where `div = gcd(a, b)` and `a*m + b*n = div`
```js
math.xgcd(8, 12) // returns [4, -1, 1]
math.gcd(8, 12) // returns 4
math.xgcd(36163, 21199) // returns [1247, -7, 12]
```
[](gcd.md),
[](lcm.md)