You write down all of the integers from 1 to 1,000,000. How many times did you write the digit 4?
I get $\displaystyle \sum_{n=0}^{6}10^{n}$
Is this correct?
One integer in every ten has a 4 in the units position. That gives $\displaystyle 10^5$ 4s in the units position (in the integers from 1 to $\displaystyle 10^6$). 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 $\displaystyle 10\times10^4 = 10^5$ (again) 4s in the tens position. And so on. There will be a total of $\displaystyle 10^5$ 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.
$\displaystyle 4XXXXX$
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 $\displaystyle 10^5$
$\displaystyle Y4XXXX$
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 $\displaystyle (9)10^4+10^4=(10)10^4=10^5$
$\displaystyle YY4XXX$
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 $\displaystyle 10^210^3=10^5$
$\displaystyle YYY4XX$
The number of 4's in this position is $\displaystyle 10^310^2=10^5$
$\displaystyle YYYY4X$
The number of 4's in this position is $\displaystyle 10^410=10^5$
$\displaystyle YYYYY4$
The number of 4's in this position is $\displaystyle 10^5$
The total number of 4's is $\displaystyle (6)10^5$