The empty sum and empty product have clear, widely accepted definitions. But I can't seem to find any such definition of an "empty GCD".

The GCD, I'm told, is associative. Hence, given a binary GCD function $\gcd(a, b)$, we can define the n-ary GCD function as $\gcd(a, b, c) \equiv \gcd(\gcd(a, b), c)$.

Extending this "below" the binary case, I'm pretty sure no-one would disagree that the unary case, $\gcd(a) = a$, makes sense. Then, can we say that $\gcd(a) = \gcd(a, \gcd())$?

If so, then we need a value $x = \gcd()$ such that $\forall a$, $\gcd(a, x) = a$. It seems to be an accepted convention that $\gcd(a, 0) \equiv a$, and I don't think there's any other candidate.

So, does it make sense to define $\gcd() \equiv 0$?

Motivation: I was implementing an n-ary gcd() function and got curious about whether I should require at least one argument.


Yes, the convention $\gcd \emptyset =0 $ makes sense.

Every integer divides all elements of $\emptyset$ thus the "greatest" among them is $0$, when "greatest" is understood with respect to the partial order given by divisibility, which is the appropriate notion of 'size' in this context.


Define $\gcd(S)$ to be natural number $g$ (if it exists) such that:

  1. $g \mid x$ for every $x \in S$.

  2. For any $d$ such that $d \mid x$ for every $x \in S$, we have $d \mid g$.

Then indeed $\gcd(\{\}) = 0$, and moreover it can be proven that $\gcd(S)$ exists for every set $S \subset \mathbb{Z}$.

Also $\gcd(\{0,0\}) = 0$. (This differs from the other common definition of $\gcd$ as the greatest common divisor in terms of size, which would simply stipulate that $\gcd(0,0)$ is undefined.)