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

Home > Numbers
Door lock Combination (Posted on 2024-12-27) Difficulty: 3 of 5
The door to Prof. Adams laboratory has one of those keypad locks that requires entering five digits to open. Unfortunately, he has a hard time remembering the combination, but he has figured out a way to determine it.

The five digits are all different, and he has observed that the first two digits form a perfect square, while the last two digits form a smaller perfect square. Also, the middle digit is the smallest. If he arranges the five digits to form all possible five-digit integers (leading zeros allowed) and adds all these numbers, the sum is a palindrome, with each of its digits a multiple of three.

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 1 of 3
I found a unique solution:
49236

------------------
from itertools import permutations

squares = [str(n**2) for n in range(4,10)]
dbm = []

def test(n):
    scramble = 0
    s = str(n)
    if len(set(str(s))) != 5:
        return False
    for perm in permutations(s):
        scramble += int(''.join(perm))
    scr = str(scramble)
    if scr != scr[::-1]:
        return False
    for ch in scr:
        if ch not in '0369':
            return False
    dbm.append(n)
    return True

for n in range(10000,100000):
    test(n)

for d in dbm:
    s = str(d)
    if s[:2] not in squares:
        continue
    if s[3:] not in squares:
        continue
    if s[:2] <= s[3:]:
        continue
    if min(s) != s[2]:
        continue
    print(d)
    

  Posted by Larry on 2024-12-27 10:04:28
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 (7)
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