概要
Integer#gcd
詳細
最大公約数を取得します。
gcd = the Greatest Common Divisor
サンプルコード
# encoding: utf-8 require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS 2.gcd 4 2.gcd -4 2.gcd 0 0.gcd 2 12.gcd 24 EOS __END__ 下記はTbpgrUtils gemの機能 bulk_puts_eval https://rubygems.org/gems/tbpgr_utils https://github.com/tbpgr/tbpgr_utils
出力
2.gcd 4 # => 2 2.gcd -4 # => 2 2.gcd 0 # => 2 0.gcd 2 # => 2 12.gcd 24 # => 12