English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a four digit combination lock I forgot the code to. It is four digits with no repating digits, ie. 1123, 4565, and 9878 are invalid. How many possiable codes are there is there an easy way to generate a list?

2006-12-04 12:01:54 · 5 answers · asked by Gamer65 1 in Science & Mathematics Mathematics

Let me add a twist I fogot. The order of the digits in not important. For example if the code is 1234; 2341, 4321, 1432 etc. will open the lock.

2006-12-04 12:10:48 · update #1

5 answers

Decent question. Thumbs up for you.

The answer is as follows:

lock code is "wxyz"

There are 10 choices for w, 9 for x (w can't equal x), 8 for y (y can't equal w or x) and 7 for z (z can't equal x, y or w).

Therefore, there are 10 * 9 * 8 * 7 possible combinations = 5040 combinations.

You could generate a list using Excel, assigning one digit to each column and have a script which would only copy those which do not have repeat digits to another spreadsheet.

Good luck (bolt cutters might be in order here!).

2006-12-04 12:07:34 · answer #1 · answered by sep_n 3 · 0 0

The answer uses something called the "choose" function- there are 10 choices (is there a zero?) for the first digit, but one fewer for the next digit- and so on. So you get 10*9*8*7.

For a list, I'll do a little example with possible digits 0-5:
0 1 2 3
0 1 2 4
0 1 2 5
0 1 3 2
0 1 3 4
0 1 3 5
0 1 4 2
...

Get the idea?
Just make the last digit vary the most quickly, and then when you use up the available digits, change the digit to the left.

2006-12-04 12:11:19 · answer #2 · answered by Daniel Quilp 2 · 0 0

as above for a non repeating four digit lock using numbers 0-9 as 0 counts as a digit the number of possible combinations are 10*9*8*7 = 5040
for a repeating lock the code the number of combinations would be 10*10*10*10 = 10000

there is no easy formula to generate a list of the possible combinations.

2006-12-04 12:12:45 · answer #3 · answered by bluegreenash 2 · 0 0

If zero is a choice you have 10*9*8*7 possible combinations and short of writing them all out there is no easy way to get them.

If zero isn't a possibility you have 9*8*7*6 possible combinations, still not very favorable, but a little better.

2006-12-04 12:05:59 · answer #4 · answered by Modus Operandi 6 · 0 0

Possible codes (permutations) are 9!/(9-4)! = 3024, where 9 is amount of different digits allowed and 4 is the amount of digits.

2006-12-04 12:07:35 · answer #5 · answered by Petterjunni 1 · 0 0

fedest.com, questions and answers