Created
January 13, 2024 16:46
-
-
Save NyaGarcia/9843a24afec87ae4665c0ef9818b23c5 to your computer and use it in GitHub Desktop.
Recursive Euclidean algorithm to calculate Greatest Common Divisor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calculateGreatestCommonDivisor(a: bigint, b: bigint) { | |
if(b === 0n) { | |
return a; | |
} | |
return calculateGreatestCommonDivisor(b, a % b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment