最大公約数の取得


 Math::Bigintモジュールを使うと最大公約数(GCD: Greatest Common Divisor)を簡単に求めることができます。
use Math::BigInt;

my $gcd = Math::BigInt::bgcd(123456, 42) - 0;
print $gcd, "\n";

関連項目

なし