Implementation
Elixir

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "math/big"
gcd.GCD(nil, nil, a, b)
x.Div(a, gcd).Mul(x, b)
from fractions import gcd
x = (a*b)//gcd(a, b)
extern crate num;

use num::Integer;
use num::bigint::BigInt;
let x = a.lcm(&b);
x = lcm(a, b);

int lcm(int a, int b) => (a * b) ~/ gcd(a, b);

int gcd(int a, int b) {
  while (b != 0) {
    var t = b;
    b = a % t;
    a = t;
  }
  return a;
}
x = a.lcm(b)
x = lcm a b
import std.numeric: gcd
uint x = (a * b) / gcd(a, b);