2008-03-06から1日間の記事一覧
あるプログラムで、「Euclid's algorithm(ユークリッドのアルゴリズム)」としてこのようなPythonのコードで最大公約数(greatest common divisor)をもとめていました。 def gcd(m,n): if m < 1.0: return 1.0 if abs(n) < 0.01: return m return gcd(n,m % …
あるプログラムで、「Euclid's algorithm(ユークリッドのアルゴリズム)」としてこのようなPythonのコードで最大公約数(greatest common divisor)をもとめていました。 def gcd(m,n): if m < 1.0: return 1.0 if abs(n) < 0.01: return m return gcd(n,m % …