The OpenD Programming Language

lcm

Computes the least common multiple of a and b. Arguments are the same as gcd.

  1. typeof(Unqual!(T).init % Unqual!(U).init) lcm(T a, U b)
  2. auto lcm(T a, T b)
    lcm
    (
    T
    )
    (
    T a
    ,
    T b
    )
    if (
    !isIntegral!T &&
    is(typeof(T.init % T.init))
    &&
    is(typeof(
    T.init == 0 ||
    T.init > 0
    ))
    )

Return Value

Type: auto

The least common multiple of the given arguments.

Examples

assert(lcm(1, 2) == 2);
assert(lcm(3, 4) == 12);
assert(lcm(5, 6) == 30);

Meta