Night reader wrote:
they can be in any of the five, four and three places => 5 * 4 * 3
I am not sure on this approach, perhaps Rahul or someone from the experts can shed light on its validity.
I'm describing my approach in more detail, hope you find this useful -
I) Fill the constraints first i.e. 5 digit numbers can comprise of 2,4 and 5. The remaining 2 numbers can be any which do not contain 2,4,5 i.e. Total 9 - 2,4,5 i.e. 3 = 6 numbers......... (1).
Now use simple permutation method -
1st can be filled in -
3 ways (you can start filling with 2,4,5 or can start with the remaining 6 numbers, as you wish, but keep in mind you also have to consider the possible arrangement of 2,4,5 in the 5 slots. 2,4,5 are not restricted to any place. Example - units, hundreds, thousands etc.)
Continuing filling from the restricted 3 numbers.
2nd can be filled in
2 ways, (rejecting 1 from the 1st place)
3rd can be filled in
1 way (reject 1 from 1st place and other from 2nd place)
4th number can be from the remaining 6 numbers (refer (1)), so total of
6 ways.
5th number can be filled in remaining
5 ways (reject 1 from 4th place)
So far total ways are - 3*2*1*6*5 = 180 ways.
II) As the position of numbers 2,4,5 is not restricted at any place we also have to consider their arrangements.
Sample numbers,which can be formed
- 245XX
- 452XX
.....
2XX45 can also be formed, or 2X4X5 can also be formed.
So there are more than 180 ways to arrange.
2,4,5 can be arranged in 5 slots in C(5,3) ways, or you can think this way - in how many ways can 3 numbers be put in 5 different slots - order does not matter here. Therefore C(5,3) ways = 10 ways.
Hence 10*180 = 1800 ways.
Perhaps your approach is correct but I cannot comment on it. I preferred what looked more logical to me.
HTH.