method

gcd

v1_9_3_392 - Show latest stable - Class: Integer
gcd(p1)
public

Returns the greatest common divisor (always positive). 0.gcd(x) and x.gcd(0) return abs(x).

For example:

2.gcd(2)                    #=> 2
3.gcd(-7)                   #=> 1
((1<<31)-1).gcd((1<<61)-1)  #=> 1