1 to 7 once?

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.


The answer is 4315672.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Aman Baser
Sep 7, 2015

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.

I solved it basically the same way, but got the 600 as 5×5!=600. (As any number in the sequence is not divisible by 5, it cannot end in 5. Therefore, we can choose the last digit 5 ways and we can permutate the other 5 digits in 5! different ways.)

Similarly, I got 4×4!=96 and 3×3!=18 for the following digits.

Zee Ell - 5 years, 6 months ago
Razing Thunder
Jul 1, 2020
1
2
from itertools import permutations
print([j for j in [int(''.join(list(i))) for i in permutations(['1','2','3','4','5','6','7'])] if j%5!=0][1999])

Aayush Patni
Jan 13, 2016

Let. 1,2,3,4,5,6,7 be denoted by A,B,C,D,E,F,G respectively.

Then this question becomes simply like arranging words formed from letters A,B,C,D,E,F,G in a dictionary.

Some simple calculation leads to the 2000th word which is DCAEFGB.

Which is 4315672

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...