https://github.com/knutkirkhorn/gcd
🔢 Get the greatest common devisor of two numbers
https://github.com/knutkirkhorn/gcd
api common devisor gcd greatest greatest-common-divisor javascript math nodejs
Last synced: 12 months ago
JSON representation
🔢 Get the greatest common devisor of two numbers
- Host: GitHub
- URL: https://github.com/knutkirkhorn/gcd
- Owner: knutkirkhorn
- License: mit
- Created: 2017-11-08T23:41:49.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-03-04T22:46:28.000Z (over 3 years ago)
- Last Synced: 2024-10-11T10:42:04.936Z (over 1 year ago)
- Topics: api, common, devisor, gcd, greatest, greatest-common-divisor, javascript, math, nodejs
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gcd
> Get the [greatest common devisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) of two numbers
## Installation
```
npm install @knutkirkhorn/gcd
```
## Usage
```js
import gcd from '@knutkirkhorn/gcd';
console.log(gcd(28, 2));
// => 2
```
## API
### gcd(number1, number2)
Returns the gcd of ```number1``` and ```number2```.
The gcd is computed using the [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm).
## Related
- [@knutkirkhorn/gcd-cli](https://github.com/knutkirkhorn/gcd-cli) - CLI for this module