The CFO sat back in his leather chair, which creaked and squeaked. "It's actually pleather," he said to the intern sitting nervously opposite him, a notepad resting on his knees. "We're very cost-conscious here. The intern, who'd already discovered that the building's only toilet operated on the time-tested 'take-a-number-and-wait-to-be-called' system, nodded carefully.

"All reports are to be stored in that safe," said the CFO, pointing to a squat grey box. "We change the $7$-digit combination every month, and no combination may be re-used. We like to think the combinations are efficient. You get one chance to enter the code, or the safe locks you out for 24 hours. Old combinations are written on this post-it note so that no mistakes are made."

The CFO's cell-phone rang at that moment, and the intern politely stared at his shoes trying not to listen. When the CFO hung up he stood up. "I have to go and... fix things," he said. "While I'm gone get started on reading the reports in the safe. I shall be back expeditiously."

The intern looked at the safe, slowly realising that the CFO hadn't told him what the current combination was. After looking at the post-it note for a few minutes though, he entered the combination in the safe and was busy squinting at reports written in 6-pt font (to save space) by the time the CFO returned.

The combinations written on the post-it note are: $$5124637$$ $$7125364$$ $$4152637$$ $$5162734$$ $$6243517$$ What combination did the intern enter into the safe, and how did he know it would work?

UPDATE (14/03)

Hint 1:

No code can ever start with $1$ (and, being efficient, the codes use the digits $1$ through to $7$ only and once each. When the firm was using five digit codes the entire set were $31425, 51243$ and $41523$).

Hint 2:

To be efficient, each digit is chosen so that it depends on all the digits that precede it.

  • 3
    $\begingroup$ There's always a relevant XKCD, but sometimes there's also a relevant Dilbert. $\endgroup$ – Brandon_J Mar 12 '19 at 18:54
  • 1
    $\begingroup$ The intern must be a genius. I've been looking at this for much longer than a few minutes and can't see any pattern. I think efficient is the key here, but looking at the distance your finger has to travel between key presses yields no results. Neither does looking at the permutation order. This guy needs a raise. $\endgroup$ – Amorydai Mar 13 '19 at 19:21
  • $\begingroup$ @Amorydai I'll add a hint tomorrow. The intern didn't work out for other reasons :( $\endgroup$ – user40528 Mar 13 '19 at 19:23
  • $\begingroup$ @Amorydai dunno if this helps, but Rot13(rnpu qvtvg bayl rire punatrf ol mreb, bar, gjb, be guerr.) $\endgroup$ – Brandon_J Mar 13 '19 at 22:27
  • $\begingroup$ @So far all I've got: Rot13(Vs lbh fxrgpu gur ahzoref va n evat, naq pbaarpg gurz va beqre, gurer frrzf gb or fbzr fbeg bs cnggrea, ohg abg rabhtu gung V pna znxr n cerqvpgvba sbe gur ynfg pbqr...) $\endgroup$ – Fifth_H0r5eman Mar 14 '19 at 9:21


Each digit

is a factor of the sum of its predecessors

However this isn't the only remaining permutation of the digits 1-7 that fits.


works as well.

  • $\begingroup$ This is it, though annoyingly it's not the only permutation: $4263517$ also works, but I missed the one you found when I was enumerating them. Well done! $\endgroup$ – user40528 Mar 15 '19 at 6:58
  • $\begingroup$ This answer invalidates part of the initial problem: "We change the 7-digit combination every month, and no combination may be re-used." What do you do after using the above ? $\endgroup$ – Overmind Mar 15 '19 at 13:03
  • 1
    $\begingroup$ Also, since the intern guessed the number, I assumed there was some pattern to the numbers. Why was 7 chosen as the first digit for the second combo? Why was 4 chosen for the third? I guess they were just random after all. Not very efficient. $\endgroup$ – Amorydai Mar 15 '19 at 14:14
  • $\begingroup$ @Overmind they move to 8-digit combinations. The question doesn't state that they only ever use 7-digit combinations (and the hint lists the 5-digit combinations they've used) $\endgroup$ – user40528 Mar 15 '19 at 14:48
  • 2
    $\begingroup$ @postmortes Jesus! At least the scheme you use is self-consistent. However, as a feedback on your puzzle - the hints you give are wholly inadequate. "We change the 7-digit combination every month" - actually does imply that they only use 7-digit combos. 5-digit ones were only introduced in a hint - hard to draw conclusions from that, AND you gave them out of order! Maybe if you at least said we were looking for the last acceptable 7-digit combo it would make more sense. I don't think the single word "efficient" is suitable as a hint for all this. $\endgroup$ – Amorydai Mar 15 '19 at 15:48

I think I got it.

The keyword here is efficient. When written out the keypresses on a 3x3 Numpad, only the 3rd Code is efficient by the keypresses alone. The third code "4152637" is the keys from the second row of the keypad up to the first row, from left to right, and then the seven at the end. The most efficient code, and also the solution.

Hope I explained it well enough, I don't know how to "spoiler" a graphic / pre-format yet.

  • $\begingroup$ Sorry, no. All the given codes are efficient, and you're looking for the current code. $\endgroup$ – user40528 Mar 14 '19 at 8:18
  • $\begingroup$ I've added a couple of hints now as well :) $\endgroup$ – user40528 Mar 14 '19 at 8:25
  • $\begingroup$ Wait, so that means that the code he used is not in the list? Because you said "looking for the current code" $\endgroup$ – Chris Mar 14 '19 at 8:35
  • 3
    $\begingroup$ That's right. You're told that the post-it note only contains the old combinations $\endgroup$ – user40528 Mar 14 '19 at 8:38

I would use :


By the logic that:

Second digit seems incremental every 4, so after 1111 and 2, logic dictates of a high probability of number 2 for the second position:
Last digit alternates between 7 and 4 so it's 4's turn now:

After each 2 there's an incremental number 24,5,6,7 so next will be 1 (column parity patterns also check):

Sum of each 2 numbers by column have each 2 times a decreasing pattern (sum of 1st 2 columns 1st numbers: 12, c2p1+c3p1: 11, c3p1+c4p1: 9, c4p1+c5p1: 11, logic - c5p1+c6p1 must be 6:

Now we can get to study of the patterns of previous entries. There is no straight 3-in-a-line combination (because of safety efficiency) so it's safe to say that we exclude 3-5-7 and 7-5-3 from our remaining entries (inefficient from a safety point of view):

This leaves us with 2 combinations: 375, 573

Finally, since 5 is always near a 1 or a 2 (51, 25, 52, 51, 51) we may as well respect that with a 15:

An alternate to this can be found by studying the logic of the 11, 12 and 13 patters present all over, but that would take an excessive amount of math to demonstrate so I'd rather go with the option above.

  • $\begingroup$ Hi! Please add spoiler tags with >!, thanks. $\endgroup$ – pirate Mar 14 '19 at 14:00
  • $\begingroup$ Sorry, tag is broken. $\endgroup$ – Overmind Mar 14 '19 at 14:04
  • $\begingroup$ See my edit, :) $\endgroup$ – pirate Mar 14 '19 at 14:07
  • $\begingroup$ That's not the right code, sorry. You have made some relevant observations but what you're looking for can be stated much more simply. $\endgroup$ – user40528 Mar 14 '19 at 15:13
  • $\begingroup$ Thanks @pirate, looks like the tag must be on all lines; good thing it's working. $\endgroup$ – Overmind Mar 15 '19 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy