11 | | But I am not 100% sure whether that approach is mathematically sober. |
| 11 | Let R be an integral domain, assume that it provides gcd and lcm, and let F be its fraction field. Since R has gcd, we can assume that `x.numerator()` and `x.denominator()` are relatively prime for any element x of F. |
| 12 | |
| 13 | Then, define |
| 14 | {{{ |
| 15 | gcd(x,y) = gcd(x.numerator(),y.numerator())/lcm(x.denominator(),y.denominator()) |
| 16 | lcm(x,y) = lcm(x.numerator(),y.numerator())/gcd(x.denominator(),y.denominator()) |
| 17 | }}} |
| 18 | |
| 19 | '''__Benefits__''' |
| 20 | |
| 21 | If that approach is mathematically sober, we obtain the following equalities up to units in R: |
| 22 | |
| 23 | * `gcd(x,y)*lcm(x,y)==x*y`, for any x,y in F, provided that the equality holds for any x,y in R. |
| 24 | * `gcd(F(x),F(y))==gcd(x,y)` and `lcm(F(x),F(y))==lcm(x,y)` for any x,y in R. |
| 25 | |