Home > Just Math
The Descending Integers (Posted on 2006-02-02) |
|
Let us consider all possible positive whole numbers (not containing any leading zeroes) with the proviso that in each of the numbers, none of its digits can be repeated.
Note: any given number may or may not contain all the digits from 0 to 9 (Examples: 7; 20; 1056; 3067941825 etc.)
These numbers are now arranged in descending order of magnitude.
What would be the 200,136th number?
|
Submitted by K Sengupta
|
Rating: 2.8000 (5 votes)
|
|
Solution:
|
(Hide)
|
The required number is 9,403,152,678.
EXPLANATION:
At the outset, the total number of integers commencing with 9 and possessing all the nine digits is 9! = 362,880.
Since, 200,136 is less than 362,880; it follows that the first digit must be equivalent to 9.
Since, all the digits are non-repetitive, the value of the second digit is 8 or less.
Now, 200,136 = 4*(8!) + 38,856 and accordingly, the second digit must be 8-4=4.
38,856 = 7*(7!) + 3,576. since the third digit must contain one of 8,7,6,5,3,2,1,0 ; it follows that the said digit must correspond to 0.
3,576 = 4*(6!) + 696. Since, the fourth digit must contain one of 8,7,6,5,3,2,1 it follows that the said digit must correspond to 3.
696 = 5*(5!) + 96. Since, the fifth digit must contain one of 8,7,6,5,2,1 ; it follows that the said digit must correspond to 1.
96 = 3*(4!) + 24. Sice the sixth digit must contain one of 8,7,6,5,2 ; it follows that the said digit must be equal to 5.
Now, 24 = 4!. Accordingly, the digits of the smallest four digit number constituted by 8,7,6,2 must correspond to the last four digits and consequently, the last four digits ( written from left to right) are 2,6,7,8 giving the required number as 9,403,152,678.
---------Q E D-----------
COMPUTER SOLUTION (Submitted By Charlie):
By taking the permutations of all ten digits in ascending order of value, and counting down from 10! = 3628800, when we get to a count of 200136, that will be the 200,136th in descending order.
DECLARE SUB permute (a$)
DEFLNG A-Z
CLS
a$ = "0123456789": h$ = a$
ct = 3628800
DO
permute a$
ct = ct - 1
LOOP UNTIL a$ = h$ OR ct = 200136
PRINT a$
The permute subroutine is shown elsewhere on this site.
The answer agrees, as 9403152678.
|
Comments: (
You must be logged in to post comments.)
|
|
Please log in:
Forums (0)
Newest Problems
Random Problem
FAQ |
About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On
Chatterbox:
|