Counting and Combination Puzzles: How to Count Every Way
This article was written with AI and may contain mistakes. Found one? Tell us.
To solve a counting and combination puzzle, split the choice into small stages, multiply the options when the stages happen one after another, and add them when the cases are separate alternatives. Then check that every arrangement is counted exactly once, by deciding early whether order matters and whether items may repeat.
Those three ideas, multiply, add and count once, carry almost every how-many-ways puzzle. This guide explains each one, compares the main counting styles in a table, works through a full example and ends with a practice puzzle and its answer.
What is a counting and combination puzzle?
It is a puzzle whose answer is a number of ways. How many orders can four tiles stand in? How many ways can you pick two colours from five? How many ways can twelve tiles be split into three piles?
Guessing never settles it. You either list every case in a tidy order, or you use a rule that counts the list without writing it out. Good solvers do both: a rule for speed and a short list to check it.
When do you multiply and when do you add?
Multiply when one choice is followed by another and every first choice can be paired with every second choice. A strip of three squares, each painted in one of four colours, gives 4 times 4 times 4, which is 64 strips.
Add when the cases are separate and no arrangement belongs to two of them. If a path either goes over a bridge, with three bridges to choose from, or through a tunnel, with two tunnels, there are 3 plus 2, which is 5 routes.
A quick test helps. Read your plan aloud. If it says first this and then that, multiply. If it says either this or that, add.
How do you count orderings?
To count the orders of different items, fill the places one at a time. Four tiles in a row give 4 choices for the first place, 3 for the second, 2 for the third and 1 for the last, so 24 orders. Five tiles give 120.
This product is written with an exclamation mark: 4! means 4 times 3 times 2 times 1. It grows very fast, which is why listing stops being practical after about five items.
Order puzzles often ask about more than the number of orders. A pair of tiles is out of order when a larger number stands to the left of a smaller one, and a drop is a place where the next tile is smaller. A paper published on 28 February 2010 defines both measures for arrangements of the numbers 1 to n [2]. The same paper recalls a classic result: for every total k, the arrangements with exactly k out-of-order pairs are as many as those whose drop positions add up to k [2].
You can test this on three tiles. The six orders give out-of-order totals of 0, 1, 1, 2, 2 and 3, and drop-position totals with exactly the same spread: one order scores 0, two score 1, two score 2 and one scores 3. A computer check confirms the match for every length up to seven tiles.
When does order not matter?
When you choose a group rather than a line, swapping two members gives the same group. Picking two tiles from five in order gives 5 times 4, which is 20, but each pair has been counted twice, once in each order. So there are 10 unordered pairs.
The general move is: count as if order mattered, then divide by the number of orders each group was counted in. Choosing three from five gives 60 ordered picks, each group appears 6 times, so 10 groups.
Choice can hide inside an ordering puzzle. A paper published on 4 March 2009 looks at arrangements of 1 to 6 that fall steadily across the first four places and again across the last two [3]. Such an arrangement is fixed once you know which four numbers sit in the first block, so there are exactly 15 of them [3]. The question about order has turned into a question about choice.
How do the main counting styles compare?
Here is the same small task, pick three from five items, counted four different ways.
| Counting style | Does order matter? | Can items repeat? | How to count | Picks of three from five |
|---|---|---|---|---|
| Strings | Yes | Yes | Multiply the same number again and again | 125 |
| Orderings | Yes | No | Multiply falling numbers | 60 |
| Groups | No | No | Ordered count divided by orders of each group | 10 |
| Splits of a number | No | Yes, part sizes may repeat | List parts in falling order | see the next section |
Before you start any count, place your puzzle in one row of this table. Most wrong answers come from using the rule of the wrong row.
How do you split a number into parts?
Splitting a number is a counting puzzle where the parts are amounts, not labelled items. A paper published on 23 August 2024 describes a partition of a whole number as a list of positive whole numbers that add up to it, with no attention paid to the order in which the parts are written [1].
So 5 plus 2 plus 1 and 1 plus 5 plus 2 are the same split of 8. To avoid listing one split twice, always write the parts from largest to smallest. Splitting 8 into three parts then gives exactly five splits:
- 6 + 1 + 1
- 5 + 2 + 1
- 4 + 3 + 1
- 4 + 2 + 2
- 3 + 3 + 2
If order did matter, 8 would have 21 ordered splits into three parts. That gap is the double counting the falling-order habit removes.
The 2024 paper also states a step rule: the splits of n into exactly m parts equal the splits of n minus 1 into m minus 1 parts, plus the splits of n minus m into m parts [1]. The reason is easy to see. Either the smallest part is 1, and removing it leaves a split of 7 into two parts, or every part is at least 2, and taking 1 from each part leaves a split of 5 into three parts. For 8 that is 3 plus 2, which is 5.
Puzzles can add rules about the parts. The same paper gives a formula for splits of n into exactly two parts in which no even part repeats: n divided by 2, rounded down, minus one when n is a multiple of 4 [1]. For 8 the split 4 + 4 is ruled out, leaving 3.
How do you avoid double counting?
Double counting happens when one arrangement fits two of your cases. There are three standard fixes.
- Choose a fixed order for listing. Write parts from largest to smallest, or groups in rising order, so each case has one written form.
- Count, then divide. If every arrangement was counted the same number of times, divide by that number.
- Add, then take away the overlap. Among the numbers from 1 to 30, the even ones number 15, those that divide by 3 number 10, and those in both lists number 5. So 15 plus 10 minus 5 gives 20 numbers in at least one list.
The third fix has a twin: count the complement. When the arrangements you want are awkward, count all of them and take away the ones you do not want. The worked example below uses exactly that.
What is the step-by-step method?
- Restate the question. Write in plain words what one finished arrangement looks like.
- Pick the row of the table. Decide whether order matters and whether things may repeat.
- Break it into stages or cases. Stages are multiplied, separate cases are added.
- Look for an easier opposite. If the rule forbids something, count everything and subtract the forbidden ones.
- Count a second way. Use a different route, or list a smaller version by hand, and make sure both give the same total.
How does the method solve a full example?
Here is an original puzzle. A shelf has five slots in a row. You place three different jars, red, blue and green, in three of the slots, one jar per slot. The red jar and the blue jar must never stand in neighbouring slots. How many ways can the jars be placed?
Step 1: restate. A finished arrangement is a slot for red, a different slot for blue and a third slot for green, with red and blue not side by side.
Step 2: pick the row. The jars are different and two jars never share a slot, so this is an ordering count: order matters and nothing repeats.
Step 3: count everything. Red has 5 slots, then blue has 4, then green has 3. That gives 5 times 4 times 3, which is 60 placements with no rule at all.
Step 4: count the forbidden ones. Five slots in a row contain 4 neighbouring pairs. Red and blue can fill a pair in 2 orders, and green then has 3 free slots. So 4 times 2 times 3 gives 24 placements break the rule.
Step 5: subtract. 60 minus 24 leaves 36 allowed placements.
Step 6: check a second way. Use the add rule on where red stands. If red is in an end slot, 2 choices, only one slot is next to it, so blue has 3 slots and green then has 3: 2 times 3 times 3 is 18. If red is in one of the 3 middle slots, two slots are next to it, so blue has 2 slots and green has 3: 3 times 2 times 3 is 18. Adding the cases gives 18 plus 18, which is 36. Both routes agree, and a computer check of all 60 placements gives the same single total.
What are the most common mistakes?
- Counting groups as orderings. If swapping two members changes nothing, divide.
- Counting orderings as groups. If a first place and a second place exist, do not divide.
- Multiplying separate cases. Either-or cases are added, never multiplied.
- Overlapping cases. If one arrangement fits two cases, take the overlap away once.
- Trusting one route. Always check with a second count or a small list.
Can you solve this practice puzzle?
You have twelve identical tiles. Split them into three piles so that every pile holds at least two tiles. The piles are not labelled, so only the pile sizes matter. How many different splits are there?
Try it with the falling-order habit before you read on.
Answer: there are 7 splits. Written largest first they are 8 + 2 + 2, 7 + 3 + 2, 6 + 4 + 2, 6 + 3 + 3, 5 + 5 + 2, 5 + 4 + 3 and 4 + 4 + 4. A neat shortcut: take one tile from each pile, and the puzzle becomes splitting 9 into three parts of at least 1, which also has 7 splits.
Now count shapes instead of tiles. Group the triangles in this figure by size, count each group once and add the groups together.
References
- Namphaisaal, D., & Srichan, T. (2024, August 23). On the Number of Partitions of n into Exactly m Parts Whose Even Parts are Distinct. The Electronic Journal of Combinatorics, 31(3), P3.19. DOI 10.37236/12755
- Dzhumadil'daev, A. (2010, February 28). MacMahon's Theorem for a Set of Permutations with Given Descent Indices and Right-Maximal Records. The Electronic Journal of Combinatorics, 17(1), R34. DOI 10.37236/306
- Eriksen, N., Freij, R., & Wästlund, J. (2009, March 4). Enumeration of Derangements with Descents in Prescribed Positions. The Electronic Journal of Combinatorics, 16(1), R32. DOI 10.37236/121