GCD in Fractions

Terry Reedy tjreedy at udel.edu
Wed Sep 24 19:42:04 CEST 2014

On 9/24/2014 7:44 AM, Steven D'Aprano wrote:
> blindanagram wrote:
>> Seccondly (as others here have pointed out), the mathematical properties
>> of the greatest common divisor are well defined for both positive and
>> negative integers.
> You keep saying that, but it simply is not true. Different people use
> different definitions. Some refuse to allow negative arguments at all. Some
> insist that the GCD must be positive. Others allow it to be negative.

[convincing evidence of the above snipped]

The negative of the greatest common divisor is the least common divisor 
(when the range includes negative integers).  If a 'gcd' is allowed to 
be negative, one must re-interpret 'gcd' as abbreviating 
'greatest-magnitude common divisor'.  It then might be better called 'gmcd'.

Terry Jan Reedy

More information about the Python-list mailing list