1

I've got a combination lock with ten buttons (digits 0..9) and each button can be either depressed or not, like the one below. I'm guessing that this question is related.

This lock is configurable:

  • For each button, I can choose whether it should be depressed or not.
  • This means I can choose not only the combination but also the length of the combination! Anything from zero to ten depressed buttons can be valid.
  • Obviously, a digit can only appear once in the code.
    (If you try 1231 then you'll notice that the final digit is already depressed).
  • Finally, the sequence is irrelevant: 123 = 321 = 231...

Question: How long is the combination that has the lowest odds of being found?

a small safe used to store house keys in

2 Answers2

4

Assuming the attacker knows nothing: any of the $2^{10} = 1024$ combinations.
Assuming the attacker knows the number of buttons depressed:
$$\max_{k=0}^{10} \binom{10}k \stackrel{\text{symmetry}}= \binom{10}5 = 252$$ Taking into consideration "psychical aspects": no idea.

AlexR
  • 24,905
  • OP seems to be missing that the combination for the safe is much better modeled and understood as a ten digits long binary number – lsoranco Jan 20 '14 at 12:42
  • @Zado maybe, but what does that change? – AlexR Jan 20 '14 at 12:44
  • @Zado: True, I didn't realize this. And now that I am aware of it, I still don't get it. :-) Alex's answer looks perfectly understandable, though. – Torben Gundtofte-Bruun Jan 20 '14 at 12:45
  • It changes nothing, except maybe how easily you can get to the $2^{10}$ value. If you think in terms of numbers and you have to say stuff like "Okay...3241 is the same thing than 4321" you can get easily confuse on what you should avoid double-counting. On the other hand, if you think that "3241 and 4321 are both represented by 1111000000" it makes everything much more easy. At least in my experience. – lsoranco Jan 20 '14 at 12:49
1

Because each button has to be either pressed or unpressed you need just choose the subset of numbers that have to be pressed. For $n$ element set there are $2^{n}$ different subsets each of them repesenting a combination a key in your lock. So the answer is $2^{10} = 1024$ possible keys. The best option is to choose just a random subset as a key. Although that number of possibilities is relatively small so I that lock is still easy to brute force despite the key choose.