# Typing out all integers from $1$ to $10,000$

Imagine you used a numeric keypad to type out all the integers from $1$ to $10,000$ (inclusive). What is the result when you subtract the digit on the keypad used least often from the digit on the keypad used most often (most minus least)?

Attempt:

First note that each of the digits $1,2,\ldots,9$ occur the same number of times by symmetry if we count up to $10,000$ exclusive. We note that since $0$ doesn't appear as the first digit it must appear the least number of times. Thus, since $10,000$ contains $1$, the digit $1$ occurs most often and $0$ occurs least often giving an answer of $1-0 = 1$.

• This is correct. – JMoravitz Nov 22 '16 at 0:07
• You should mention that $0$ appears so many fewer times that the fact that it appears four times in $10\,000$ doesn't matter. – Arthur Nov 22 '16 at 0:12
• As a user with 2,536 reputation, please read the tag description for number-theory and do not use it for this kind of question. I'll give you a pass though because this is a rather hard question to tag. – 6005 Nov 22 '16 at 0:16
• Sounds fine to me. One can if one wishes tell precisely how many times each digit appears but that's just confirmation. Your logic is perfect. – fleablood Nov 22 '16 at 1:35
• Okay... no-one asked but. Each of the digits 1-9 occur in each of the positions right 4 positions exactly 1000 times each. 0 never appears in a position as a leading digit so 0 appears in each of the four positions 999 times. 1 is the only digit that appears in the 5th left position and it appears once. So 2-9 appear 4000 times, 1 appears 4001 times. And 0 appears 3996 times. – fleablood Nov 22 '16 at 1:42

You have reasoned correctly and your solution is correct.

The one part that needs clarification (as has been pointed out in the comments) is

We note that since $0$ doesn't appear as the first digit it must appear the least number of times.

I think this should be clarified:

In typing out $1$ through $1000$, if we had typed the leading $0$s (like $001, 002, 003,$ etc.) then we would have counted every digit $0$ through $9$ an equal number of times, not counting the one extra $1$ in $1000$. So we are missing a number of zeros equal to the number of leading zeros we left off. There is certainly at least one leading zero we left off, thus there are fewer zeros than there are any of the digits $2$ through $9$.

• @Puzzled417 That reasoning works as well! – 6005 Nov 22 '16 at 0:26
• I don't think that is relevent and doesn'doesn't need stating. All columns go from 1 through 9 to 0, so the zero appearrng the last case doesn't imply 0s are any more common than any other number. After all, 9 appears three times in 999 but we didn't need to single that out. And 8 appears three times in 888 .... – fleablood Nov 22 '16 at 1:47
• @fleablood I was thinking the numbers went from $0$ to $1000$. Since they go from $1$ to $100$, you're right, we should instead count $1000$ as contributing three zeros. But if you read the original post, you will see the OP argued that there were an equal number of digits $1-9$ in the numbers $1$ through $999$, so the way he/she argued it, you need to worry about the extra three $0$s. – 6005 Nov 22 '16 at 1:49
• @fleablood I edited the post, do you agree with it now? – 6005 Nov 22 '16 at 1:52