Skip to main content
Log in

Mojo function

lcm

lcm(m: Int, n: Int, /) -> Int

Computes the least common multiple of two integers.

Args:

  • m (Int): The first integer.
  • n (Int): The second integer.

Returns:

The least common multiple of the two integers.

lcm(s: Span[Int, origin], /) -> Int

Computes the least common multiple of a span of integers.

Args:

  • s (Span[Int, origin]): A span of integers.

Returns:

The least common multiple of the span.

lcm(l: List[Int, hint_trivial_type], /) -> Int

Computes the least common multiple of a list of integers.

Args:

  • l (List[Int, hint_trivial_type]): A list of integers.

Returns:

The least common multiple of the list.

lcm(*values: Int) -> Int

Computes the least common multiple of a variadic list of integers.

Args:

  • *values (Int): A variadic list of integers.

Returns:

The least common multiple of the list.