Math CentralQuandaries & Queries


Question from Hollie, a student:

i have a four digit lock code on my cell phone and cannot remember what it is. i know that it does not contain a 2 or a 4 and none of the numbers are repeated. the numbers range from 0 to nine and the only way to figure out what the code is, is to try randomly. I was wondering if you could give me a list of possible combinations using the information i gave you to make it easier to crack the code.


I don't have a list for you but I do have a procedure for trying all the possibilities in an orderly fashion.

Think about an old style (pre-digital) odometer on a car (the digits are on wheels) or the counters you sometimes see on web pages.


The counter progress by changing the rightmost digit so for the counter above the next numbers are 0947, 0948, 0949 then 0950 and so on. Your counter is different in two ways. First each wheel has only eight digits, 0, 1, 3, 5, 6, 7, 8 and 9. Secondly you are not allowed to repeat a digit.

Begin with the smallest possible value 0135 and start spinning the rightmost digit. The sequence begins

0135, 0136, 0137, 0138, 0139

Next on a normal counter would be 0140 but you have no 4 and you can't repeat the 0 so next on your counter is

0153, 1056, 0157, 0158, 0159, 0163, ...

This will take some thought but the advantage of progressing in order is that when you are ready for a break, write down the last combination you tried and then you can pick up where you stopped.

By the way you have 8 possible digits in each place so the number of possible combinations is 8 × 7 × 6 × 5 = 1680. Not all that many.

Good luck in this,

About Math Central


Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences.
Quandaries & Queries page Home page University of Regina PIMS