Hacker News new | ask | show | jobs
by thaumasiotes 2127 days ago
> (Note that since all integers evenly divide 0, GCD(a,0) = a for all a.)

Nonzero a, that is.

1 comments

GCD(0,0) exists in any commutative ring by definition (and is not unique) :)

d is a common divisor of a,b if there exists x,y such that dx = ay, and d is a GCD of a,b if all divisors c divide d. So there exist many such x where GCD(0,0) = x (including x = 0).

> d is a common divisor of a,b if there exists x,y such that dx = ay

    d = 9
    a = 3
    b = 537
    x = 1
    y = 3

    dx = 9(1) = 9
    ay = 3(3) = 9 = dx
You can't actually have meant this? You're claiming that 9 is a common divisor of the pair (3, b), where b is any value. It's not even a divisor of 3.
If you define GCD this way then writing gcd(a, b) = c is an abuse of notation :)