[racket-dev] feature request: gcd, lcm for rationals

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Fri Dec 9 21:08:08 EST 2011

On Dec 9, 2011, at 3:31 PM, Daniel King wrote:

> On Fri, Dec 9, 2011 at 15:27, Carl Eastlund <cce at ccs.neu.edu> wrote:
>> What does "divides" even mean in Q?  I think we need David to explain
>> what his extension of GCD and LCM means here, in that "divisors" and
>> "multiples" are fairly trivial things in Q.
> 
> I don't suppose to understand all the math on this page, but I think
> it uses the same definition that dvh is using.
> 
> http://mathworld.wolfram.com/GreatestCommonDivisor.html

Interesting: the Mathematica people have extended the gcd function from the integers to the rationals, not by applying the usual definition of gcd to Q (which would indeed be silly, as everything except 0 divides everything else), but by coming up with a different definition which, when restricted to integers, happens to coincide with the usual definition of gcd.

I would wonder: is this the ONLY "reasonable" function on rationals which, when restricted to integers, coincides with the usual definition of gcd?


Stephen Bloch
sbloch at adelphi.edu




Posted on the dev mailing list.