An open API service indexing awesome lists of open source software.

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: 5 months ago
JSON representation

🔢 Get the greatest common devisor of two numbers

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