# Help me formalize this calculation

I needed to find the number of five digits numbers that are made of numbers from $0,1,2,3,4,5$ and are divisble by 3. One of the proper methods can be, that $0+1+2+3+4+5 = 15$ So we can pick out either $3$ or $0$ from this set. For picking out $0$ there are $5!$ numbers and for picking out $3$ there are $5!$ numbers $4!$ of which are 4 digit numbers, so the total number is $5!+5!-4! =216$

I tried a rough estimate before the above (correct) solution. I need your help as I think it can formalized and used as a valid argument.

There are $^6C_5\times5!=720$ total $5$-digit numbers (including $4$-digit numbers with digits from one to five) Roughly a third of them, i.e $\approx 240$ should be divisble by three. Of these, roughly a tenth $\approx 24$ should be $4$-digit and hence the answer should be close to $\approx 216$.

I thought my answer should be close plus or minus some correction as this was very rough. The initial set of numbers has only $2$ of total $6$ numbers that are divisible by $3$ and it is not uniform and does not contain all digits $0$-$9$, but I get an exact number. How do I state this more formally? I need to know this as I use these rough calculations often.

"Formal" would be an argument that would allow me to replace the "approximately equal to" symbols in the third paragraph by equality symbols.

-
What is not clear to me is if you accept numbers with repeated digits in your list, or not.For instance, 33240 (which is divisible by 3) is to be counted or not? –  Andrea Mori Jul 10 '11 at 1:00
@Andrea no repeated digits, sorry for not mentioning that. –  kuch nahi Jul 10 '11 at 1:02
I think your argument in the first paragraph is formal enough as-is, but maybe that's just me. –  anon Jul 10 '11 at 3:35
@Kuch: But many of those numbers are irrelevant, since they use digits from the set $\{6,7,8,9\}$: they aren't possible choices. By your reasoning, if you'd been working in base $20$, you'd have reduced the $240$ by $1/20$-th, even the problem is completely unchanged. Basically, you got a very good estimate because you made a mistake in your reasoning! –  Brian M. Scott Jul 10 '11 at 6:12
@anon: The question is about formalizing the original argument, not the correct one in the first paragraph. –  joriki Jul 10 '11 at 7:04

In a sense, you argued probabilistically and disregarded the correlation between the two events of the number being divisible by $3$ and the number starting with $0$. These are correlated, since fewer of the numbers that are divisible by $3$ can start with $0$ (since half of them don't contain the $0$) whereas all of the ones that aren't can.
Now what got you the right result was that you estimated, for the wrong reasons, that the probability of the number starting with $0$ was $1$ in $10$. The correct conditional probability, given that the number is divisible by $3$, is indeed
$$\frac12\cdot\frac15+\frac12\cdot0=\frac1{10}\;,$$
where the factors $1/2$ are the probabilities of taking out at $0$ or a $3$, respectively, to get a set of digits with sum divisible by $3$, and $1/5$ and $0$ are the probabilities of a zero being the leading digit in those two cases, respectively.