I'll get straight into it:

The problem I'm working on is described as a lock with 12 buttons where in a certain combination, a button can only be pressed once, and the combination could be in length anywhere between 1 and 12. It asks me to calculate the number of possible combinations that would open this lock, and a "pseudo code" example of how a computer would find the combinations themselves. Now, this last part doesn't seem like it fits here, but I threw it in anyway.

So what is the process for this? I was thinking along the lines of combinations formula where the pool is 12 and choose is 1-12, and they are all added up, but I don't think this is correct as it gave me a very large number.

Thanks, Emanuel

  • $\begingroup$ Large numbers are common in combinatorics. Am I correct in assuming the sequence in which the buttons are pressed matters? In that case, you would have to multiply the number of ways of choosing the numbers by the number of ways they could be arranged. $\endgroup$ – N. F. Taussig May 15 '19 at 20:02
  • $\begingroup$ Sequence does not matter in this case $\endgroup$ – Emanuel Elliott May 15 '19 at 20:04
  • $\begingroup$ If that is true, then the method you outlined is correct. $\endgroup$ – N. F. Taussig May 15 '19 at 20:05
  • $\begingroup$ I see. Could you type something up as an answer so I can mark it as solved? Edit: I can answer myself. Thanks $\endgroup$ – Emanuel Elliott May 15 '19 at 20:11
  • 1
    $\begingroup$ Alternatively, each button is either in the combination or is not, for $2^{12}$ combinations, except you need to subtract the combination with zero buttons, so $2^{12}-1$. $\endgroup$ – Mike Earnest May 15 '19 at 21:48

If anyone comes across this looking for a solution, look in the comments.

TLDR: Use combinations formula for each combination length and add them all together, which is your total amount of combinations.

Thanks to N. F. Taussig for that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.