Skip to content

15 Safe Cracking

© Zyanya Santuario, MATH+

Author: Owen Hearder (FU Berlin)

Project: BMS


Aapo was excited and a little worried. Head elf Priita retired last Christmas and chose Aapo to be the new head elf. In order to begin preparing for next Christmas, Aapo has to read the instructions on how to be head elf. Since Priita had been head elf for so long, the instructions are locked in the archives.

The archives are locked in a very complex way. Priita told him the following: “There is a set of four digit numbers that are valid codes for the safe and all of these contain the digit 6. I described for you an algorithm, where applying steps 2 till 5 (a so-called iteration) yields a number. The valid codes are such numbers that, from a certain point onward in the algorithm, the result of further iterations will not change anymore.”

Aapo looks at the paper she gave him. Indeed, the algorithm is described as follows:

  1.  Choose a number between 1 and 9999 with at least two different digits.
  2. Add zeros to the front of the number so that you have four digits.
  3. By rearranging the digits, build the highest and the lowest number.
  4. Subtract the lowest number from the highest number.
  5. Write this number down and with it follow the instructions from step 2 again.

”This will be all you need to unlock the safe”, Priita said with a grin on her face. Aapo is panicking, since he thinks that it will take forever to find out a code! But Priita is optimistic and smiles at him.

Assuming Priita is right and the set of valid codes satifying described properties by Priita exists, how many valid codes are there?

Possible Answers

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10