How many digits does the integer zero have?

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\times35=1680$ has four digits. These results can be derived from the fact that a $d$-digit number $x$ satisfies $10^{d-1}\leq x\lt 10^d$; $d$ is related to the logarithm of $x$ (in fact, it's $1+\lfloor\log x\rfloor$). For instance, suppose that $x\geq y$, with $x$ a $d$-digit number and $y$ an $f$-digit number (so $d\geq f$); then $10^{d-1}\lt 10^{d-1}+10^{f-1}\leq x+y\leq 10^d+10^f\leq 10^d+10^d=2\cdot 10^d\lt 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}\leq 0$ — but $10^n\gt 0$ for all $n$, so $d$ must be smaller than any number. Likewise, since $0\times 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 $-\infty$ with the properties that $\max(-\infty, d)=d$ and $(-\infty)+d=-\infty$ 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'.


Zero ($0$) is part of the modern number system

This system uses the digits $0\cdots9$, and so $0$ is a digit.

Therefore $0$ has $1$ digit.


In most bases $(b \ne 1)$ it has 1 digit. $$ (0)_b = (0\cdot b^0)_b = 0 $$ Interesting is what happens in base 1: $$ (n)_1 = 1^n $$ e.g. $(2)_1 = 11$ and $(5)_1 = 11111$. It would be tempting to say, it has no digit in base 1: $$ (0)_1 = \epsilon $$ where $\epsilon$ is the empty string. But I do not know if it is handled that way.

Note: This article (in German) on the Unary System gives it as example.

Note: See this question and the first answer, second part, as well: What would base 1 be?