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

Home > Numbers
The Forgotten Combination (Posted on 2025-01-24) Difficulty: 3 of 5
Bill has a problem. He has locked his pin in a strong box and forgotten the combination.

The lock uses all the digits 1 through 6 in some order. He has tried the following three combinations: 4-5-6-1-3-2 which has one digit correct; 6-2-3-4-5-1 which has two digits correct; and 2-3-1-6-4-5 which has three digits correct.

What is the combination?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer Solution Comment 2 of 2 |
Also brute force

ried:
4-5-6-1-3-2  one correct
6-2-3-4-5-1  two correct
2-3-1-6-4-5  three correct

The combination:
2, 5, 3, 6, 4, 1

-------
goodA = [4, 5, 6, 1, 3, 2]
goodB = [6, 2, 3, 4, 5, 1]
goodC = [2, 3, 1, 6, 4, 5]

digits1to6 = [k+1 for k in range(6)]
from itertools import permutations
for p in permutations(digits1to6):
    correct = 0
    for i,v in enumerate(p):
        if v == goodA[i]:
            correct += 1
    if correct != 1:
        continue
    
    correct = 0
    for i,v in enumerate(p):
        if v == goodB[i]:
            correct += 1
    if correct != 2:
        continue
    
    correct = 0
    for i,v in enumerate(p):
        if v == goodC[i]:
            correct += 1
    if correct != 3:
        continue
    print(p)

  Posted by Larry on 2025-01-24 10:35:55
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 (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2025 by Animus Pactum Consulting. All rights reserved. Privacy Information