There is a combination safe with four switches on the front, each with three positions – low, medium, and high. There are 3 4 = 8 1 possible combinations.
However, this is a cheap safe and only two of the switches actually matter. If you set those two switches right, the safe will open. You do not know which are the important switches or which positions work. What is the minimum number of combinations you must try to guarantee that you will open the safe?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
@Christian Nader...... Hey i got the answer as 54 and I have a definite logic for that...I think the correct answer should be 54 or else somethings seriously erroneous with my solution.....can you just try to find out the mistake? Solution: Out of all 4 switches, we can chooses 2 switches in 4C2 ways. After selection of two switches, the total no. of combinations are 3C1 X 3c1 = 9. (example: LL, LM, LH; ML, MM, MH; HL, HM, HH ). So, the answer comes out to be: 4C2 X 3C1 X 3C1 = 6.3.3= 54......what do you say ????
I also have done same calc.. But later o realized that this calc give you the total number of combinations.. Not the minimum number of combination..
DeBrujin sequence is probably relevant here
Hmm, can you justify why all the 54 combinations can be achieved in 9 tries? Specifically, why is it possible to try out all the combinations of each of the pairs of locks without any combination being repeated? I need help with that.
I guess the easiest way to answer that is with an actual example:
0000
0111
0222
1012
1120
1201
2210
2102
2021
For another sequence, try
0 0 0 0 , 0 1 0 1 , 0 2 0 2 , 1 0 1 0 , 1 1 1 1 , 1 2 1 2 , 2 0 2 0 , 2 1 2 1 , 2 2 2 2
Clearly the answer cannot be less than 9, since there are 3 × 3 = 9 ways to arrange a combination lock of exactly two switches with three settings each. Because of the symmetry present in the sequence above, it is easy to verify it works.
Observe that an order-3 Graeco-Latin square exists. A setting of switches can be obtained from each cell in it: the row is the position of the first switch, the column is the position of the second, the symbol from one alphabet is the position of the third, the symbol from the other is the position of the fourth. If we carry out these 9 settings, it easily follows from the properties of the Graeco-Latin square that the safe will open.
Try these nine combinations (where 0 = low, 1 = medium, 2 = high).
0000
0111
0222
1012
1120
1201
2021
2102
2210
Given any pair of coordinates i , j with 1 ≤ i < j ≤ 4 , you can observe that every possible pair of two numbers appears in one of the tries above in coordinates i and j .
To find this sequence, just start out by noticing that the first two digits must make up every possible combination of two digits. Then, completing the rest of the digits becomes something like solving a sudoku puzzle. (Mathematically, it amounts to finding a pair of orthogonal 3x3 latin squares.)
nice problem
Pidgeonhole! Let there be 6 bins, one for each of the 4 choose 2 = 6 pairs of switches. For each code, you will have 6 balls that correspond to the potitions at those switches. You want to test every possible way but not too much, so in each of the 6 bins you have as many balls that don't repeat. Eg. If you have 2 (low, low) balls in the A,B bin then that's unnecessary because you already know from the first time you tried (low, low) on that pair that it doesn't work, you don't need to test it again.
There are 9 kinds of balls in each bin, so there should be at most 9 6 balls total so then since each code has 6 balls the answer is 9 6/6=9 codes.
Problem Loading...
Note Loading...
Set Loading...
Consider the switches as A, B, C, D, and the positions 1, 2, 3.
So we may have A1, B3, C2, etc...
There is one double that opens it. We have a total of: ( 4 × 3 × 3 × 3 ) / 2 = 5 4 doubles. Each position has 6 doubles (AB, AC, AD, BC, BD, CD), so we can't guarantee to find a solution with less than 5 4 / 6 = 9 combinations.
The question is: can we get it with exactly 9 combinations of switches?
Well yeah. To see how we can achieve it, first consider all combinations of switches A and B:
- A1 B1
- A1 B2
- A1 B3
- A2 B1
- A2 B2
- A2 B3
- A3 B1
- A3 B2
- A3 B3
These are all needed doubles, so they must appear at some point. Now, how can we distribute C and D? For the first 3 combinations, we can simply write:
-A1 B1 C1 D1
-A1 B2 C2 D2
-A1 B3 C3 D3
-A2 B1
-A2 B2
-A2 B3
-A3 B1
-A3 B2
-A3 B3
How then can we distribute C and D so that we won't overlap any double? For the first "blank" spot, we don't want to put C1 (because there already exists a B1 C1). So let's Put C2 (or C3, it wont matter at this point):
-A1 B1 C1 D1
-A1 B2 C2 D2
-A1 B3 C3 D3
-A2 B1 C2
-A2 B2
-A2 B3
-A3 B1
-A3 B2
-A3 B3
Now, we don't want to put a D2 (because we already have C2 D2 on the 2nd row). So we put D3. From here on over, we can just add 1 to the C's and D's, and that will guarantee we won't overlap with anything we have already written:
-A1 B1 C1 D1
-A1 B2 C2 D2
-A1 B3 C3 D3
-A2 B1 C2 D3
-A2 B2 C3 D1
-A2 B3 C1 D2
-A3 B1
-A3 B2
-A3 B3
For the last 3 rows, we can just make the same "distribution" of Cs and Ds, but switching the numbers between them. So we would have:
-A1 B1 C1 D1
-A1 B2 C2 D2
-A1 B3 C3 D3
-A2 B1 C2 D3
-A2 B2 C3 D1
-A2 B3 C1 D2
-A3 B1 C3 D2
-A3 B2 C1 D3
-A3 B3 C2 D1
This way, in 9 attempts we can try every possible double of switches!