Hacker News new | past | comments | ask | show | jobs | submit login

Yes. With combinations, you get a combinatorial explosion.

With permutations, you get—IIRC, the factorial?—which is much, much worse. Mistaking permutations for combinations isn’t a small error.




IIRC with combinations you get factorials (n!) while with permutations you get n^n.


With permutations without repetitions you get factorials (n!) while with permutations with repetitions you get n^n.

More precisely, when taking N objects out of M, the number of permutations is always computed by multiplying N factors, which are either all equal to M when repetitions are allowed (i.e. the power M^N) or they are decreasing by one at each factor when the extracted objects must be unique (i.e. M*(M-1)*(M-2) ...), which gives the factorial in the case of N taken out of N.

With combinations either with or without repetitions you also get a product of N factors, but each factor is much smaller, being a ratio of two integers, instead of the integer that is the numerator. This is usually written in a form that is useless for actual computation, as the ratio between a factorial and the product of other two factorials (which differ between the two kinds of combinations).

The sum of all combinations without repetitions is 2^N (when repetitions are allowed, the sum is infinite).


Welp, no wonder I had to redo my engineering mathematics course.

Thanks for the correction.


Nope. Combinations are subsets: you either include or exclude each element. So 2^n. With permutations, you have n options for the first element, (n-1) options for the second, and so on. Thus n! possibilities total.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: