All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 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?

 See The Solution Submitted by K Sengupta Rating: 2.8000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: solution -- computer confirmation | Comment 3 of 8 |
(In reply to solution 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.

 Posted by Charlie on 2006-02-02 12:45:28

 Search: Search body:
Forums (0)