Created
December 20, 2016 06:28
-
-
Save martinheidegger/4951b047db7ab1ade54d5693c42959e9 to your computer and use it in GitHub Desktop.
Calculates the least common multiple of two numbers.
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
module.exports = (a, b) => { | |
let ax = a | |
let bx = b | |
while (ax != bx) { | |
if (ax < bx) { | |
ax += a | |
} else { | |
bx += b | |
} | |
} | |
return ax | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment