TITLE: Shasha's safecracking problem
QUESTION [9 upvotes]: Suppose you want to open a safe with 10 switches. For each switch there're 3 settings, say, 1,2,3. There're 2 key switches. The safe is unlocked once you set the key pair correctly, but you can't distingush the key ones from the others. The question is, how many tries do you need to be sure to open the safe, and how should you choose the combinations (an althorithm)?  (For example, if the safe has only 2 switches instead of 10, you need $3\times3=9$ tries) Will the number of tries grow less than linearly as the number of switches increases? Could there be a formula for a general problem of $n$ switches, $m$ settings and $k$ keys?

REPLY [9 votes]: What you seek is a covering array (ref.), denoted CA(t,k,v), with parameters:

strength t=2
number of columns k=10
number of possible values v=3

The smallest such covering array is listed here as having 14 rows (i.e. trials), having been found by simulated annealing by Cohen.
Jose Torres-Jimenez's webpage has an applet which can give you an example:
C SA-JTJ
14 10 3^10 2
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
2 2 2 1 1 0 2 2 2 2
1 1 2 0 2 2 0 1 2 0
1 0 0 2 0 1 2 2 1 1
0 1 0 1 2 2 1 2 0 0
0 2 1 2 0 2 1 0 2 1
0 2 0 0 1 1 2 1 0 0
0 1 2 2 0 0 1 1 1 2
2 0 2 1 0 1 0 0 0 1
1 0 1 2 1 2 0 0 0 2
2 0 0 0 2 1 1 1 2 2
1 2 1 0 2 0 0 2 1 1
2 1 1 2 2 2 2 0 1 0

Finding the minimum for general $t,k,v$ (known as the covering array number) is a hot research topic, one of the most prominent researchers is Prof. Charlie Colbourn.