How many digits does the integer zero have?

Should zero be classified as having no digits, or 1 digit?

• For what purpose? Typographically (to see how much space it takes to write): $1$ digit. Did you have some other purpose in mind? – GEdgar Mar 9 '15 at 17:14
• I think you are combining different notions. Numbers don't have digits. Representations of numbers have digits, and the representation of the number zero in arabic numberals is the character 0, which is a single digit. – Jonny Mar 9 '15 at 17:14
• If this were a poll, then $-\infty$ should be an option. – DanielV Mar 9 '15 at 17:19
• @DanielV If this were a pole, $-\infty$ would be an option. – Kimball Mar 10 '15 at 6:32
• Many people are confidently saying that zero has one digit, with the justification that there's 1 digit visible in the number. With this logic, one could say that the number "11" has 3 digits (011), 8 digits (00000011), so on and so forth. – user3932000 Mar 10 '15 at 17:46

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.

• This seems to answer the trivial question of the number of digits of "$0$ as a decimal digit", but I OP seems to be asking about "$0$ as a number". – Travis Willse Mar 10 '15 at 3:11
• @Travis How did you arrive at that conclusion? OP's question provides almost no information about what they really want to know, or why. – JLRishe Mar 10 '15 at 10:48
• @JLRishe I agree OP didn't provide much context, but the question says "the integer zero", not "the digit zero". But Jonny's objection in the comments on the question itself are even better, in that even this is a priori ambiguous: most, e.g., integers, have different numbers of digits in different bases. – Travis Willse Mar 10 '15 at 10:59

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'.

• Couldn't you also draw a parallel with logarithms? That's how I usually think of it, and $\log 0=-\infty$. You could say that $(\textrm{Number of digits of }x\textrm{ in base }b)=\left\lfloor\log_b|x|\right\rfloor+1$. – KSmarts Mar 9 '15 at 18:36
• @KSmarts To be sure, and I may revise this answer to note that that's where it comes from - I just didn't want to assume that logarithms were within OP's mathematical knowledge. (Which doesn't explain why I went into polynomials, but...) – Steven Stadnicki Mar 9 '15 at 18:47
• @anotherguy The problem is that using positive infinity breaks the rule for sums - whatever the mystery quantity $\star$ that we use to denote the number of digits of $0$ is, it needs to satisfy $\max(\star, d)=d$ for all $d$. – Steven Stadnicki Mar 10 '15 at 6:05
• Making a nonsensical definition in order to satisfy a theorem seems backwards to me. Isn't that basically what they did in the Indiana Pi Bill? I recognize that there may be practical applications for this, but answering "negative infinity" when asked how many digits 0 has doesn't really make sense. – JLRishe Mar 10 '15 at 10:46
• @JLRishe (re: "math text", just use $0$ not '0'.) Definitions of this sort are as you say made to "ensure continuity". Regarding $0!$, this is equal to $1$ because it is an empty product. The product of $0$ and the whole numbers less than $0$ is the product of $0$ and an empty product which is $0\cdot 1=0$, or it is the product of the single number $0$ which is $0$. Either way there is no contradiction. – Mario Carneiro Mar 10 '15 at 18:34

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?

• A base $b$ positional system uses digits from $0$ to $b-1$. A base $1$ positional system would therefore only use the digit $0$ — not very useful. Your "base $1$" system rather is the simplest additive number system, that is, it belongs to a wholly different class of number system. It doesn't really make sense to classify it as "base 1". – celtschk Mar 9 '15 at 23:39
• The common ground is using $b$ different symbols as digits. – mvw Mar 10 '15 at 9:10
• So you'd consider an additive system that uses only the symbols "I" for 1 and "X" for 10 (so e.g. XXIII is 23) as base 2, because it uses 2 symbols? – celtschk Mar 10 '15 at 9:19
• You seem to object that the term "base b" should be used exclusively for positional systems, but that seems not to be how it is used, see the second limk. – mvw Mar 10 '15 at 10:00
• @celtschk There is one sense in which unary numbers can be viewed as base-$1$ as an extension of other bases: every number can be written in base $1$ as $\sum_{i=0}^k1^ia_i$. The difference is that you are forced to drop the requirement $0\le a_i<1$ and instead use $a_i=1$, but the multiplier is still a power of $1$. – Mario Carneiro Mar 10 '15 at 17:49

Zero is conventionally written as $0$ to avoid confusion. If you saw

$$e^{i\pi}+1=$$

you would think, "Yes, what is the answer? Is it zero or have you forgotten to finish the equation?".

However, in a computing context, it would be perfectly acceptable to use zero digits for $0$.

Say this was a (line of a) CSV file:

-3,-2,-1,,1,2,3

So long as every field was understood to be a number, the middle one, represented by the empty string, would be read as zero.

• The behaviour depends upon the software reading the CSV file. In R, for example, if you import that line of a CSV file it would treat the missing value as a missing value, not zero. – Richie Cotton Mar 10 '15 at 11:04
• @RichieCotton, that is true. I am assuming you have control over the software reading the file. – Hugh Allen Mar 10 '15 at 13:48

In term of storage for computation purposes zero takes the size of a digit. However, the correct answer is probably the number system you are dealing with. I am not sure if there does exist a number system without zero in this modern era but there are several number systems such as binary and decimal number system in which zero is considered as a digit.

The answer is -1, please let me show You why.

In binary there is one integer with one digit, two integers with two digits, four integers with three digits and so on, so there always are $$2^(n-1)$$ integers with n digits.

So there must be $$2^(0-1)$$ = 1/2 integers with 0 digits, $$2^(-1-1)$$ = 1/4 integers with -1 digits and so on. 1/2 + 1/4 + 1/8 + ... add up to 1, and because the number zero is next to the number 1, its numbers of digits has to equal to the following infinite sum:

inf Sigma -n/2^(n + 1) = -1 n = 0 $$\sum_{n=0}^∞ \frac{-n}{2^(n+1)} = -1$$

qed.

This logic works with any base, not just binary, but it's the easiest example.