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. The order of the digits is not important. For example if the code is 1234. Other valid combination 2341, 4321, 1432 etc. will open the lock. How many possiable codes are there is there an easy way to generate a list?

2006-12-04 12:13:42 · 3 answers · asked by Gamer65 1 in Science & Mathematics Mathematics

3 answers

through 1 - 9, possible combination 9C4 = 126

1234,1235,1236,1237,1238,1239,
1245,1246,1247,1248,1249,1256,
1257,1258,1259,1267,1268,1269,
1278,1279,1289,1345,1346,1347,
1348,1349,1356,1357,1358,1359,
1367,1368,1369,1378,1379,1389,
1456,1457,1458,1459,1467,1468,
1469,1478,1479,1489,1567,1568,
1569,1578,1579,1589,1678,1679,
1689,1789,2345,2346,2347,2348,
2349,2356,2357,2358,2359,2367,
2368,2369,2378,2379,2389,2456,
2457,2458,2459,2467,2468,2469,
2478,2479,2489,2567,2568,2569,
2578,2579,2589,2678,2679,2689,
2789,3456,3457,3458,3459,3467,
3468,3469,3478,3479,3489,3567,
3568,3569,3578,3579,3589,3678,
3679,3689,3789,4567,4568,4569,
4578,4579,4589,4678,4679,4689,
4789,5678,5679,5689,5789,6789,

through 0 -9, possible combination 10C4 = 210
0123,0124,0125,0126,0127,0128,
0129,0134,0135,0136,0137,0138,
0139,0145,0146,0147,0148,0149,
0156,0157,0158,0159,0167,0168,
0169,0178,0179,0189,0234,0235,
0236,0237,0238,0239,0245,0246,
0247,0248,0249,0256,0257,0258,
0259,0267,0268,0269,0278,0279,
0289,0345,0346,0347,0348,0349,
0356,0357,0358,0359,0367,0368,
0369,0378,0379,0389,0456,0457,
0458,0459,0467,0468,0469,0478,
0479,0489,0567,0568,0569,0578,
0579,0589,0678,0679,0689,0789,
1234,1235,1236,1237,1238,1239,
1245,1246,1247,1248,1249,1256,
1257,1258,1259,1267,1268,1269,
1278,1279,1289,1345,1346,1347,
1348,1349,1356,1357,1358,1359,
1367,1368,1369,1378,1379,1389,
1456,1457,1458,1459,1467,1468,
1469,1478,1479,1489,1567,1568,
1569,1578,1579,1589,1678,1679,
1689,1789,2345,2346,2347,2348,
2349,2356,2357,2358,2359,2367,
2368,2369,2378,2379,2389,2456,
2457,2458,2459,2467,2468,2469,
2478,2479,2489,2567,2568,2569,
2578,2579,2589,2678,2679,2689,
2789,3456,3457,3458,3459,3467,
3468,3469,3478,3479,3489,3567,
3568,3569,3578,3579,3589,3678,
3679,3689,3789,4567,4568,4569,
4578,4579,4589,4678,4679,4689,
4789,5678,5679,5689,5789,6789,

2006-12-04 12:26:09 · answer #1 · answered by shamu 2 · 0 0

If the order mattered, then the number of combinations would be
10*9*8*7
because the first digit could be anything (0-9 = 10 choices)
the second digit can be anything EXCEPT the first (9 choices)
There are 8 choices left for the third digit
and 7 choices left for the fourth digit.
So there are 10*9*8*7 different combinations that have no repeated digits.

However, since order does not matter either (i.e., 1234 = 4321), then we need to divide the total number of combinations by 1*2*3*4, which is the number of ways we can arrange 4 different digits.
So the number of possible codes is
10*9*8*7/(1*2*3*4)

For an easy way to generate the list, assume that the four different digits will always be in order so that the first digit is the smallest, the second is the next-smallest, etc. Here's a start
0123
0124
0125
0126
0127
0128
0129
0132 (had to skip 0130 and 0131 for repeated digits)
0134 (skil 0133), 0135,0136,0137,0138,0139,
0142

2006-12-04 20:26:49 · answer #2 · answered by firefly 6 · 1 0

Sample without replacement 4 times, order counts.

It's a permutaion. Assuming there's only 1 to 9 available

choose digit 1 : 9 ways
choose digit 2: 8
choose digit 3, 7
choose digit 4, 6

Now multiply these to get total possibilities
9*8*7*6 = 9P4

Careful about the other solutions. Of course order matters, the lock won't open if the combo is 1234 and you put in 4321 !!!

2006-12-04 20:18:12 · answer #3 · answered by modulo_function 7 · 0 2

fedest.com, questions and answers