Number of attempts needed to open lock

381 Views Asked by At

There are $3$ knobs for a lock $A,B,C$. Each can take $8$ positions, and for each knob there is one correct position. When $2$ of the knobs are at their correct positions, the knob opens (irrespective of the third). So the number of attempts to get it right will be $8^2=64$. Can you do better than that?

3

There are 3 best solutions below

4
On BEST ANSWER

Here is a 57-guess solution.

Let the knob positions come from $\{0,1,2,3,4,5,6,7\}$. Try this strategy: Make the following guesses:

$000,001,002,003,004,005,006,007$. (8 guesses)

If none of these are right, you can say that neither knob A nor knob B gets a $0$ (otherwise one would have combined with C to open the lock at some point).

Continue by guessing:

$110,111,112,113,114,115,116,117$. (8 guesses)

If none of these are correct, you can say that neither knob A nor knob B gets a $1$.

Continue in this manner. ($22x; 33x; ...$). (8 guesses each)

If you get to $667$ and still haven't opened the lock, then knobs A and B must both be $7$.

You've used 56 guesses so far. So on your 57th try you open the lock with $77x$.

0
On

$\frac{64}2$ is the expected number of attempts to find the correct combination when moving only two knobs at random.

Every time move two knobs to the same random setting. The chance that at least one of them is correct is: $1-(\frac {7} {8})^2 = \frac {15} {64}$. Move the other knob independently to a random setting. The chance that both one of the two and the other nob is correct is: $\frac{15}{512}$. The expected number of attempts until that happens is:$$\frac{512}{2\times 15}=17.0\dot{6}$$

Or move all of them independently to random settings. The probability of at least two being correct is: ${3\choose 2}\frac{7}{8^3}+\frac{1}{8^3} = \frac {11}{256}$, so the expected number of attempts is $$\frac {256}{2\times 11}=11.\dot{\overline{63}}$$

The best strategy is clear.

0
On

Here's a solution with 38 attempts:

166 - 177 - 266 - 277 - 616 - 626 - 661 - 662 - 717 - 727 - 771 - 772 - 128 - 182 - 218 - 281 - 812 - 821 - 345 - 354 - 435 - 453 - 534 - 543 - 678 - 687 - 768 - 786 - 867 - 876 - 111 - 222 - 333 - 444 - 555 - 666 - 777 - 888