# What is the probability that 5 digit number divisible by 6?

The main constraint is that each digit can only take digits from {1,2,3,4,5}. So the sample space will be 5$^{5}$.

What is the probability that a random number taken from this sample space will be divisible by 6?

Thanks.

-
If you wanted a rough guess, I'd go with 1/6. If you want a better guess, a number is divisible by 6 if and only if it is divisible by 2 and by 3. 2 is easy because that means the number needs to end in 2 or 4. 3 means the digits have to add up to a multiple of 3. So, count the number of numbers satisfying these contraints. –  Graphth Feb 17 '12 at 11:52
Only two-fifths of the numbers will be even, so a slightly less rough rough guess would be two-fifteenths. –  Gerry Myerson Feb 17 '12 at 12:10
@Graphth: Counting such numbers is the biggest challenge. If u can give a method for the counting even in a rough manner, it would be great. –  Maverickgugu Feb 17 '12 at 12:19
As you can see, @Gerry's estimate agrees with Didier's answer to within 0.2%. –  Willie Wong Feb 17 '12 at 15:38
@Willie, another way to put it is that two-fifteenths of 3125 is 416-and-two-thirds, while Didier's count is 416. –  Gerry Myerson Feb 17 '12 at 22:38

$$\color{red}{416/3125}=0.13312.$$ The last digit must be $2$ or $4$, this happens with probability $2/5$. The sum of the four other digits must be $\pm1\pmod{3}$, according to the last digit being $2$ or $4$. Since both events have the same probability, the answer is $2/5$ times the probability that the sum $s$ of four digits is $1\pmod{3}$, that is, $s=-2$ or $s=+1$ or $s=+4$.

$s=+4$ corresponds to $+1,+1,+1,+1$, with probability $2^4/5^4$.

$s=+1$ corresponds to $0,0,0,+1$, or $0,+1,+1,-1$ in whatever order. In the first case, one must place the $+1$, thus $4$ cases, with probability $2/5^4$ each. In the second case, one must place the $0$ and the $-1$, thus $12$ cases, with probability $2^3/5^4$ each.

$s=-2$ corresponds to $+1,-1,-1,-1$, thus $4$ cases, with probability $2^4/5^4$ each, or to $0,0,-1,-1$, thus $6$ cases, with probability $2^2/5^4$ each.

Summing up, the answer is $(2/5)\cdot(2^4+4\cdot2+12\cdot2^3+4\cdot2^4+6\cdot2^2)/5^4$.

-
that was a neat one. :) –  Maverickgugu Feb 17 '12 at 13:14

That probability is 1/6-P. Where P is the probability of a number be ( in this range) lesser than the first (minor) 6 multiple (in this range) or greater than the last (major) 6s+5 number (in the range).

Evaluate P.

-