Integer.gcd
You're seeing just the function
gcd
, go back to Integer module for more information.
Specs
gcd(integer(), integer()) :: non_neg_integer()
Returns the greatest common divisor of the two given integers.
The greatest common divisor (GCD) of integer1
and integer2
is the largest positive
integer that divides both integer1
and integer2
without leaving a remainder.
By convention, gcd(0, 0)
returns 0
.
Examples
iex> Integer.gcd(2, 3)
1
iex> Integer.gcd(8, 12)
4
iex> Integer.gcd(8, -12)
4
iex> Integer.gcd(10, 0)
10
iex> Integer.gcd(7, 7)
7
iex> Integer.gcd(0, 0)
0