I feel stupid, but I don't know how to calculate how many possible variations I can get from for example three spaces (1|2|3) Normally I'd say: "well that is easy, just take the number of spaces (=3) and 3^3"

But that doesn't work with two spaces, like "1|2", there are only 2 different ways on how to arrange two numbers, but 2^2 would be 4.

(I want to know how many spaces I need to get ~25000 possible variations)

  • $\begingroup$ What do you mean by "variations" and "spaces"? Maybe you could give some examples to clarify what it is you're looking for? $\endgroup$ – Hans Lundmark Apr 26 '11 at 9:59
  • 2
    $\begingroup$ Don't feel stupid - we all have gaps like this in our knowledge! $\endgroup$ – Undercover Mathematician Apr 26 '11 at 10:11

By variations, do you mean..

..placement without repetition

There are $n! = n*(n-1)* ... * 3 * 2 *1$ ways of ordering $n$ elements. So for 3, you have 3*2*1 = 6.

$8! = 8*7*6*5*4*3*2*1 = 40320$, which is as close to 25000 as you can get with a factorial.

..placement with repetition

Your original guess was right; the answer is $n^n$.

e.g. for 3 items, you have 3 choices for the first space, 3 choices for the second space, and 3 choices for the final space, so 3*3*3 = 27. For 2 also, i.e. 2*2 = 4 ways ((1|1), (1|2), (2|1), (2|2)).

$6^6 = 46656$ is as close to 25000 as you'll get.

  • $\begingroup$ thanks, as it is so often, before you can know the answer, you need to know the exact question first. I wasn't even aware that there are two possible ways to look at it $\endgroup$ – Blub Apr 26 '11 at 10:34

A note on terminology and notation...

There are two words you want to learn here, permutations and combinations.

Permutations are how many distinct arrangements can be made from a set, so (1,2,3) and (3,2,1) are different.

$$^nP_r = P^n_r = \frac{n!}{(n-r)!}$$

Combinations are how many subsets you can form from a set, so (1,2,3) is the same as (3,2,1), same elements.

$$^nC_r = C^n_r = \binom{n}{r} = \frac{n!}{r!(n-r)!}$$

Often combinations are spoken as "$n$ choose $r$", as they are the measure of how many choices there are from a set. So the UK National Lottery is a choice of 6 balls from 49, so the number of ways to choose this is "49 choose 6".

$$^{49}C_6 = \binom{49}{6} = 13,983,816$$


You seem to be using the term "variation" in an unorthodox way. An arrangement of $n$ objects is called a permutation. A variation is an arrangement of $k$ objects chosen from $n$ objects. The number of permutations of $n$ objects is $n!$ ("n factorial"), which is defined as the product of all natural numbers up to and including $n$.


He is referring to variation which is arrangement of k-objects from set of n where replacement is possible but order is not important. This is neither permutation nor combination. The answer is C(n+k-1,k) where the symbol C stands for number of combinations.


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.