I know the basic permutation formula for k objects out of an n set. But what is the formula for determining the number of permutations where k is a range (1..m) ?

What are the formula for the following scenarios?

1) a keyless door lock has n distinct buttons, the combination can be any length (1..m), and in any sequence, but each button can only be used once.

2) same as 1, except any step in the sequence (1..m) can be two buttons pushed together, the constraint that a button only pressed once, still holds


Let's do (1) and you can finish (2) yourself.

  1. Pick the buttons for the combination - $\binom{n}{m}$ ways
  2. Arrange them in any of the $m!$ orders.

You get $$\binom{n}{m} m! = \frac{n!}{(n-m)!}$$

UPDATE This takes care of any fixed $m$. To get the result for different $m$, add different possibilities: $$ \sum_{k=1}^m \frac{n!}{(n-k)!} $$

  • $\begingroup$ I believe you shared the formula for permutations for a fixed sample size n out of a population of m. My question is about a variable sample size (1..m) $\endgroup$ – MarkE Jun 14 '16 at 22:15
  • $\begingroup$ @MarkE see update $\endgroup$ – gt6989b Jun 15 '16 at 3:57
  • $\begingroup$ Are you sure that is correct? The answer is undefined when m=n $\endgroup$ – MarkE Jun 15 '16 at 17:37
  • $\begingroup$ @MarkE $0!=1$... $\endgroup$ – gt6989b Jun 15 '16 at 17:44
  • $\begingroup$ Doh! Wasn't thinking. $\endgroup$ – MarkE Jun 15 '16 at 23:00

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.