Library · Between the Challenge and the Olympiad · Chapter 11

Sets, Inclusion-Exclusion and Configurations

Revised Report an error
On this page
  1. Problems
  2. Solutions
  3. Solution: IOQM 2026, Q1
  4. Solution: IOQM 2026, Q12
  5. Solution: IOQM 2024, Q9
  6. Solution: IOQM 2025 Part SEP, Q7
  7. Solution: IOQM 2025 Part SEP, Q28
  8. Solution: IOQM 2026, Q17
  9. Solution: PRMO 2017, Q22
  10. Solution: PRMO 2019, Q27
  11. Solution: IOQM 2020, Q15
  12. Solution: IOQM 2021 Part A, Q11
  13. Solution: IOQM 2023, Q16
  14. Solution: IOQM 2024, Q19
  15. Solution: IOQM 2026, Q26
  16. Solution: PRMO 2018, Q26
  17. Solution: IOQM 2020, Q27
  18. Solution: IOQM 2023, Q18

Problems

Problem 1

The central square of a 9×99 \times 9 chessboard is white. How many white squares are there on the board? (The squares of the chessboard are coloured alternately black and white.)

Problem 2

A 7×77 \times 7 board is divided into 4949 unit squares. We place checkers on the board, at most one per square. Find the largest number of checkers that can be placed on the unit squares so that each row, as well as each column, contains an even number of checkers.

Problem 3

Consider the grid of points X={(m,n)∣0≤m,n≤4}X = \{(m,n) \mid 0 \leq m, n \leq 4\}. We say a pair of points {(a,b),(c,d)}\{(a,b), (c,d)\} in XX is a knight-move pair if (c=a±2c = a \pm 2 and d=b±1d = b \pm 1) or (c=a±1c = a \pm 1 and d=b±2d = b \pm 2). The number of knight-move pairs in XX is:

image

Problem 4

A quadrilateral has four vertices A,B,C,DA, B, C, D. We want to colour each vertex in one of the four colours red, blue, green or yellow, so that every side of the quadrilateral and the diagonal ACAC have end points of different colours. In how many ways can we do this?

Problem 5

Consider a 2×32 \times 3 rectangle made of 6 unit squares. In how many ways can we fill up the six cells using the numbers 1,2,3,4,5,61, 2, 3, 4, 5, 6, one in each cell, such that any two numbers in adjacent cells (that is, in cells that share a common side) are coprime to each other?

six cells, the numbers 1 to 6
six cells, the numbers 11 to 66

Problem 6

There are six coupons numbered 1 to 6 and six envelopes, also numbered 1 to 6. The first two coupons are placed together in any one envelope. Similarly, the third and the fourth are placed together in a different envelope, and the last two are placed together in yet another different envelope. How many ways can this be done if no coupon is placed in the envelope having the same number as the coupon?

Problem 7

Find the number of ordered triples (x,y,z)(x, y, z) of positive integers such that 1≤x,y,z≤81 \leq x, y, z \leq 8 and ∣x−y∣+∣y−z∣+∣z−x∣=8.|x - y| + |y - z| + |z - x| = 8.

Problem 8

Suppose in the plane 10 pairwise nonparallel lines intersect one another. What is the maximum possible number of polygons (with finite areas) that can be formed?

Problem 9

We will say that a rearrangement of the letters of a word has no fixed letters if, when the rearrangement is placed directly below the word, no column has the same letter repeated. For instance, H B R A T AH\,B\,R\,A\,T\,A is a rearrangement with no fixed letters of B H A R A TB\,H\,A\,R\,A\,T. How many distinguishable rearrangements with no fixed letters does B H A R A TB\,H\,A\,R\,A\,T have? (The two AAs are considered identical.)

Problem 10

Three couples sit for a photograph in 2 rows of three people each such that no couple is sitting in the same row next to each other or in the same column one behind the other. How many arrangements are possible?

Problem 11

In how many ways can four married couples sit in a merry-go-round with identical seats such that men and women occupy alternate seats and no husband seats next to his wife?

Problem 12

The six sides of a convex hexagon A1A2A3A4A5A6A_1A_2A_3A_4A_5A_6 are coloured red. Each of the diagonals of the hexagon is coloured either red or blue. If NN is the number of colourings such that every triangle AiAjAkA_iA_jA_k, where 1≤i<j<k≤61 \leq i < j < k \leq 6, has at least one red side, find the sum of the squares of the digits of NN.

image

Problem 13

Consider five points in the plane, with no three of them collinear. Every pair of points among them is joined by a line. In how many ways can we colour these lines by red or blue, so that no three of the points form a triangle with lines of the same colour.

image

Problem 14

Three girls G1,G2,G3G_1, G_2, G_3, each read four stories S1,S2,S3,S4S_1, S_2, S_3, S_4 and discuss which ones they like. No story is liked by all the three. For each of the three pairs of the girls, there is at least one story which is liked by the pair and not liked by the third. Let nn be the number of ways in which this is possible. Find the sum of the squares of the digits of nn.

Problem 15

There are nn points in the plane, no three of which are collinear. Every pair of points is joined by a segment which is coloured red or blue such that the following conditions hold:

(a) If A,B,CA, B, C are three points such that ABAB is red and BCBC is blue, then ACAC is red.

(b) For any point AA, there are exactly three points B,C,DB, C, D such that ABAB, ACAC, ADAD are red.

Find the sum of all possible values of nn.

Problem 16

What is the number of ways in which one can choose 6060 unit squares from a 11×1111 \times 11 chessboard such that no two chosen squares have a side in common?

Problem 17

A bug travels in the coordinate plane moving only along the lines that are parallel to the xx axis or yy axis. Let A=(−3,2)A = (-3, 2) and B(3,−2)B(3, -2). Consider all possible paths of the bug from AA to BB of length at most 14. How many points with integer coordinates lie on at least one of these paths?

Problem 18

Let P\mathcal{P} be a convex polygon with 50 vertices. A set F\mathcal{F} of diagonals of P\mathcal{P} is said to be minimally friendly if any diagonal d∈Fd \in \mathcal{F} intersects at most one other diagonal in F\mathcal{F} at a point interior to P\mathcal{P}. Find the largest possible number of elements in a minimally friendly set F\mathcal{F}.

each diagonal crosses at most one other
each diagonal crosses at most one other

Problem 19

For how many numbers nn in the set {1,2,3,…,37}\{1, 2, 3, \ldots, 37\} can we split the 2n2n numbers 1,2,…,2n1, 2, \ldots, 2n into nn pairs {ai,bi},1≤i≤n\{a_i, b_i\}, 1 \leq i \leq n, such that ∏i=1n(ai+bi)\prod_{i=1}^{n} (a_i + b_i) is a square?

Solutions

Solution: IOQM 2026, Q1

Key idea

On a board with an odd number of squares a side, the colour of the centre is the colour of the corners, and that is the colour with one square to spare.

The centre and the same-parity row-column positions are white.
The centre and the same-parity row-column positions are white.

Number the rows and the columns from 11 to 99. Moving one square along a row or a column changes the colour and changes the sum of the two coordinates by one, so two squares share a colour exactly when their coordinate sums have the same parity. The centre is (5,5)(5, 5), with an even sum, so the white squares are those whose row and column numbers are both odd or both even.

Both odd: five choices of row and five of column, 2525 squares. Both even: four and four, 1616 squares. The number of white squares is 25+16=41,25 + 16 = 41, against 81−41=4081 - 41 = 40 black ones, so white is the colour with the square to spare.

Answer 41

Solution: IOQM 2026, Q12

Key idea

Seven is odd, so a row holding an even number of checkers has at least one empty square, and leaving one diagonal empty meets that bound in every row and every column at once.

image

Each row has seven squares and must hold an even number of checkers, so it holds at most six. The seven rows together hold at most 7×6=42.7 \times 6 = 42.

Leave the seven squares of a diagonal empty and fill the other 4242. The diagonal meets every row once and every column once, so each row and each column has exactly six checkers, which is even. The largest number is 4242.

Answer 42

Solution: IOQM 2024, Q9

Key idea

Count by the shape of the move rather than by the square it starts from: each of the four displacement types fits into the grid in the same number of ways.

A knight-move pair is a pair of points differing by one of the vectors (±2,±1)or(±1,±2).(\pm2, \pm1) \qquad \text{or} \qquad (\pm1, \pm2). Since a pair is unordered, we may fix the sign of the first coordinate and count the four displacement types (2,1),(2,−1),(1,2),(1,−2).(2,1), \quad (2,-1), \quad (1,2), \quad (1,-2).

Take (2,1)(2,1). Its starting point (a,b)(a,b) needs a≤2a \le 2 so that a+2≤4a + 2 \le 4, and b≤3b \le 3 so that b+1≤4b+1 \le 4, giving 3⋅4=123 \cdot 4 = 12 placements. Each of the other three types is a reflection of this one in a grid symmetry, so each also has 1212 placements.

Hence the number of knight-move pairs is 4⋅12=484 \cdot 12 = 48.

Answer 48

Solution: IOQM 2025 Part SEP, Q7

Key idea

The constraints make ABCABC and ACDACD two triangles glued along ACAC, so colour AA and CC first and then BB and DD independently.

Colour A,C first; the third vertex of each triangle is then independent.
Colour A,CA,C first; the third vertex of each triangle is then independent.

The pairs required to differ are ABAB, BCBC, CDCD, DADA and ACAC. Read that as two triangles, ABCABC and ACDACD, sharing the edge ACAC.

Colour AA first, in 44 ways. Then CC must differ from AA, giving 33 ways. Now BB must differ from both AA and CC, which are already different, so 22 ways; and DD must likewise differ from AA and CC, another 22 ways, with no constraint between BB and DD since BDBD is the diagonal that was left free.

Hence the count is 4⋅3⋅2⋅2=484 \cdot 3 \cdot 2 \cdot 2 = 48.

Answer 48

Solution: IOQM 2025 Part SEP, Q28

Key idea

The three even numbers are pairwise not coprime, so they must occupy one of the two chequerboard classes of the 2×32 \times 3 board, and the only remaining condition is that 33 and 66 are not adjacent.

Among 1,…,61, \ldots, 6 the pairs that are not coprime are {2,4}, {2,6}, {4,6}, {3,6}.\{2,4\},\ \{2,6\},\ \{4,6\},\ \{3,6\}. So 22, 44 and 66 must pairwise occupy non-adjacent cells, and additionally 33 must not sit next to 66.

Colour the board like a chessboard. The two colour classes are {(1,1),(1,3),(2,2)}and{(1,2),(2,1),(2,3)},\{(1,1), (1,3), (2,2)\} \qquad \text{and} \qquad \{(1,2), (2,1), (2,3)\}, and these are the only three-cell sets with no two cells adjacent. Indeed the two cells of a column are adjacent, so no column holds two chosen cells, and three cells in three columns then means exactly one per column; consecutive columns must use opposite rows, or their cells would be side by side, so the rows alternate and the set is one of the two above. So 2,4,62, 4, 6 fill one class and 1,3,51, 3, 5 the other, giving 2⋅3!⋅3!=722 \cdot 3! \cdot 3! = 72 arrangements before the last condition.

Now remove those with 33 next to 66. Fix the class holding the evens, place 66, and count. In either class one cell has three neighbours in the other class and the other two cells have two each. With 66 on a cell of degree δ\delta, the number of bad arrangements is 2⏟placing 2,4×δ⏟cells for 3×2⏟placing 1,5=4δ,\underbrace{2}_{\text{placing } 2, 4} \times \underbrace{\delta}_{\text{cells for } 3} \times \underbrace{2}_{\text{placing } 1, 5} = 4\delta, so the bad total for one class is 4(3+2+2)=284(3 + 2 + 2) = 28 out of its 3636 arrangements, leaving 88. The other class behaves identically, so the answer is 8+8=16.8 + 8 = 16.

Answer 16

Solution: IOQM 2025 Part SEP, Q7

Key idea

Each pair of coupons has four allowed envelopes, and the only extra work is removing the cases where two pairs land in the same envelope, which can happen in just one envelope-pair at a time.

The pair {1,2}\{1,2\} may go into any envelope except 11 and 22, so 44 choices; likewise {3,4}\{3,4\} avoids envelopes 33 and 44, and {5,6}\{5,6\} avoids 55 and 66. Ignoring the requirement that the three envelopes be different, that is 43=644^3 = 64 ways.

Now remove the clashes. If the pairs {1,2}\{1,2\} and {3,4}\{3,4\} share an envelope, that envelope must avoid 1,2,3,41, 2, 3, 4, so it is 55 or 66: two choices, and the third pair still has its 44, giving 2⋅4=82 \cdot 4 = 8 cases. The same count applies to each of the other two coincidences, by the same reasoning with the labels shifted. All three pairs in one envelope is impossible, since no envelope avoids all six numbers.

By inclusion and exclusion the number of assignments with all three envelopes distinct is 64−3⋅8=40.64 - 3 \cdot 8 = 40.

Answer 40

Solution: IOQM 2026, Q17

Key idea

For three numbers the three distances between them add up to twice the gap between the largest and the smallest, so the condition says only that the triple spans a range of 44.

The two shorter distances join to make the whole range.
The two shorter distances join to make the whole range.

Put the three values in order as p≤q≤rp \le q \le r. Whatever order xx, yy, zz take them in, the three distances are q−pq - p, r−qr - q and r−pr - p, whose sum is (q−p)+(r−q)+(r−p)=2(r−p).(q - p) + (r - q) + (r - p) = 2(r - p). So the condition is r−p=4r - p = 4: the largest and the smallest values differ by exactly 44.

The smallest value mm has m+4≤8m + 4 \le 8, so mm is one of 1,2,3,41, 2, 3, 4. With mm fixed, the triple takes values in {m,…,m+4}\{m, \ldots, m + 4\} and must use both ends. Of the 53=1255^3 = 125 ordered triples in that range, 43=644^3 = 64 miss mm and 6464 miss m+4m + 4, and 33=273^3 = 27 miss both, so by inclusion and exclusion 125−64−64+27=24125 - 64 - 64 + 27 = 24 use both ends. Four choices of mm give 4×24=964 \times 24 = 96 triples.

Answer 96

Solution: PRMO 2017, Q22

Key idea

Ten lines in general position bound 3636 regions, but a “polygon with finite area” need not be a single region, and counting every polygon whose sides lie along the lines gives a completely different number.

The dashed triangle is one polygon, but the fourth line splits its interior into two regions.
The dashed triangle is one polygon, but the fourth line splits its interior into two regions.

This question was discounted by the organisers, and the ambiguity is in the word polygons.

Under the first reading, a polygon means one of the regions into which the lines cut the plane. Three lines in general position form seven regions, just one of them bounded. On adding a fourth line, its three distinct intersections split it into four pieces, each of which splits an old region in two. The new total is therefore eleven. In general, line kk meets the previous k−1k-1 lines in distinct points and adds kk regions. Starting from one region with no lines, ten lines in general position, no two parallel and no three concurrent, therefore cut the plane into 1+10+(102)=561 + 10 + \binom{10}{2} = 56 regions. To count the unbounded ones, draw a circle large enough to contain every intersection. Each line crosses it twice, giving 2020 distinct crossing points and 2020 arcs between them. Each arc meets exactly one unbounded region, and every unbounded region meets one arc, so there are 2020 such regions. So the number of bounded regions is 56−20=36,56 - 20 = 36, which one can also write as (92)\binom{9}{2}.

Under the second reading, a polygon is any closed figure with finite area whose sides lie along the given lines, whether or not it is a single region. Then every three lines already bound a triangle, so there are at least (103)=120\binom{10}{3} = 120 polygons before quadrilaterals and larger figures are counted at all.

Both readings are natural, they give 3636 and something above 120120, and the paper offers no way to choose. That is why the question carries no answer.

Answer none

Solution: PRMO 2019, Q27

Key idea

Place the two identical AAs first, in the four positions they are allowed; whatever they take, the four distinct letters then face exactly two forbidden positions, and a two-term inclusion-exclusion counts those.

The word is B H A R A TB\,H\,A\,R\,A\,T, with the two AAs in positions 33 and 55 and the four distinct letters B,H,R,TB, H, R, T in positions 1,2,4,61, 2, 4, 6. A rearrangement has no fixed letters when no position holds the letter that was originally there.

Placing the AAs

Neither AA may go into position 33 or position 55, so the two of them occupy two of the four positions 1,2,4,61, 2, 4, 6. Since the AAs are identical, that is a choice of a pair: (42)=6\binom{4}{2} = 6 ways.

Placing the rest

Whichever pair the AAs take, four positions remain for B,H,R,TB, H, R, T: the two of {1,2,4,6}\{1,2,4,6\} left over, and positions 33 and 55. Positions 33 and 55 originally held AA, so any of the four letters may go there. The two remaining positions from {1,2,4,6}\{1,2,4,6\} each forbid exactly one letter, and the two forbidden letters are different.

So we must count the ways of matching four letters to four positions, one letter each, avoiding two specified letter-position pairs. By inclusion-exclusion, 4!−2×3!+1×2!=24−12+2=14.4! - 2 \times 3! + 1 \times 2! = 24 - 12 + 2 = 14.

Multiplying the two independent choices, 6×14=84.6 \times 14 = 84.

The reason this is so much easier than a general count of arrangements with nothing in its own place is that the repeated letter was handled first. Trying instead to run inclusion-exclusion over all six positions at once means tracking how many AAs have been fixed, which works but takes three times the writing.

Answer 84

Solution: IOQM 2020, Q15

Key idea

Count the seatings that fail rather than the ones that succeed. There are seven forbidden seat pairs, and inclusion-exclusion over the three couples needs only two facts about those seven: how many pairs of them are disjoint, and how many triples cover all six seats.

the seven forbidden pairs; seats 2 and 5 lie in three of them, the other four in two
the seven forbidden pairs;
seats 22 and 55 lie in three of them, the other four in two

Number the seats 1,2,31, 2, 3 across the front row and 4,5,64, 5, 6 across the back, with seat ii directly in front of seat i+3i+3. A couple is badly placed exactly when it occupies one of {1,2}, {2,3}, {4,5}, {5,6}(same row, adjacent),\{1,2\},\ \{2,3\},\ \{4,5\},\ \{5,6\} \quad \text{(same row, adjacent)}, {1,4}, {2,5}, {3,6}(same column),\{1,4\},\ \{2,5\},\ \{3,6\} \quad \text{(same column)}, which is seven forbidden pairs. Counting the good arrangements directly means tracking three interacting restrictions at once, whereas counting the bad ones lets inclusion-exclusion do the bookkeeping. Let AiA_i be the event that couple ii is badly placed, out of 6!=7206! = 720 seatings.

One couple badly placed

Choose one of the seven forbidden pairs, seat that couple in it in 22 ways, and arrange the remaining four people freely in 4!=244! = 24 ways, so ∣Ai∣=7⋅2⋅24=336|A_i| = 7 \cdot 2 \cdot 24 = 336 and the first sum is 3⋅336=10083 \cdot 336 = 1008.

Two couples badly placed

Now two of the seven pairs must be disjoint, since two couples cannot share a seat. The seven pairs meet the six seats with degrees 2,3,2,2,3,22, 3, 2, 2, 3, 2 respectively, so the number of pairs of forbidden pairs that share a seat is ∑(d2)=1+3+1+1+3+1=10\sum \binom{d}{2} = 1+3+1+1+3+1 = 10, leaving (72)−10=11\binom{7}{2} - 10 = 11 disjoint pairs. Assigning them to the two couples in 22 ways, ordering each couple in 2⋅22 \cdot 2 ways, and seating the last two people in 2!2! ways gives ∣Ai∩Aj∣=11⋅2⋅4⋅2=176|A_i \cap A_j| = 11 \cdot 2 \cdot 4 \cdot 2 = 176, so the second sum is 3⋅176=5283 \cdot 176 = 528.

All three couples badly placed

Here the three forbidden pairs must be disjoint and between them cover all six seats. Seat 11 appears in only two forbidden pairs, {1,2}\{1,2\} and {1,4}\{1,4\}, so split on which one is used.

If {1,2}\{1,2\} is used, seat 33 is left, and its only other pair is {3,6}\{3,6\}, since {2,3}\{2,3\} now clashes. Seats 44 and 55 remain, and {4,5}\{4,5\} is indeed forbidden, giving {1,2},{3,6},{4,5}\{1,2\}, \{3,6\}, \{4,5\}.

If {1,4}\{1,4\} is used, seat 33 takes {2,3}\{2,3\} or {3,6}\{3,6\}. The first leaves seats 5,65, 6, and {5,6}\{5,6\} is forbidden, giving {1,4},{2,3},{5,6}\{1,4\}, \{2,3\}, \{5,6\}. The second leaves seats 2,52, 5, and {2,5}\{2,5\} is forbidden, giving {1,4},{3,6},{2,5}\{1,4\}, \{3,6\}, \{2,5\}.

Every branch closed, so there are exactly three coverings. Assigning these to the couples in 3!3! ways and ordering within each couple in 232^3 ways gives 3⋅6⋅8=1443 \cdot 6 \cdot 8 = 144.

Inclusion-exclusion now yields 1008−528+144=6241008 - 528 + 144 = 624 bad seatings, so the number of acceptable arrangements is 720−624=96720 - 624 = 96.

Answer 96

Solution: IOQM 2021 Part A, Q11

Key idea

Seat the men first, which uses up the rotational freedom, and then the wives face a forbidden-position problem: each must avoid the two gaps flanking her husband.

Gap i is between M_i and M_{i+1} , reading indices cyclically.
Gap ii is between MiM_i and Mi+1M_{i+1}, reading indices cyclically.

The seats are identical, so two seatings that differ by a rotation are the same seating. The tidiest way to handle that is to place the men first and let them absorb the symmetry. Four men arranged in a circle up to rotation can be done in (4−1)!=3!=6(4-1)! = 3! = 6 ways.

Once the men are down, the four women must occupy the four gaps between consecutive men, which is what makes the seats alternate. Number the men M1,M2,M3,M4M_1, M_2, M_3, M_4 round the circle and number the gaps so that gap ii lies between MiM_i and Mi+1M_{i+1}, indices read cyclically. Wife WiW_i may not sit next to her own husband, so she is barred from gaps i−1i-1 and ii, which leaves her the other two: wifegaps she may useW12,3W23,4W34,1W41,2\begin{array}{c|c} \text{wife} & \text{gaps she may use} \\ \hline W_1 & 2, 3 \\ W_2 & 3, 4 \\ W_3 & 4, 1 \\ W_4 & 1, 2 \end{array}

Two gaps each is few enough to settle by looking at W1W_1. If W1W_1 takes gap 22, then gap 22 is gone, so W4W_4 must take gap 11; that closes gap 11, so W3W_3 must take gap 44; and W2W_2 is left with gap 33. If instead W1W_1 takes gap 33, the same chain forces W2W_2 to gap 44, then W3W_3 to gap 11, then W4W_4 to gap 22. So there are exactly two seatings of the wives, (W1,W2,W3,W4)↦(2,3,4,1)and(3,4,1,2),(W_1, W_2, W_3, W_4) \mapsto (2,3,4,1) \qquad \text{and} \qquad (3,4,1,2), and both are legal.

Multiplying the two independent choices, the number of seatings is 6×2=126 \times 2 = 12.

Answer 12

Solution: IOQM 2023, Q16

Key idea

Every triangle with a vertex-pair adjacent on the hexagon already has a red side, so the condition bites on exactly two triangles, A1A3A5A_1A_3A_5 and A2A4A6A_2A_4A_6, and those two use up the six short diagonals between them.

image

Of the (63)=20\binom63 = 20 triangles AiAjAkA_iA_jA_k, most are free. If two of the three chosen vertices are neighbours on the hexagon, the side joining them is a side of the hexagon, which is red, and the triangle is satisfied whatever we do. So the only triangles that impose anything are those whose three vertices are pairwise non-adjacent, and in a hexagon there are exactly two such triples, {A1,A3,A5}and{A2,A4,A6}.\{A_1, A_3, A_5\} \qquad \text{and} \qquad \{A_2, A_4, A_6\}.

Their sides are the six short diagonals, three for each triangle, and the two sets of three do not overlap. The hexagon’s three long diagonals A1A4A_1A_4, A2A5A_2A_5, A3A6A_3A_6 appear in neither, so they may be coloured freely.

Counting is now immediate. Each of the two triangles must avoid being all blue, which rules out 11 of the 23=82^3 = 8 colourings of its three sides, leaving 77; the choices for the two triangles are independent because they share no diagonal; and the three long diagonals contribute a factor 23=82^3 = 8. Hence N=7⋅7⋅8=392,N = 7 \cdot 7 \cdot 8 = 392, and the sum of the squares of the digits is 32+92+22=9+81+4=943^2 + 9^2 + 2^2 = 9 + 81 + 4 = 94.

Answer 94

Solution: IOQM 2024, Q19

Key idea

No vertex can carry three edges of one colour, so every vertex has exactly two red and two blue edges, which makes the red edges a five-cycle.

one colour on the pentagon, the other on the star
one colour on the pentagon, the other on the star

Suppose some point VV had three red edges, to XX, YY, ZZ. If any of XYXY, YZYZ, ZXZX were red it would close a red triangle with VV; and if all three were blue then XYZXYZ would be a blue triangle. Either way a monochromatic triangle appears. The same argument applies with the colours exchanged, so at each of the five points exactly two of the four edges are red and two are blue.

So the red edges form a graph on five vertices in which every vertex has degree two, that is, a disjoint union of cycles covering all five vertices. The only possibility is a single cycle of length five, since a shorter cycle would leave two or fewer vertices to carry a cycle of their own, and cycles need at least three vertices. The blue edges are then the complementary five edges, which also form a five-cycle, namely the "pentagram" of the red one.

Conversely, if the red edges form a five-cycle, no red triangle exists (a triangle would need three mutually adjacent vertices on a five-cycle) and neither does a blue one, by the same argument applied to the complementary five-cycle.

So the colourings correspond exactly to the five-cycles through the five points, and the number of these is 4!2=12,\frac{4!}{2} = 12, since a cycle can be written starting from a fixed vertex in 4!4! orders, and each cycle is counted twice, once in each direction.

Answer 12

Solution: IOQM 2025 Part SEP, Q28

Key idea

Each story is described by the set of girls who like it, which may be any of the seven subsets other than all three, and the requirement is that three particular subsets each occur.

Describe the situation by recording, for each of the four stories, the set of girls who like it. Since no story is liked by all three girls, each story gets one of the 23−1=72^3 - 1 = 7 subsets other than {G1,G2,G3}\{G_1,G_2,G_3\}. Without further conditions there are 747^4 possibilities.

The remaining requirement is that each of the three two-girl subsets {G1,G2}\{G_1,G_2\}, {G1,G3}\{G_1,G_3\}, {G2,G3}\{G_2,G_3\} is the label of at least one story, since a story liked by exactly that pair is a story liked by the pair and not by the third girl.

The requirement is that all three of those labels appear. Inclusion and exclusion applies with the three labels as the forbidden things: n=∑j=03(−1)j(3j)(7−j)4=74−3⋅64+3⋅54−44.n = \sum_{j=0}^{3}(-1)^j\binom3j (7-j)^4 = 7^4 - 3 \cdot 6^4 + 3 \cdot 5^4 - 4^4. Evaluating, n=2401−3888+1875−256=132,n = 2401 - 3888 + 1875 - 256 = 132, and the sum of the squares of the digits is 1+9+4=141 + 9 + 4 = 14.

Answer 14

Solution: IOQM 2026, Q26

Key idea

A red neighbour of BB must be joined in red to every blue neighbour of BB, and it has only three red segments. So each point has at most two blue segments, which leaves n=4,5,6n = 4, 5, 6 to try.

solid segments are red, dashed ones blue; every point has three solid segments
solid segments are red, dashed ones blue;
every point has three solid segments

Every point has three red segments, so n≥4n \ge 4, and each point has n−4n - 4 blue ones.

Fix a point BB and a red neighbour AA of it. For every CC with BCBC blue, condition (a) makes ACAC red. So AA has red segments to BB and to all n−4n - 4 blue neighbours of BB, which is n−3n - 3 red segments. There are only three, so n≤6n \le 6.

n=4n = 4. Every segment is red, so (a) never applies, and each point has three red segments. This works.

n=5n = 5. Each point has exactly one blue segment, so the blue segments pair off the five points, which is impossible for an odd number of points.

n=6n = 6. Split the points into two groups of three. Colour segments inside a group blue and segments between groups red. Each point has three red segments, to the other group. If ABAB is red then AA and BB are in different groups, and if BCBC is blue then CC is in BB’s group, so AA and CC are in different groups and ACAC is red. This works.

The possible values are 44 and 66, and their sum is 1010.

Answer 10

Solution: PRMO 2018, Q26

Key idea

A row can hold at most six chosen squares, and only by taking the odd columns; the total shortfall is then just six, which pins the choice down to every plain square of the chessboard colouring, or every shaded one but a single square.

sixty-one shaded squares and sixty plain ones; a legal sixty is all the plain, or all but one of the shaded
sixty-one shaded squares and sixty plain ones;
a legal sixty is all the plain, or all but one of the shaded

Two choices of sixty squares are easy to find, and between them they account for sixty-two selections. Everything after that is one long argument that there is nothing else, so it is worth knowing in advance that the target is 6262 and that the work lies entirely in the uniqueness.

Colour the board like a chessboard, calling a square black when its row and column numbers have the same parity. There are 36+25=6136 + 25 = 61 black squares and 6060 white ones, and no two squares of the same colour share a side.

Two families that work

Any 6060 of the 6161 black squares form a legal choice, which is (6160)=61\binom{61}{60} = 61 ways. So do all 6060 white squares, for one more. The claim is that there is nothing else, making 6262.

Rows and columns cannot do better than six

In a single row of eleven squares, no two chosen squares are adjacent, so at most six are chosen; and six is possible only by taking columns 1,3,5,7,9,111, 3, 5, 7, 9, 11. Call a row full when it holds six. The same statement holds for columns, with rows in place of columns.

Since the eleven rows hold 6060 squares in all and no row holds more than six, the total shortfall ∑i(6−ri)\sum_i (6 - r_i) is exactly 66. Every row that is not full contributes at least 11, so at most six rows are not full: at least five rows are full. The same argument gives at least five full columns.

Full rows and full columns have the same parity

Suppose row ii is full, so the chosen squares of that row sit exactly in the odd columns, and suppose column jj is full, so the chosen squares of that column sit exactly in the odd rows. Look at the square (i,j)(i,j). The row says it is chosen exactly when jj is odd; the column says it is chosen exactly when ii is odd. So ii and jj have the same parity.

Since at least one full column exists, all full rows share its parity, and so all full rows have the same parity as each other.

The even case gives the white squares

If the full rows are even-numbered there are only five of them available, so all of 2,4,6,8,102, 4, 6, 8, 10 are full, and likewise all of the columns 2,4,6,8,102, 4, 6, 8, 10. The full even rows contribute the 3030 squares (even row, odd column), the full even columns contribute the 3030 squares (odd row, even column), and these are all white and all distinct. That is already 6060 squares, so the choice is exactly the white class.

The odd case gives the black squares

Otherwise the full rows are odd-numbered. If all six odd rows are full, they contribute the 3636 squares (odd, odd). Each even row then lies between two full rows, so its squares must avoid the odd columns, leaving at most the five even columns; the five even rows therefore contribute at most 2525, and to reach 6060 they contribute 2424. So the choice is every black square but one.

If instead exactly five odd rows are full, then the six remaining rows, namely the five even rows and one odd row tt, each fall short by exactly one, so each holds five squares. Every even row still has a full odd neighbour, so it is confined to the even columns and takes all five of them, which are black. Row tt is odd, so its neighbours in the board are even rows, and it has at least one of them, namely row 22 if t=1t = 1, row 1010 if t=11t = 11, and both otherwise. That neighbour occupies every even column, so row tt can use none of them: it is confined to the odd columns and takes five of those six. Again the choice is every black square but one.

The count

Every legal choice of 6060 is therefore all the white squares, or all but one of the black squares: 1+61=62.1 + 61 = 62.

Answer 62

Solution: IOQM 2020, Q27

Key idea

A point lies on some admissible path exactly when the detour through it is short enough, that is when d(A,P)+d(P,B)≤14d(A,P) + d(P,B) \leq 14. That condition separates into a statement about xx and a statement about yy.

the 87 reachable lattice points
the 8787 reachable lattice points

The bug moves only horizontally and vertically, so the length of a path is measured by the taxicab distance, and the shortest route from A=(−3,2)A = (-3,2) to B=(3,−2)B = (3,-2) has length 6+4=106 + 4 = 10. A lattice point PP lies on some path from AA to BB of length at most 1414 precisely when going via PP costs at most 1414, that is when d(A,P)+d(P,B)≤14,d(A,P) + d(P,B) \leq 14, and any such detour can always be realised as an actual staircase path. The parity looks after itself, since d(A,P)+d(P,B)d(A,P) + d(P,B) always has the same parity as 1010.

Now write out that condition for P=(x,y)P = (x,y): ∣x+3∣+∣x−3∣+∣y−2∣+∣y+2∣≤14.|x+3| + |x-3| + |y-2| + |y+2| \leq 14. The two halves separate, and each is a familiar shape. The sum ∣x+3∣+∣x−3∣|x+3| + |x-3| equals 66 whenever xx lies between −3-3 and 33, and equals 2∣x∣2|x| outside that range, so it is g(x)=max⁡(6,2∣x∣)g(x) = \max(6, 2|x|). Likewise ∣y−2∣+∣y+2∣|y-2|+|y+2| is h(y)=max⁡(4,2∣y∣)h(y) = \max(4, 2|y|). The condition is g(x)+h(y)≤14g(x) + h(y) \leq 14, and since gg is at least 66 and hh at least 44 there is not much room.

Work through the possible values of gg. When g=6g = 6, which happens for the seven values x=−3,…,3x = -3, \ldots, 3, we need h(y)≤8h(y) \leq 8, and that allows ∣y∣≤4|y| \leq 4, giving nine values of yy and so 6363 points. When g=8g = 8, at x=±4x = \pm 4, we need h(y)≤6h(y) \leq 6, allowing ∣y∣≤3|y| \leq 3, which is seven values and 1414 points. When g=10g = 10, at x=±5x = \pm 5, we need h(y)≤4h(y) \leq 4, allowing only ∣y∣≤2|y| \leq 2, which is five values and 1010 points. When g≥12g \geq 12 we would need h(y)≤2h(y) \leq 2, which is impossible since hh is never less than 44.

The total is 63+14+10=8763 + 14 + 10 = 87.

Answer 87

Solution: IOQM 2023, Q18

Key idea

Removing one diagonal from each crossing pair leaves a non-crossing family, so ∣F∣≤47+c|\mathcal F| \le 47 + c where cc is the number of crossing pairs; and the crossing pairs nest inside one another in a way that forces c≤24c \le 24.

image

Throughout, n=50n = 50. The one fact we need first is that a set of pairwise non-crossing diagonals of a convex nn-gon has at most n−3=47n - 3 = 47 members.

Why a non-crossing family has at most n−3n-3 members

Keep adding non-crossing diagonals until no more can be added. Every region is then a triangle, since a region with four or more vertices admits another diagonal. Say the final set has DD diagonals and cuts the polygon into TT triangles. Each diagonal, when it was drawn, split one region into two, so the number of regions rose by one each time and T=D+1.T = D + 1. Now count the sides of the triangles. Each of the nn edges of the polygon lies on exactly one triangle, and each diagonal lies on exactly two, so 3T=n+2D.3T = n + 2D. Substituting T=D+1T = D+1 gives 3D+3=n+2D3D + 3 = n + 2D, that is D=n−3D = n - 3. The original set was part of this one, so it had at most n−3n-3 diagonals.

The upper bound

Let F\mathcal F be minimally friendly and let cc be the number of crossing pairs inside it. Since each diagonal meets at most one other, these pairs are disjoint: they form a matching. Delete one diagonal from each pair. What is left is pairwise non-crossing, so ∣F∣−c≤47,that is∣F∣≤47+c.|\mathcal F| - c \le 47, \qquad \text{that is} \qquad |\mathcal F| \le 47 + c.

Every further crossing pair stays in one region; boundary endpoints belong to two regions.
Every further crossing pair stays in one region; boundary endpoints belong to two regions.

It remains to bound cc, and this is where the structure appears. Take one crossing pair, with diagonals PRPR and QSQS meeting inside, where P,Q,R,SP, Q, R, S occur in this cyclic order. These two diagonals cut the polygon into four regions, one containing each of the four arcs PQPQ, QRQR, RSRS, SPSP. Now take any other crossing pair. Neither of its diagonals may cross PRPR or QSQS, so each lies inside one of the four regions; and since the two of them cross each other, they lie in the same region. So every other crossing pair sits inside one of the four regions.

Let g(m)g(m) be the largest possible number of crossing pairs when the available vertices number mm, and let us show g(m)≤⌊m−22⌋(m≥2),g(m) \le \left\lfloor \frac{m-2}{2} \right\rfloor \qquad (m \ge 2), We use induction on mm. The claim holds for m≤3m\le3 because then g(m)=0g(m)=0. For larger mm, if there is no crossing pair the bound is already true. Otherwise pick one crossing pair as above. Each of its four regions excludes two of the four selected endpoints, so it has at most m−2m-2 original vertices. The induction hypothesis therefore applies inside every region. If the four regions have m1,m2,m3,m4m_1, m_2, m_3, m_4 available vertices, then m1+m2+m3+m4=m+4m_1 + m_2 + m_3 + m_4 = m + 4, because each of P,Q,R,SP, Q, R, S is available to two of the regions. Hence, dropping the floors on the right, g(m)≤1+∑i=14g(mi)≤1+∑i=14mi−22=1+m+4−82=m−22.g(m) \le 1 + \sum_{i=1}^{4} g(m_i) \le 1 + \sum_{i=1}^{4} \frac{m_i-2}{2} = 1 + \frac{m+4-8}{2} = \frac{m-2}{2}. The left side is a whole number, so it is at most ⌊(m−2)/2⌋\lfloor (m-2)/2 \rfloor, as claimed. With m=50m = 50 this gives c≤⌊48/2⌋=24c \le \lfloor 48/2 \rfloor = 24, and therefore ∣F∣≤47+24=71.|\mathcal F| \le 47 + 24 = 71.

The construction

Triangulate the 5050-gon in a zigzag, drawing the diagonals A2A50, A2A49, A3A49, A3A48, A4A48, …A_2A_{50},\ A_2A_{49},\ A_3A_{49},\ A_3A_{48},\ A_4A_{48},\ \ldots so that the 4848 triangles form a chain, each sharing an edge with the next. That is 4747 diagonals, pairwise non-crossing.

Now pair the triangles along the chain: the first with the second, the third with the fourth, and so on, giving 2424 pairs. Each pair forms a convex quadrilateral whose two triangles share a diagonal of the triangulation. Add the other diagonal of that quadrilateral. It is a genuine diagonal of the 5050-gon, since a quadrilateral inscribed in the polygon has two vertices strictly between the endpoints of each of its diagonals. It stays inside its own quadrilateral, so it meets no added diagonal from another pair and no triangulation diagonal other than the original shared diagonal of that quadrilateral.

The result has 47+24=7147 + 24 = 71 diagonals, each meeting at most one other, so the largest possible size is exactly ∣F∣=71.|\mathcal F| = 71.

Answer 71

Solution: IOQM 2025 Part SEP, Q7

Key idea

Pairing kk with 2n+1−k2n+1-k makes the product of the pair-sums equal to (2n+1)n(2n+1)^n, a square when nn is even. For odd nn, deal with 11 through 66 separately and pair the rest in the same way.

Only n=1n = 1 fails, and it fails immediately: the single pair is {1,2}\{1,2\} and the product is 33, not a square.

For even nn, pair each kk with 2n+1−k2n+1-k. Every pair sums to 2n+12n+1, so the product of the sums is (2n+1)n(2n+1)^n, which is a perfect square because nn is even.

For odd n≥3n \ge 3, handle the first six numbers by hand. The pairing {1,5},{2,4},{3,6}\{1,5\},\quad \{2,4\},\quad \{3,6\} gives sums 6,6,96, 6, 9 and product 324=182324 = 18^2. The remaining numbers are 7,8,…,2n7, 8, \ldots, 2n, an even block, and pairing kk with 2n+7−k2n+7-k makes every one of those n−3n-3 sums equal to 2n+72n+7. As nn is odd, n−3n - 3 is even, so that part of the product is (2n+7)n−3(2n+7)^{n-3}, a perfect square. The whole product is a square times a square.

So every nn from 22 to 3737 works and only n=1n = 1 does not, giving 37−1=3637 - 1 = 36 values.

Answer 36

Report an error on this page

Reports are stored by Netlify. See the privacy note.