💾 Archived View for gemini.locrian.zone › library › stackexchange › zero_digits.gmi captured on 2023-11-14 at 08:55:46. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
Original question on math.stackexchange by user107952
Should zero be classified as having no digits, or 1 digit?
As noted, the answer depends a lot on what you’re using it for. For writing the number zero out, it clearly has one digit — but for some applications, it’s useful to say that zero has ‘negative infinity’ digits!
How’s that? Well, it’s a theorem that the count of digits in a sum of two (positive, nonzero) numbers is equal to the count of digits in the larger number (possibly plus one), and the count of digits in a product of two (positive, nonzero) numbers is equal to the sum of the count of digits of the two numbers (possibly minus one). For instance, 48 and 35 each have two digits, and 48×35=1680 has four digits. These results can be derived from the fact that a d-digit number x satisfies
10^(d−1) ≤ x < 10^d
— d is related to the logarithm of x (in fact, it’s 1+⌊logx⌋). For instance, suppose that x≥y, with x a d-digit number and y an f-digit number (so d≥f); then
10^(d−1) < 10^(d−1)+10^(f−1) ≤ x+y ≤ 10^d + 10^f ≤ 10^d + 10^d = 2⋅10^d < 10^(d+1)
so x+y must be either d or d+1 digits (and it’s easy to see that both can happen).
Now, the same rules can be extended sensibly to allow the numbers to be positive or zero — but only if we define the count of digits of zero to be negative infinity! This makes sense when you consider the inequality that we mentioned; if 0 had d digits, then logically we must have
10^(d−1) ≤ 0
— but 10n>0 for all n, so d must be smaller than any number. Likewise, since 0×x=0 for all x, then if 0 has d digits it must also have either d+f−1 or d+f digits (where f here represents the digit-count of x) for all f. No real number satisfies this, but if we say that the digit-count of zero is a new number −∞ with the properties that max(−∞,d)=d and (−∞)+d=−∞ for all d, then we can maintain the properties of our digit-counting function.
A generalization of this idea shows up in the notion of the degree of a polynomial, where we special-case the zero polynomial in similar fashion and say that it has ‘degree negative infinity’.