MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / CoPrimeCheck

Function CoPrimeCheck

Maths/CoPrimeCheck.js:21–27  ·  view source on GitHub ↗
(firstNumber, secondNumber)

Source from the content-addressed store, hash-verified

19 * @returns return correspond boolean value, if both number are co-prime return `true`, else return `false`.
20 */
21const CoPrimeCheck = (firstNumber, secondNumber) => {
22 /*
23 This is the most efficient algorithm for checking co-primes
24 if the GCD of both the numbers is 1 that means they are co-primes.
25 */
26 return GetEuclidGCD(firstNumber, secondNumber) === 1
27}
28
29export { CoPrimeCheck }

Callers 2

isCorrectFormatFunction · 0.90

Calls 1

GetEuclidGCDFunction · 0.90

Tested by

no test coverage detected