# How many numbers containing the digit 1.

1. Mar 25, 2009

### sutupidmath

How many numbers containing the digit 1.Help!

Hello,

The question i am dealing with is this:Considering the integers from 1 to 10,000,000,000, answer the following two questions:
A. Is the number of integers that include the digit 1 greater or less than the number of integers that do not include the digit 1?
B. What is the difference between number (quantity) of integers that include the digit 1 and the number of integers that do not include the digit 1?

a. There are 6513211999 that include 1 as a digit, and there are 3486788001 numbers that don’t contain digit of 1.

Therefore, there are more numbers that contain the digit 1 than not.

b.3026423998

Reasoning:

After some trials, i came up with the following recurrence relation:

$$a_1=19,.. a_2=100,.. a_{2n}=(10)^{n+1}.. and... a_{2n+1}=8*\sum _{i=1}^{2n-1} a_i$$

Now the total sum of the numbers that contain digits is calculated by summing up the following:

$$a_{14}+\sum_{n=1}^{6}[a_{2n}+a_{2n+1}]= = a_{14}+\sum_{n=1}^{6}[ a_{2n}+(8*\sum _{i=1}^{11} a_i) ]$$

I don't know whether there is supposed to be a more clever and including less calculations method for doing this.

FIrst, is the answer correct? ANd second if yes, does my reasoning make sense?

Last edited: Mar 25, 2009
2. Mar 25, 2009

### CRGreathouse

Re: How many numbers containing the digit 1.Help!

Let's look at the numbers from 0 to 9,999,999,999 instead. There are ten digit positions, each of which is filled with exactly one digit (including leading zeros). There are b^10 ways to fill them with b digits. When b=10, that says that there are 10^10 numbers in the range. When b = |{0, 2, 3, 4, 5, 6, 7, 8, 9}| = 9...

Hope you don't feel too for missing that.

3. Mar 25, 2009

### sutupidmath

Re: How many numbers containing the digit 1.Help!

THe deal is that, i truly believe that my method is correct, since it is even compatible with the one you just described. But, i think i might have done some mistaces in calculations, while adding stuff.

FOr example let's look at numbers between 0-9999

so according to the method you just described, we would have b^4, since there are 4 digit positions to be filled with b digits. When b=10=> 10^4=10000, and 9^4=6561

So, the number of 1'nes will be 10000-6561=3439.

Which is exactly the same result that i get if i apply the method i 'invented'.

Let's look at it.

$$a_1=19,.. a_2=100,.. a_{2n}=(10)^{n+1}.. and... a_{2n+1}=8*\sum _{i=1}^{2n-1} a_i$$

we would have n=0,1,2.

$$a_1+a_2+a_3+a_4+a_5=19+100+8*19+1000+8*[a_1+a_2+a_3]=1271+8*271=3439$$

Which is the same as above.

So, i think i should have done some mistakes while adding stuff.

But the way you pointed out is much easier and way more clever as well.

4. Mar 26, 2009

### matt grime

Um, we can't comment on your reasoning because you've given none. You have just written down some sequence a_i without justification, so it's impossible to say if the a_i were correct in spirit but incorrect in practice.

5. Mar 26, 2009

### CRGreathouse

Re: How many numbers containing the digit 1.Help!

That was my conclusion, since your number was very close to mine.

It only seemed clever because you didn't know it took me > 10 minutes to come up with it. But it is easier.