by RonPurewal Fri Apr 18, 2008 9:11 pm
so clearly you aren't going to come up with some magic formula for solving problems like these - or at least if you did, you'd need a separate formula for just about every single type of problem.
so, this is a problem about organized counting. the idea is to find a systematic way of listing / counting the possibilities.
here is one such systematic method. (by no means is this the only way.)
first, read the problem carefully: you're looking for the total number of 7's that would appear if you wrote all the numbers in a fat list; you are not looking for the number of different integers that feature the digit 7. so, for instance, when you write the number 777, that counts three times, not just one.
notice that this actually makes the problem easier, because you can consider the different digit places separately, without regard to whether they appear more than once in the same number.
so:
hundreds place: you'll write the digit 7 in this place a hundred times, once each in the numbers 700 through 799.
tens place: you'll write the digit 7 a hundred more times: 70-79, 170-179, 270-279, ..., 970-979. (and yes, it's ok to count 770-779 again, because this time we're looking at the tens place instead of the hundreds place.)
units place: here are the numbers that involve a 7 in the units place:
7, 17, 27, 37, ..., 977, 987, 997.
this is basically the list 0, 1, 2, ..., 99, with red 7's tagged onto the end of each number; that's hundred times again.
100 + 100 + 100 = 300 times.