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?
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$).
To be efficient, each digit is chosen so that it depends on all the digits that precede it.