Teaser 2312: Backward step
From The Sunday Times, 14th January 2007 [link]
Seb had just been given his four-digit PIN, and he was afraid that he would not be able to remember it. So he broke all the rules and wrote it in his pocket diary. But to make it “more secure” he did not actually write the PIN; instead, he wrote the digits in reverse order. He was surprised to discover that the new number was a multiple of the correct PIN.
What is his PIN?
Note that without additional requirements there are many solutions to this puzzle. The intended solution seems to come from the requirement that all the digits of the PIN are non-zero.
[teaser2312]


Jim Randell 8:12 am on 16 January 2026 Permalink |
Here is a solution using the [[
SubstitutedExpression]] solver from the enigma.py library.It runs in 82ms. (Internal runtime of the generated code is 1.7ms).
Solution: The PIN is: 2178.
And so the reversed PIN is: 8712.
And: 8712 = 4 × 2178.
(The multiple solutions to the puzzle as published can be seen by removing the digit restriction on line 11).
Without the restriction to non-zero digits there are 131 solutions, for example (reversed-PIN, PIN):
(Although not all these would be surprising).
But only one of these solutions remains if the digits of the PIN must all be non-zero.
The published solution was: “1089 or 2178”.
LikeLike
Ruud 10:33 am on 16 January 2026 Permalink |
LikeLike
GeoffR 7:43 pm on 16 January 2026 Permalink |
from enigma import nsplit, is_pairwise_distinct for pin in range(1234, 9876): a, b, c, d = nsplit(pin) if 0 in (a, b, c, d): continue if is_pairwise_distinct(a, b, c, d): rev_pin = 1000*d + 100*c + 10*b + a q, r = divmod(rev_pin, pin) if r == 0 and q > 1: print(f"Pin = {pin}.")LikeLike