# “short” way to this combinatorics problem

I just started to learn combinatorics,i bump into this question. how many $n\in\Bbb N$ numbers that are $>65000$ and have different digits.

first of we can see that we cant have a number with more then $10$ digits so lets break it in to cases

$5$ digits: we have $3 \cdot 9!/5!$ (when we have $7,8,9$ in the $5'$th cell)+$4 \cdot 8 \cdot 7 \cdot 6$(when we have $6$ in the $5'$th

now I can refer in each case 6-10 ($d=10-$ number of digits) digits that each of them start with $9 \cdot 9!/d$ so we get total of $$9\sum_{d=0}^4 \frac{9!}{d!}$$

so Of course now its look simple but i had to break it into $5$ cases,but now i wonder if there is any way to address all this $5$ cases at once,maybe to have $10$ option for each cell,now including $0$ that can repeat it self and then to throw the extra option i got now by to compute how many different options i can set the "$0$" within the $5'th-10'th$ cells i try to figure it out but i got nowhere ill be glad if some one can show me

• Be careful. You have not counted the numbers with a $6$ in the ten thousands place and a $5$ in the thousands place. – N. F. Taussig Mar 29 '15 at 18:35
• Do you mean $n < 65000$? – Keivan Mar 29 '15 at 18:52
• Typo: here $d$ must be replaced by $d!$. Btw, I can't find any mistake in your solution. The term $4.8.7.6$ comes from the $4$ possibilities $65...$,$67...$, $68...$ and $69...$. Maybe @N.F.Taussig counted on $5$ possibilities (overlooking that $66...$ is not a possibility)? – drhab Mar 29 '15 at 19:40
• @drhab You are correct. My apologies. – N. F. Taussig Mar 29 '15 at 19:54
• @drhab you right of course,my bad i forgot ,but any way the reason i post it is to ask if there is way to compute the second part without to take any case separately beacuse that's how i got to my answer – DORR Mar 30 '15 at 6:13

• The amount of $5$-digit numbers is $\binom83\cdot3!= 336$
• The amount of $6$-digit numbers is $\binom91\cdot\binom95\cdot5!= 136080$
• The amount of $7$-digit numbers is $\binom91\cdot\binom96\cdot6!= 544320$
• The amount of $8$-digit numbers is $\binom91\cdot\binom97\cdot7!=1632960$
• The amount of $9$-digit numbers is $\binom91\cdot\binom98\cdot8!=3265920$
• The amount of $10$-digit numbers is $\binom91\cdot\binom99\cdot9!=3265920$