Keypad Code Recovery
A storage room is protected by a four-digit keypad code, using digits 0–9 with repetition allowed. The facilities team has recovered five statements about the code, all of which are true: (1) the first digit is twice the fourth digit; (2) the second digit is odd; (3) the third digit equals the first digit minus the second digit; (4) the second digit is greater than the third digit; (5) the sum of all four digits is 15. A new starter needs the code before an audit at 09:00 and cannot test guesses, because three wrong entries lock the keypad for an hour. The team wants a deductive route to the code, not trial and error.
1. Find the code. Show the algebra.
Read the worked answer
Let the fourth digit be x. Then digit 1 = 2x and digit 3 = 2x − digit 2. The digit sum is 2x + d2 + (2x − d2) + x = 5x = 15, so x = 3, the first digit is 6, and the third digit is 6 − d2. Digit 2 is odd and greater than digit 3: d2 > 6 − d2 means d2 > 3, and d2 ≤ 6 so that the third digit is non-negative. The only odd value is 5, giving third digit 1. Code: 6513.
2. Is any of the five statements unnecessary for a unique solution? Demonstrate with an alternative code if one can be dropped.
Read the worked answer
None can be dropped. Remove the sum and x is unconstrained: with x = 2 the code 4312 satisfies the rest (first 4 is twice fourth 2; second 3 is odd; third 1 = 4 − 3; 3 > 1). Remove 'second digit is odd' and both 6423 and 6513 satisfy the remaining clues. Remove 'second greater than third' and 6153, 6333 and 6513 all fit. Remove either arithmetic clue and the digits are no longer pinned. All five statements are load-bearing, so the new starter must use every one.
3. If 'second digit is odd' were replaced by 'second digit is even', would the code be unique? Explain.
Read the worked answer
No. With x = 3 and first digit 6, the sum forces d2 + d3 = 6, and the even values of d2 greater than d3 are 4 and 6. That gives 6423 and 6403, both satisfying every remaining clue, so the keypad would not be uniquely determined. An extra clue such as 'no digit is zero' would eliminate 6403 and leave 6423, but as stated there are two valid codes. The parity clue is doing real work: swapping odd for even roughly doubles the solution set.