Originally Posted by

**awkward** More generally, let N(n) be the number of possible codes for a n-button simplex lock.

Suppose you are choosing a code. Your first set of buttons can consist of 1 to n buttons. Let's say you decide to push i buttons. You can choose the set of i buttons in $\displaystyle \binom{n}{i}$ ways. You can stop right there or go on to pick another set of buttons. If you decide to continue, there are N(n-i) codes left to (possibly) choose. So

$\displaystyle N(n) = \sum_{i=1}^n \left( \binom{n}{i} + \binom{n}{i} N(n-i) \right) = \sum_{i=1}^n \left( 1 + N(n-i) \right) \binom{n}{i}$

Combined with $\displaystyle N(0) = 0$, this is sufficient to compute N(5). I calculate N(n) = 1, 5, 25, 149, 1081 for n = 1, 2, 3, 4, 5. Better check the calculations, I am notoriously unable to compute anything.

jw