Mojo function
gcd
gcd(m: Int, n: Int, /) -> Int
Compute the greatest common divisor of two integers.
Args:
- βm (
Int
): The first integer. - βn (
Int
): The second integrer.
Returns:
The greatest common divisor of the two integers.
gcd(s: Span[is_mutable, Int, lifetime], /) -> Int
Computes the greatest common divisor of a span of integers.
Args:
- βs (
Span[is_mutable, Int, lifetime]
): A span containing a collection of integers.
Returns:
The greatest common divisor of all the integers in the span.
gcd(l: List[Int, hint_trivial_type], /) -> Int
Computes the greatest common divisor of a list of integers.
Args:
- βl (
List[Int, hint_trivial_type]
): A list containing a collection of integers.
Returns:
The greatest common divisor of all the integers in the list.
gcd(*values: Int) -> Int
Computes the greatest common divisor of a variadic number of integers.
Args:
- β*values (
Int
): A variadic list of integers.
Returns:
The greatest common divisor of the given integers.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
π What went wrong?