How many five-digit numbers can be formed using the digits 1-9 which have at least three identical digits? How many five-digit nos. can be formed using the digits 1-9 having at least three identical digits?
My attempt: 
Total no. of possible nos. with no restrictions $=9^5$
No. of numbers having two identical digits$=9\times 8^4$
Hence the answer should be
$( 9^5)-(9\times 8^4) = 22185$
Is this correct? If not then please suggest alternate method.....Thanks in advance!!
 A: First approach: Pick which three spots host the identical digits; there are $\binom53$ ways to do this. Fill those three spots in one of $9$ ways, and then fill the other two spots in any of $9$ ways. Thus, $\binom53\times 9^3$
Problem with this approach: the number $12222$ has been counted $4$ times, once as $1\color{red}{222}2$, once as $1\color{red}{22}2\color{red}{2}$, once as $1\color{red}{2}2\color{red}{22}$, and once as $12\color{red}{222}$. Similarly, a number such as $44444$ has been overcounted by a factor of $\binom53$.
This can be fixed by subtracting out the repetitions. There are $5\times 9\times 8$ numbers with exactly $4$ digits identical, and $9$ numbers with exactly $5$ digits identical.
Thus: $\binom53\times 9^3 - (5\times 9\times 8)\times(4-1) - 9\times\left(\binom53 - 1\right)$
This comes out to $7290 - 1080 - 81 = 6129$

Doublecheck: Count the numbers with exactly $3$ identical digits, then the ones with exactly $4$, then the ones with exactly $5$:
$\binom53\times 9\times 8\times 8 + \binom54\times 9\times 8 + 9$
which comes out to: $5760 + 360 + 9 = 6129$
