A nine digit number is formed using 1 to 9 without repetition, find the probability of forming a number such that the product of any of its five consecutive digits is divisible by 3 or 5.

Now my approach for solving this problem was to first find out the cases where this would not be possible.

If the product of five consecutive digits is divisible by 3 or 5, then the digits must have atleast a multiple of 3 i.e. 3,6 or 9 or 5 as one of the 5 digits. The only case where this would not be possible would be when the special digits {3,6,9,5} are all huddled at one end of the number taking 4 of the 9 available spaces.

Now we have 4!=24 ways of arranging the four special digits and 5!=120 ways of arranging the remaining digits. Since the special digits can be huddled either at the end or at the start of the number, there would be twice the numbers not satisfying the condition specified in the question.

That results in 2.4!.5!=5760 rebellious numbers.

Since the total possible 9 digit numbers will be 9!=362880, that leaves us with 362880-5760=357120 favourable outcomes. Therefore the required probability should be 357120/362880=0.984

However that's not the answer, the answer specified is 0.96

Can anybody please tell me where I went wrong? (Pardon my formatting skills :)

  • 1
    $\begingroup$ They could be like $35*****69$, or any other way to distribute them in the beginning or in the end. So your $2$ should actually be...? $\endgroup$
    – ploosu2
    Jan 24, 2022 at 16:24

1 Answer 1


The problem is that the numbers could be "huddled" in the middle as well, not only at the ends (for a total of 5 positions), so your probability should read:

$$1-\frac{5\cdot 4!\cdot 5!}{9!}$$

  • $\begingroup$ That was a very naive mistake of mine. $\endgroup$ Jan 25, 2022 at 3:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .