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