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

Home > Numbers
Two top targets (Posted on 2013-09-06) Difficulty: 2 of 5
Find the two highest numbers consisting each of 6 DISTINCT digits such that each when divided by any of the numbers 7, 17, 66 leaves a remainder of 5?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 2 of 2 |

DEFDBL A-Z
FOR a = 1 TO 9
 used(a) = 1
 v1 = 100000 * a
FOR b = 0 TO 9
 IF used(b) = 0 THEN
   used(b) = 1
   v2 = v1 + 10000 * b
FOR c = 0 TO 9
 IF used(c) = 0 THEN
   used(c) = 1
   v3 = v2 + 1000 * c
FOR d = 0 TO 9
 IF used(d) = 0 THEN
   used(d) = 1
   v4 = v3 + 100 * d
FOR e = 0 TO 9
 IF used(e) = 0 THEN
   used(e) = 1
   v5 = v4 + 10 * e
FOR f = 0 TO 9
 IF used(f) = 0 THEN
   used(f) = 1
   v6 = v5 + f

   IF v6 MOD 7 = 5 THEN
   IF v6 MOD 17 = 5 THEN
   IF v6 MOD 66 = 5 THEN
       PRINT v6
   END IF
   END IF
   END IF

   used(f) = 0
 END IF
NEXT f
   used(e) = 0
 END IF
NEXT e
   used(d) = 0
 END IF
NEXT d
   used(c) = 0
 END IF
NEXT c
   used(b) = 0
 END IF
NEXT b
 used(a) = 0
NEXT a

finds all solutions, not just the highest two:

 180647
 259187
 267041
 274895
 298457
 361289
 392705
 431975
 486953
 518369
 620471
 659741
 746135
 761843
 824675
 856091
 863945
 879653
 895361
 903215
 
but of course the highest two are the last two: 895361 and 903215.


  Posted by Charlie on 2013-09-06 12:10:14
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 (2)
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