Digit 5 repetition

1. Apr 17, 2007

f(x)

1. The problem statement, all variables and given/known data
How many times does digit 5 occur in numbers fro 0-1000.

2. Relevant equations

3. The attempt at a solution
This is what i have done.
Total (1,2,3) digit numbers which have digit 5 occuring once in them are-:
$3.^9C_1.^9C_1 = 243$
Total numbers with 5 occuring twice are $^9C_1 = 9$
So, digit 5 occurs 9*2=18 times
Total Numbes with 5 occuring thrice= 1
So digit 5 occurs 3*1=3
Total times digit 5 occurs is 243+18+1=264

Is this correct, specially regarding repetitions or exclusions which i may have made?

2. Apr 17, 2007

HallsofIvy

Staff Emeritus
I would have done this quite differently. first, there is xy5 in every 10 numbers and there are 100 sets of 10 in 1000: 100 such numbers. In addition, there is 5x 9 times (not counting 55) in every 100, and 10 hundreds in 100, so 90 more Finally, every number from 500 to 599 has a 5. leaving out those of the form 5x5 and 55x, that's an additional 81. That makes a total of 100+ 90+ 81= 271 numbers between 1 and 1000 that have at least one digit 5.

3. Apr 17, 2007

drpizza

"Total numbers with 5 occuring twice are $^9C_1 = 9$
So, digit 5 occurs 9*2=18 times"
I think you missed a few numbers on this one...

55, 155, 255, 355, 455, 655, 755, 855, 955
That's 9 numbers with two 5's. But also:
505,515,525,535,545,565,575,585,595
And:
550, 551, 552, 553, 554, 556, 557, 558, 559

Thus, there are 3 locations that the non-5 can be, thus there are
$^9C_1 *3= 9 *3$ numbers with two 5's,
Resulting in a total of 27*2 = 54 5's.

Other than that, I probably would have initially used HallsofIvy's approach as well. However, after reviewing your approach, I think I like it better. (With your approach, your solution would match HallofIvy's solution for the number of distinct numbers with a 5 in it, rather than the number of times "5" occurs:
$3.^9C_1.^9C_1 = 243$
$+3.^9C_1 = 27$
$+1$

But, since you're counting the 5's, you have to multiply that 2nd line by 2 and the 3rd line by 3. Nice.

Last edited: Apr 17, 2007
4. Apr 18, 2007

CarlB

It seems like it can be read two different ways. If you just want to count the number of 5s in the numbers between 0 and 999, then you may as well write the numbers with three digits, that is, from 000 to 999, and then it should be clear that the three digits are independent. This is easy.

More difficult is to count the numbers that have any 5 in them. To do this, you might try instead counting the number of three digit numbers that don't have any 5 in them, and subtract that from 1000.