gcd

infix fun Int.gcd(other: Int): Int

Computes the greatest common divisor (GCD) of two integers using the Euclidean algorithm.

Return

The GCD of the two integers.

Receiver

The first integer.

Parameters

other

The second integer.


tailrec fun gcd(a: Int, b: Int): Int

Function to find the greatest common divisor (GCD) of two numbers.

Return

The GCD of the two numbers.

Parameters

a

The first number.

b

The second number.