
4. All the 7-digit numbers containing each of the digits $1,2,3,4,5,6,7$ exactly once, and not divisible by 5 , are arranged in the increasing order. Find the 2000-th number in this list.


Solution: The number of 7 -digit numbers with 1 in the left most place and containing each of the digits $1,2,3,4,5,6,7$ exactly once is $6!=720$. But 120 of these end in 5 and hence are divisible by 5 . Thus the number of 7 -digit numbers with 1 in the left most place and containing each of the digits $1,2,3,4,5,6,7$ exactly once but not divisible by 5 is 600 . Similarly the number of 7 -digit numbers with 2 and 3 in the left most place and containing each of the digits $1,2,3,4,5,6,7$ exactly once but not divisible by 5 is also 600 each. These account for 1800 numbers. Hence 2000-th number must have 4 in the left most place.

Again the number of such 7 -digit numbers beginning with 41,42 and not divisible by 5 is $120-24=96$ each and these account for 192 numbers. This shows that 2000-th number in the list must begin with 43 .

The next 8 numbers in the list are: $4312567,4312576,4312657,4312756,4315267,4315276$, 4315627 and 4315672 . Thus 2000 -th number in the list is 4315672 .
