Instance method
# gcdlcm
Returns an array with the greatest common divisor and the least common multiple of the two integers, [gcd, lcm].
How to use
Quick guide
Official content
Official how?
I scraped all this data from the official documentation. I created this site to make it easier for beginners and more pleasant for professionals to use Ruby.
Georgie boy
Creator of ruby-docs.org
Returns an array with the greatest common divisor and the least common multiple of the two integers, [gcd, lcm].
36.gcdlcm(60) #=> [12, 180]
2.gcdlcm(2) #=> [2, 2]
3.gcdlcm(-7) #=> [1, 21]
((1<<31)-1).gcdlcm((1<<61)-1) #=> [1, 4951760154835678088235319297]
VALUE
rb_gcdlcm(VALUE self, VALUE other)
{
other = nurat_int_value(other);
return rb_assoc_new(f_gcd(self, other), f_lcm(self, other));
}
Was this page useful?
Leave your feedback
Please hit 'submit' to confirm your feedback.
Leave your feedback
Please hit 'submit' to confirm your feedback.