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

Home > Numbers
Getting Four-Six With Nine Digits (Posted on 2008-03-16) Difficulty: 3 of 5
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.

See The Solution Submitted by K Sengupta    
Rating: 2.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re(2): computer solution | Comment 3 of 9 |
(In reply to re: computer solution by Ady TZIDON)

You're right.

The corrected program:

FOR a = 6 TO 1 STEP -1
FOR b = 7 TO a + 1 STEP -1
FOR c = 8 TO b + 1 STEP -1
FOR d = 9 TO c + 1 STEP -1
FOR e = d - 1 TO 4 STEP -1
FOR f = e - 1 TO 3 STEP -1
FOR g = f - 1 TO 2 STEP -1
FOR h = g - 1 TO 1 STEP -1
FOR i = h - 1 TO 0 STEP -1
 ct = ct + 1
 IF ct < 20 OR ct > 4645 THEN
 PRINT ct, a; b; c; d; e; f; g; h; i
 END IF
 IF ct = 4664 THEN END
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT

resulting in:

1             6  7  8  9  8  7  6  5  4
2             6  7  8  9  8  7  6  5  3
3             6  7  8  9  8  7  6  5  2
4             6  7  8  9  8  7  6  5  1
5             6  7  8  9  8  7  6  5  0
6             6  7  8  9  8  7  6  4  3
7             6  7  8  9  8  7  6  4  2
8             6  7  8  9  8  7  6  4  1
9             6  7  8  9  8  7  6  4  0
10            6  7  8  9  8  7  6  3  2
11            6  7  8  9  8  7  6  3  1
12            6  7  8  9  8  7  6  3  0
13            6  7  8  9  8  7  6  2  1
14            6  7  8  9  8  7  6  2  0
15            6  7  8  9  8  7  6  1  0
16            6  7  8  9  8  7  5  4  3
17            6  7  8  9  8  7  5  4  2
18            6  7  8  9  8  7  5  4  1
19            6  7  8  9  8  7  5  4  0
...

4646          2  4  5  9  8  7  5  3  2
4647          2  4  5  9  8  7  5  3  1
4648          2  4  5  9  8  7  5  3  0
4649          2  4  5  9  8  7  5  2  1
4650          2  4  5  9  8  7  5  2  0
4651          2  4  5  9  8  7  5  1  0
4652          2  4  5  9  8  7  4  3  2
4653          2  4  5  9  8  7  4  3  1
4654          2  4  5  9  8  7  4  3  0
4655          2  4  5  9  8  7  4  2  1
4656          2  4  5  9  8  7  4  2  0
4657          2  4  5  9  8  7  4  1  0
4658          2  4  5  9  8  7  3  2  1
4659          2  4  5  9  8  7  3  2  0
4660          2  4  5  9  8  7  3  1  0
4661          2  4  5  9  8  7  2  1  0
4662          2  4  5  9  8  6  5  4  3
4663          2  4  5  9  8  6  5  4  2
4664          2  4  5  9  8  6  5  4  1
so the answer actually is 245986541.

Edited on March 16, 2008, 8:34 pm
  Posted by Charlie on 2008-03-16 20:33:46

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
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:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information