Nine digit positive integers of the form PQRSTUVWX are called four-six numbers if the digits P, Q, R and S (in this order) are in strictly ascending order of magnitude, while the digits S, T, U, V, W and X (in this order) are in strictly descending order of magnitude.
For example, each of 567876543 and 678986430 is a four-six number, but 567876654 is NOT a valid four-six number since the digits 876654 (in this order) are not in strictly descending order of magnitude. Similarly, 678875432 is NOT a valid four-six number since the digits 6788 (in this order) are not in strictly ascending order of magnitude.
All the possible four-six numbers are now arranged in descending order of magnitude.
What is the 4664th number?
Note: No four-six number can contain leading zeroes.
I see that Charlie and xdog in their second posts came to the same solution as mine just above (245986541), so this seems to be the agreed answer. About the only complexity was to define the loops correctly. The first four could be between 1234 and 6789; the last six could be between 987654 abd 543210 -- where the fourth position "S" is shared.
Sorry my last posting ran all together; apparently the line feeds did not take.