The three basic formulas
Combinatorics answers the question of how many ways something can be done. Most problems reduce to choosing from n items and two questions: does order matter, and may items repeat.
Permutations P(n) = n! line up all n distinct items. For example, 5 people can be seated on 5 chairs in 5! = 120 ways.
Arrangements A(n, k) = n!/(n − k)! choose k of n items with order mattering. Gold, silver and bronze among 10 runners can be awarded in 10·9·8 = 720 ways.
Combinations C(n, k) = n!/(k!·(n − k)!) choose k of n items when order does not matter. A team of 5 from 12 people can be formed in C(12, 5) = 792 ways. A combination is an arrangement divided by k!, because each set of k items is counted k! times in different orders.
Repetition
If items may be chosen again, arrangements with repetition equal nᵏ: a 4-digit lock code has 10⁴ = 10,000 variants. Combinations with repetition are C(n + k − 1, k): choosing 3 pastries of 3 kinds can be done in C(5, 3) = 10 ways.
If some of the n items are identical (n₁ of one kind, n₂ of another and so on), the number of distinct permutations is n!/(n₁!·n₂!·…·n_m!). This is how anagrams are counted: the word banana has 6 letters, with a three times, n twice and b once, so 6!/(3!·2!·1!) = 60 words.
Telling the formulas apart
Ask yourself whether swapping two chosen items gives a different outcome. If yes, you need arrangements or permutations; if not, combinations. If every item is taken, use permutations. If the same item may be taken again, use the formulas with repetition.
Big numbers
Counts grow extremely fast: 20! already exceeds two quintillion and 100! has 158 digits. The calculator works with exact integers, without rounding, and groups the digits for easier reading.
Link to probability
Classical probability is the number of favourable outcomes divided by the number of equally likely outcomes. Both numbers are usually found with combinations, for example the chance of guessing 6 numbers out of 49 is 1/13,983,816.