From: "erlercw@..." Date: 2004-11-14T10:48:21+09:00 Subject: Re: mathn.rb is unacceptably slow (proposed replacements) ># Use a Euclidean GCD algorithm >def gcd2(other) > min, max = [self.abs, other.abs].sort > min, max = max % min, min while min > 0 > max >end Now that I think of it, # Use a Euclidean GCD algorithm def gcd2(other) min = self.abs max = other.abs min, max = max % min, min while min > 0 max end will be even faster. The sort isn't really needed, min = max % min will ensure that min is the true minimum in one step.