Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a list of the numbers from 1 to 1000.

How can I find the number of 0's, 1's, 2's, and 9's that are used?

The answers are 192, 301, 300, 300 respectively, but I'm interested in the process itself.

Just an explanation for one of these digits will suffice, I'll then be able to solve for the other 3 cases.

share|improve this question
    
I'm guessing this is from 1 to 1000 inclusively? –  Nicolas Villanueva Jun 23 '11 at 17:24
    
Yes, it includes both. –  Chandler Jun 23 '11 at 17:28
add comment

3 Answers 3

up vote 1 down vote accepted

Taking 2's. There are two approaches. First, you can count how many are in each place. There are 1000 numbers in the list. How many 2's are in the ones place? How many in the 10's place? How many in the 100's place.

Second, you can count from the front. How many one digit numbers contain a 2? How many 2 digit numbers start with 2? How many other 2's are there among the 2 digit numbers?

Either works. Probably the first is easier, but in either case you would have to work a bit harder if you were counting up to 2357.

share|improve this answer
    
In the 1's, I would have it as 2, 12, 22, ..., 992. = 10*10 = 100 In the 10's, 20, 120, ..., 920. = 10*10 = 100 In the 100's, 200, 201, ..., 299. = 100 100*3=300 But for 0's I get 102, not 192. I'm getting 10,20,...,990 for 1's, which is 90+1 0's. Then 100,200,...,1000, which is 100 's, and then the 1 0 from 1000 in the 100's place. What am I counting wrong? –  Chandler Jun 23 '11 at 17:41
    
You say you got 90 in the 1's place, but you showed 99 numbers and missed 1000. So there are 100 there. For the 10's place, you get 10 in every block of a hundred, 90, plus the one in 1000=91. Then the one in the hundreds place of 1000=1. Total is 100+91+1=192. –  Ross Millikan Jun 23 '11 at 17:53
add comment

The problem has been solved already, so I will solve a different problem.

Note first that in the original problem the $1000$ kind of sticks out. So I would have preferred dealing with $1$ to $999$. (We can always deal with $1000$ at the end. And to tell the truth I really prefer $0$ to $999$.)

Let's bump the problem up a bit, by going from $0$ to $9999$.

For the sake of symmetry, "pad" the little numbers with initial $0$'s, so that everybody has $4$ digits.

The reason I am doing this is to make stuff as symmetrical as possible: symmetry is our friend.

So the numbers are

$0000$

$0001$

$0002$

and so on, ending with

$9998$

$9999$

Think of any digit, like $7$, or even $0$.

How many $7$'s in total in the units place? Once we have put a $7$ there, we can fill out the rest of the spots in $7^3$ ways.

How many $7$'s in the next place? Again, once you have placed the $7$, there are $10^3$ ways to fill out the rest. Continue. We find that the total number of $7$'s is $$4 \times 10^3.$$

This is also the total number of $0$'s! But some of the zeros have been obtained from the "padding" and should now be removed.

The numbers $0$ to $9$ have a padding of $0$ in the tens place, for a total of $10^1$. The ones from $0$ to $99$ have padding in the hundreds place, for a total of $10^2$. And the numbers $0$ to $999$ have padding in the thousands place, a total of $10^3$. So the number of genuine legitimate $0$'s is $$4 \times 10^3 -(10^1+10^2+10^3).$$

In the case of your problem, the corresponding expression would be $3\times 10^2 -(10^1+10^2)$. This is $190$. But your list started at $1$, which eliminates one $0$, and ended at $1000$, which adds $3$, for a total of $192$.

Generalization: It is easy now to see what the counts would be if we listed, say, all numbers from $0$ to $10^k-1$.

share|improve this answer
add comment

Count the units digits which cycle 1,2 ... 0 an integral number of times. So you know the number of zeros etc in the units position.

Then look at the tens digits, which have a similar cycle, but in batches of ten, and without anything for the integers 1-9 (no leading zeros).

Then the hundreds digits.

Then the single thousands digit.

If you understand the pattern, it should be easy to extend to higher numbers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.