28 original competition-style problems: counting arrangements, paths, subsets and tilings. Try each one before opening the hints; the second hint gives more away, and the full solution explains why the method works and where the idea leads.
For teachers: project, add to a worksheet or set as homework
Press Project on any problem to show it full screen with a timer, the hints, the answer and the worked solution one step at a time (arrow keys move between problems; Space reveals the next step; F full screen; Esc closes). Switch on the ‘Add to worksheet’ buttons, pick problems, then print them from the worksheet builder or set them as homework for a class, with the full solutions as the mark scheme. Free problems are free for every class; problems marked ‘With a plan’ can be set by teachers with a plan or school licence. Ready-made sessions: maths club packs.
A three-digit number is called climbing if each digit is larger than the digit before it, like 147. How many climbing numbers use only the digits 1 to 6?
Hint
If you choose any three different digits, in how many ways can you put them in climbing order?
Second hint
Each choice of three different digits from 1 to 6 gives exactly one climbing number. How many ways can you choose 3 from 6?
Full worked solution
Answer: 20
A climbing number uses three different digits, written in increasing order.
Conversely, any choice of three different digits from {1, …, 6} can be written in increasing order in exactly one way.
So climbing numbers correspond one-to-one with 3-element subsets of {1, 2, 3, 4, 5, 6}.
In how many ways can you make exactly 20p using 1p, 2p and 5p coins if you must use at least one coin of each kind? (Only the number of each coin matters, not the order.)
Hint
Use one of each first (that is 8p). Then count ways to make the remaining 12p with any coins.
Second hint
After one of each coin (8p), make the remaining 12p from 1p, 2p and 5p coins: try 0, 1 or 2 five-pence coins.
Full worked solution
Answer: 13
Use one coin of each kind first: 1p + 2p + 5p = 8p. We still need 12p, now with any number (including zero) of each coin.
Organise by the number of extra 5p coins, which can be 0, 1 or 2 (three would be 15p, too much).
0 extra 5p: make 12p from 2p and 1p. The number of 2p coins can be 0, 1, …, 6 and the rest is 1p: 7 ways.
1 extra 5p: 7p left. 2p coins: 0, 1, 2 or 3: 4 ways.
2 extra 5p: 2p left. 2p coins: 0 or 1: 2 ways.
Total: 7 + 4 + 2 = 13.
Why this works: ‘At least one of each’ is easiest handled by paying one of each up front. Then organise by the largest coin, where there are fewest cases.
Where it leads: Counting coin combinations is the start of generating functions: the answer is a coefficient of (1 + x + x2 + …)(1 + x2 + …)(1 + x5 + …).
A robot walks along grid lines from (0, 0) to (4, 2), always moving one unit right or one unit up. The point (2, 1) is broken and the robot must not pass through it. How many different routes are there?
Hint
Count all routes, then subtract the ones that go through (2, 1).
Second hint
All routes: 15. Through (2, 1): routes to (2, 1) times routes from (2, 1) to (4, 2).
Full worked solution
Answer: B, 6
Every route has 4 moves right (R) and 2 up (U): 6 moves in total.
All routes: choose which 2 of the 6 moves are U: 6 × 5 ÷ 2 = 15.
Routes through (2, 1): reach it with 2 R and 1 U in any order: 3 ways.
From (2, 1) to (4, 2): 2 R and 1 U again: 3 ways. Through-routes: 3 × 3 = 9.
Allowed routes: 15 − 9 = 6 (B).
Why this works: Counting the complement (the routes you do not want) is often easier, and routes through a point multiply: ways in × ways out.
Where it leads: Counting lattice paths with obstacles by subtracting is inclusion–exclusion; with many obstacles it becomes a dynamic-programming table.
How many squares of any size can be traced along the lines of a 3 by 5 grid of unit squares?
Hint
Count 1 by 1 squares, then 2 by 2, then 3 by 3.
Second hint
A k by k square fits in (4 − k) × (6 − k) positions on a grid with 4 by 6 grid points.
Full worked solution
Answer: 26
Count squares by size. A k by k square needs k consecutive rows and k consecutive columns of the 3 by 5 grid.
1 by 1: 3 rows × 5 columns = 15 positions.
2 by 2: (3 − 1) × (5 − 1) = 2 × 4 = 8 positions.
3 by 3: (3 − 2) × (5 − 2) = 1 × 3 = 3 positions.
4 by 4 or bigger cannot fit in 3 rows.
Total: 15 + 8 + 3 = 26.
Why this works: A k by k square fits in (rows − k + 1) × (columns − k + 1) positions. Organising by size makes sure nothing is missed or double counted.
Where it leads: Tilted squares with corners on grid points are not counted here; including them changes the count completely.
Ali, Bea, Cai, Dan and Eve sit in a row of five chairs. Ali will not sit at either end, and Bea must sit next to Cai. How many seating plans are possible?
Hint
Glue Bea and Cai together as one block (which can be BC or CB). Then deal with Ali.
Second hint
Treat BC as a block: arrange 4 objects with Ali not at an end, then double for CB.
Full worked solution
Answer: 24
Glue Bea and Cai into one block. The block covers two neighbouring chairs: 1–2, 2–3, 3–4 or 4–5, and inside it the order is BC or CB (2 ways).
Block at 1–2: free chairs 3, 4, 5. Ali may not take chair 5 (an end): 2 choices.
Block at 2–3: free chairs 1, 4, 5. Ali must take chair 4: 1 choice.
Block at 3–4: free chairs 1, 2, 5. Ali must take chair 2: 1 choice.
Block at 4–5: free chairs 1, 2, 3. Ali takes 2 or 3: 2 choices.
So 2 + 1 + 1 + 2 = 6 ways to place the block and Ali. Dan and Eve fill the last two chairs in 2 ways.
Total: 6 × 2 (block order) × 2 (Dan, Eve) = 24.
Why this works: ‘Must be next to’ is handled by gluing into a block; a ‘not at the ends’ rule is best handled case by case once the block is placed.
Where it leads: Combining ‘glue together’ with ‘not at the ends’ is typical of seating problems; doing the most restricted person first keeps the count simple.
Why this works: Splitting on the last position gives a recurrence. This one produces the Fibonacci numbers, which turn up whenever ‘no two in a row’ is the rule.
Where it leads: The answers are Fibonacci numbers. Avoiding two adjacent reds on a circle instead gives the Lucas numbers.
How many three-digit numbers have all their digits odd and in strictly decreasing order from left to right (like 951)?
Hint
Choose which three odd digits to use. How many orders are allowed once you have chosen them?
Second hint
There are 5 odd digits and you choose 3 of them.
Full worked solution
Answer: B, 10
The odd digits are 1, 3, 5, 7, 9.
Any choice of three different odd digits can be written in decreasing order in exactly one way.
The number of ways to choose 3 of the 5 digits is (5 × 4 × 3) ÷ (3 × 2 × 1) = 10.
So there are 10 such numbers (B).
Why this works: When the order is forced (decreasing), counting numbers is the same as counting sets of digits.
Where it leads: This is why ‘n choose r’ counts so many things: increasing sequences, subsets, paths and committees are all the same count in disguise.
Why this works: Splitting by the last move turns a big count into two smaller counts of the same kind: a recurrence.
Where it leads: These are the Fibonacci numbers. The same recurrence counts domino tilings of a 2 × n strip and appears in nature in the spirals of sunflowers.
A grid of 2 rows and 4 columns of unit squares is drawn. How many rectangles of any size (including squares) can be found in it, with sides along the grid lines?
Hint
A rectangle is fixed by choosing two horizontal grid lines and two vertical grid lines.
Second hint
There are 3 horizontal lines and 5 vertical lines.
Full worked solution
Answer: C, 30
Every rectangle is fixed by its top and bottom edges (two of the 3 horizontal lines) and its left and right edges (two of the 5 vertical lines).
Pairs of horizontal lines: 3. Pairs of vertical lines: 5 × 4 ÷ 2 = 10.
Each combination gives a different rectangle: 3 × 10 = 30 (C).
Why this works: Describing each rectangle by the lines that bound it turns a fiddly picture count into a simple product of choices.
Where it leads: An m by n grid holds (m + 1 choose 2)(n + 1 choose 2) rectangles. Counting squares only is harder: try it for an 8 × 8 chessboard.
Six people are to be split into three pairs to play table tennis. In how many different ways can the pairs be formed? (Only who is with whom matters.)
Hint
Pick one person. How many choices are there for their partner?
Second hint
Then pick one of the four people left and choose their partner.
Full worked solution
Answer: 15
Take any one person, say the tallest. Their partner can be any of the other 5.
Of the 4 people left, take one; their partner can be any of the other 3.
The last 2 people form the last pair.
Total: 5 × 3 × 1 = 15.
Why this works: Always pairing up a chosen person first avoids counting the same set of pairs in different orders.
Where it leads: 2n people can be split into pairs in 1 × 3 × 5 × … × (2n − 1) ways (the double factorial). Pairings like this count Feynman diagrams in physics.
In how many ways can you choose two different numbers from 1, 2, 3, …, 10 so that their sum is even?
Hint
When is a sum of two whole numbers even?
Second hint
Both even or both odd. There are five of each.
Full worked solution
Answer: 20
A sum is even when both numbers are even or both are odd.
Two of the five even numbers: 5 × 4 ÷ 2 = 10 ways.
Two of the five odd numbers: also 10 ways.
Total: 20.
Why this works: Parity (odd or even) splits the choices into two simple cases.
Where it leads: Out of the 45 pairs, 20 have an even sum and 25 an odd sum. With a different set of numbers the balance changes: when is it exactly even?
A code is made of 3 letters, each one A, B, C or D. Letters can repeat, but two letters next to each other must be different (so ABA is allowed but AAB is not). How many codes are there?
Hint
Choose the letters from left to right. How many choices for each?
Second hint
4 choices for the first letter; then each later letter must avoid only the letter just before it.
Full worked solution
Answer: C, 36
First letter: 4 choices.
Second letter: anything except the first: 3 choices.
Third letter: anything except the second: 3 choices (it may equal the first).
Total: 4 × 3 × 3 = 36 (C).
Why this works: Building the code one letter at a time and counting the choices at each stage (the multiplication principle) works because the number of choices never depends on which earlier letters were picked.
Where it leads: This counts walks on a graph: 4 letters joined to each other. Colouring a path with k colours so neighbours differ gives k(k − 1)n−1; cycles are harder.
Four points are marked on one straight line and three points on a different, parallel line. How many triangles have all three corners among these seven points?
Hint
Three points on the same line do not make a triangle. So a triangle uses two points on one line and one on the other.
Second hint
Count ‘two on the first line, one on the second’ and ‘one on the first, two on the second’.
Full worked solution
Answer: 30
A triangle cannot have all three corners on one line, so it has two corners on one line and one on the other.
Two of the 4 points (6 ways) and one of the 3 points (3 ways): 18 triangles.
Two of the 3 points (3 ways) and one of the 4 points (4 ways): 12 triangles.
Total: 18 + 12 = 30.
Why this works: Splitting by where the corners lie gives cases that do not overlap and cover every triangle.
Where it leads: You can also count all choices of three points, C(7, 3) = 35, and subtract the collinear ones: C(4, 3) + C(3, 3) = 5. Both methods agree, a good check.
A diagonal of a polygon joins two corners that are not next to each other. How many diagonals does a polygon with 10 sides have?
Hint
From one corner, how many diagonals can you draw?
Second hint
Each corner joins to 10 − 3 = 7 others by a diagonal, and each diagonal has two ends.
Full worked solution
Answer: 35
From any corner you can draw a diagonal to every other corner except itself and its two neighbours: 10 − 3 = 7 diagonals.
10 corners × 7 = 70 counts every diagonal twice (once from each end).
So there are 70 ÷ 2 = 35 diagonals.
Why this works: Counting from each corner then halving is the same double-counting trick as in handshake problems.
Where it leads: An n-gon has n(n − 3)/2 diagonals. A harder question: at most how many points where two diagonals cross? (C(n, 4): each crossing comes from four corners.)
How many three-digit numbers have a units digit equal to the sum of the other two digits (like 257, since 2 + 5 = 7)?
Hint
Organise by the units digit c. How many choices of the first two digits give a + b = c?
Second hint
The first digit a is at least 1, so for a given c there are c choices of a (1 to c), and then b = c − a.
Full worked solution
Answer: 45
Let the number be abc with a ≥ 1 and a + b = c, where c is at most 9.
For a units digit c, a can be 1, 2, …, c (then b = c − a is fixed): c numbers.
Adding over c = 1 to 9: 1 + 2 + … + 9 = 45.
Why this works: Fixing the digit that is most constrained (the units digit) leaves a simple count for each case.
Where it leads: Each such number is 100a + 10b + (a + b) = 101a + 11b. Since 101 leaves remainder 2 on division by 11, none of them is a multiple of 11. Algebra on digits explains patterns like this at once.
An ice-cream van sells 5 flavours. Ella buys a tub of 3 scoops. Flavours may be repeated and the order of the scoops does not matter. How many different tubs could she buy?
Hint
Split by how many different flavours are in the tub: 3, 2 or 1.
Second hint
Three different flavours: choose 3 of 5. Two flavours: choose which flavour is doubled and which is single.
Full worked solution
Answer: D, 35
Three different flavours: choose 3 of 5: 10 tubs.
Exactly two flavours (one doubled): 5 choices for the doubled flavour and 4 for the single one: 20 tubs.
One flavour (all three scoops the same): 5 tubs.
Total: 10 + 20 + 5 = 35 (D).
Why this works: Organising by ‘how many different flavours’ gives three cases that are easy to count and cannot overlap.
Where it leads: Choosing r items from n kinds with repetition allowed gives C(n + r − 1, r): here C(7, 3) = 35. This is the ‘stars and bars’ formula.
A post office has only 2p and 7p stamps (as many as you like). How many of the amounts 1p, 2p, 3p, …, 30p can be made exactly?
Hint
Even amounts are easy. Which odd amounts can be made?
Second hint
An odd amount needs at least one 7p stamp, so it must be at least 7p.
Full worked solution
Answer: 27
Every even amount from 2p up is made with 2p stamps alone: 15 amounts (2p to 30p).
An odd total needs an odd number of 7p stamps, so at least one: the amount is at least 7p.
Every odd amount from 7p up works: 7p, then add 2p stamps for 9p, 11p, …, 29p: 12 amounts.
Only 1p, 3p and 5p are impossible, so 27 amounts can be made.
Why this works: A parity argument splits the amounts into even (always possible) and odd (needs a 7p stamp), and each case is then simple.
Where it leads: For two stamp values a and b with no common factor, the largest impossible amount is ab − a − b (here 5). This is the Frobenius coin problem; for three stamp values there is no simple formula.
An equilateral triangle with sides of length 3 is divided into 9 small equilateral triangles of side 1 by lines parallel to its sides. How many equilateral triangles of any size can be found in the figure?
Hint
Count the triangles pointing up and those pointing down separately.
Second hint
Pointing up: sizes 1, 2 and 3. Pointing down: only size 1 fits.
Full worked solution
Answer: 13
Pointing up: size 1: 6 (rows of 1, 2, 3). Size 2: 3. Size 3: 1 (the whole triangle). That is 10.
Pointing down: size 1: 3 (in the gaps between upward ones). Size 2 does not fit in a side-3 triangle.
Total: 10 + 3 = 13.
Why this works: Splitting by orientation and then by size makes sure every triangle is counted exactly once.
Where it leads: For a triangle of side n the total is ⌊n(n + 2)(2n + 1)/8⌋. Try n = 4 by the same method and check the formula.
Ann, Ben, Cal and Dee run a race and finish in some order with no ties. In how many of the possible finishing orders does Ann finish ahead of Ben?
Hint
How many finishing orders are there altogether?
Second hint
Swapping Ann and Ben in any order gives another order. How do the orders pair up?
Full worked solution
Answer: C, 12
There are 4! = 24 possible finishing orders.
Swap Ann and Ben in any order: Ann-ahead orders and Ben-ahead orders pair up exactly.
So half the orders have Ann ahead: 24 ÷ 2 = 12 (C).
Why this works: A symmetry (swapping two people) pairs every order with exactly one other, so the two kinds are equally common.
Where it leads: By the same argument, the chance that Ann, Ben and Cal finish in that exact relative order is 1/3! = 1/6. Symmetry arguments like this are central to probability.
Two identical rooks are placed on different squares of a 4 by 4 board. Rooks attack along their row and column. In how many ways can they be placed so that they do not attack each other?
Hint
Place one rook. How many squares are left that are not in its row or column?
Second hint
16 squares, minus its own row and column (7 squares), leaves 9. Then correct for the rooks being identical.
Full worked solution
Answer: 72
The first rook can go on any of 16 squares.
It attacks the other 3 squares of its row and 3 of its column, so the second rook has 16 − 1 − 6 = 9 safe squares.
16 × 9 = 144 counts each placement twice (the rooks are identical).
Answer: 144 ÷ 2 = 72.
Why this works: Placing objects one at a time, then dividing by the number of orders when they are identical, avoids double counting.
Where it leads: Placing n non-attacking rooks on an n × n board is choosing a permutation: n! ways. Rook placements are a tool for counting permutations with forbidden positions.
Four numbers: the smallest possible sum is 1 + 2 + 3 + 4 = 10, so only {1, 2, 3, 4}. 1 set. Five or more numbers sum to at least 15.
Total: 1 + 3 + 1 = 5.
Why this works: Sorting by the size of the set and using the smallest possible sum for each size makes sure nothing is missed or counted twice.
Where it leads: Counting subsets with a given sum is the ‘subset sum’ problem: easy for small sets, but believed to be very hard for computers when the sets are huge.
A jar holds lots of red, green, blue and yellow sweets. Without looking, Tom takes sweets one at a time. What is the smallest number he must take to be certain of having three sweets of the same colour?
Hint
What is the worst that could happen?
Second hint
He could take two of every colour without having three of any.
Full worked solution
Answer: C, 9
Worst case: Tom takes 2 red, 2 green, 2 blue and 2 yellow: 8 sweets and still no three the same.
So 8 is not enough.
With 9 sweets in 4 colours, if every colour had at most 2 there would be at most 8 sweets. So some colour has at least 3.
The answer is 9 (C).
Why this works: To be certain, imagine the worst case. The pigeonhole principle then guarantees the result one step later.
Where it leads: In general, to be sure of k of one colour with c colours you need c(k − 1) + 1 items. The same principle proves that two Londoners have exactly the same number of hairs.