knutkirkhorn / gcd

🔢 Get the greatest common devisor of two numbers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gcd

Get the greatest common devisor of two numbers

Installation

npm install @knutkirkhorn/gcd

Usage

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.

Related

About

🔢 Get the greatest common devisor of two numbers

License:MIT License


Languages

Language:JavaScript 67.8%Language:TypeScript 32.2%