Two switches, four algorithms
Counting arrangements comes down to two questions: whether elements may repeat, and whether order matters. The first list offers no repetition or with repetition, the second offers order or no order, and the cross product is four algorithms. Fields take the total count n and the chosen count m. Controls compute, load a sample, clear and copy. Flipping either switch changes the answer by orders of magnitude.
Steps
- Decide the scenario: can values repeat, and does sequence matter.
- Choose repetition or no repetition in the first list.
- Choose order or no order in the second.
- Enter n and m, where m cannot exceed n without repetition.
- Compute and verify with a small case such as three items choosing two.
- Copy the result, clearing before a new problem.
Formulas for the four cases
No repetition with order is a permutation, the product from n down to n minus m plus one, that is n factorial over n minus m factorial. No repetition without order is a combination, the permutation divided by m factorial. With repetition and order it is n to the power m, the combination lock case. With repetition and no order it is a multiset combination, the count of n plus m minus one choosing m, often described as placing identical balls into boxes. When m exceeds n without repetition the count is zero, a genuine impossibility rather than an error.
Common mistakes
Treating passwords and plates as non-repeating when repetition is allowed. Counting prize draws with order and inflating totals. Expecting a non-zero result when m exceeds n. Using a combination where ranking requires order. Forgetting that elements are distinct, when the real problem groups identical items. And reading scientific notation as an exact count.
Where counting is not enough
Enumerating every arrangement needs brute force or code. Restricted cases need inclusion and exclusion first. Probabilities need a denominator. And a count alone never gives a probability.