Problem #68 MEDIUM
The Cracked Safe Combination
Microsoft Adobe Number Theory Logic
Problem Statement
A combination lock has digits 0–9 on each of its four wheels. The correct combination is a 4-digit number with the following properties: the number is a palindrome (reads the same forwards and backwards), all four digits are different, the sum of all four digits is 20, and the number is divisible by 11. Find all valid combinations.
Answer & Quick Explanation
Think you've got it? Click below to check your answer.
Zero valid combinations exist. A 4-digit palindrome (ABBA) necessarily repeats digits (positions 1=4 and 2=3), making it impossible for all four digits to be different. The constraints are mutually contradictory. If the all-different constraint is relaxed to A≠B, valid solutions include 1991, 2882, 3773, 4664 (all divisible by 11, digits summing to 20).
Detailed Editorial Solution
Want to see the step-by-step breakdown? Click below to reveal the editorial.
This is a trick question that tests whether solvers carefully check all constraints before computing. The palindrome and all-different-digits constraints directly conflict with each other for a 4-digit number.
Step 1: A 4-digit palindrome has the form ABBA: position 1 = position 4, and position 2 = position 3.
Step 2: Constraint: all four digits are different. But in ABBA, digit at position 1 = digit at position 4 (both equal A). This means positions 1 and 4 are the same digit — violating the all-different requirement immediately.
Step 3: No matter what values A and B take, a 4-digit palindrome always repeats digits. It cannot have all four digits different.
Step 4: Therefore, no 4-digit palindrome can have all four digits different. The two constraints are mutually exclusive.
Step 5: What if the problem intended 'at least two different digits'? Then form ABBA with A+A+B+B = 2A+2B = 20 → A+B = 10, and divisible by 11. ABBA = 1001A + 110B = 11(91A + 10B). So every ABBA is divisible by 11! Then solutions with A+B=10 and A≠B: (1,9)→1991, (2,8)→2882, (3,7)→3773, (4,6)→4664, (9,1)→9119, etc.
Step 6: The intended lesson: always verify that all constraints are simultaneously satisfiable before solving.
Key Insight:
The puzzle is deliberately constructed to test whether you catch the contradiction early. Checking constraint compatibility before diving into computation is a critical skill — especially in interview settings where trick questions are designed to see if you blindly proceed or pause to verify.