All possible 6-digit number, in each of which the digits occur in non-increasing order (from left to right, eg., 877550) are written as a sequence in increasing order. Find the 2005-th number in this sequence.
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.
We can represent any number in the sequence by the differences between digits. For example, 877550 could be represented as (1,0,2,0,5,0). The sum of these is equal to the 1st digit. Then for a given 1st digit, it's a simple matter of stars and bars to find how many numbers in the sequence starting with that digit. 6C5+7C5+...+12C5=1715, and adding 8C5 would bring us above 2005, so the 1st digit must be 8. And we repeat this for subsequent digits.