Guest User

Untitled

a guest
Dec 16th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. function gcd(m, n) {
  2. while (true) {
  3. m %= n;
  4. if (m === 0) {
  5. return n;
  6. }
  7. n %= m;
  8. if (n === 0 ) {
  9. return m;
  10. }
  11. }
  12. }
  13.  
  14. function gcdlcm(a ,b) {
  15. var n = gcd(a,b);
  16. return [n, a * b / n];
  17. }
Add Comment
Please, Sign In to add comment