Created
November 18, 2022 16:53
-
-
Save Hermann-SW/46c0ed01a59ebaec354b1b7e1c31a13b to your computer and use it in GitHub Desktop.
greatest common divisor / lowest common multiple
This file contains 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
define gcd_(a, b) { | |
if (b==0) return a | |
return gcd_(b, a%b) | |
} | |
define gcd(a, b) { | |
if (a<b) return gcd_(b, a) | |
return gcd_(a, b) | |
} | |
define lcm(a, b) { | |
return a*b/gcd(a,b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
powm() here:
https://gist.github.com/Hermann-SW/aefd972ef795347bd5cc7ec4557a769f