You write down all of the integers from 1 to 1,000,000. How many times did you write the digit 4?
I get
Is this correct?
One integer in every ten has a 4 in the units position. That gives 4s in the units position (in the integers from 1 to ). Ten integers in every hundred have a 4 in the tens position (in other words, each of the integers ending in 40, 41, ..., 49). That gives (again) 4s in the tens position. And so on. There will be a total of 4s in the hundreds position, in the thousands position, in fact in each of the six positions in a six-digit number. So the total number of 4s that you would have to write, if you wrote down all the integers from 1 to a million would be 600,000.
X may be any value from 0 to 9.
This counts the number of 4's in the given position from 1 to a million, which is
Y can be any value from 1 to 9, X can be any value from 0 to 9.
However Y can also be missing, hence it has 10 possibilities.
The total number of 4's in this position is
Y can be any value from 1 to 9 or missing.
X can be any value from 0 to 9.
The number of 4's in this position is
The number of 4's in this position is
The number of 4's in this position is
The number of 4's in this position is
The total number of 4's is