Skip to main content

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:

Int: The least common multiple of the two integers.

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

Computes the least common multiple of a span of integers.

Args:

  • ​s (Span): A span of integers.

Returns:

Int: The least common multiple of the span.

lcm(*values: Int) -> Int

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

Args:

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

Returns:

Int: The least common multiple of the list.

Was this page helpful?