IB Math Revision Start free
Extension & competition maths

Senior logic problems (ages 16 to 18)

18 original competition-style problems: truth-tellers, calendars, games and reasoning puzzles. 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.

12 free with full solutions. Problems marked ‘With a plan’ show the question to everyone; their hints, answer checking and full solutions are included with every A Level, IB, IGCSE and CBSE plan. See plans.

Filter by strategy

Answer a problem to track what you have solved.

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.

Your worksheet basket is empty.Open worksheet builderSet as homework

Problem S35

LogicMultiple choice

Six people A–F are each a truth-teller or a liar. A: “B and E are different types.” B: “Exactly three of us six are liars.” C: “A and B are different types.” D: “A and F are different types.” E: “At most one of us is a truth-teller.” F: “B and C are different types.” Who are the truth-tellers?

Hint

Start with E. Could E be telling the truth?

Second hint

If E told the truth, check the consequence for B and A. Pin down E first, then the ‘same / different type’ links follow.

Full worked solution

Answer: A, A, B, F

  1. Suppose E is a truth-teller. Then at most one person is truthful, so E is the only one, and A lies. A’s false claim means B and E are the same type, so B is truthful — two truth-tellers. Contradiction: E is a liar.
  2. E lies, so at least two people tell the truth.
  3. A says B ≠ E. Since E is a liar, this says ‘B is truthful’, so A and B are the same type.
  4. C says A ≠ B, which is false: C is a liar.
  5. F says B ≠ C, i.e. ‘B is truthful’ (C lies), so F is the same type as B. D says A ≠ F, which is false (A = B = F): D is a liar.
  6. If A, B, F also lied, nobody would be truthful, contradicting E’s lie. So A, B, F tell the truth, and B’s ‘exactly three liars’ (C, D, E) checks out.
  7. The truth-tellers are A, B and F (A).

Why this works: Once one liar is fixed, statements like ‘X and Y are different’ become ‘X is truthful’ or ‘X lies’, and the types propagate. Count-type claims then decide the last case.

Where it leads: Statements of the form ‘X and Y are different types’ are XOR equations; systems of them are solved by linear algebra mod 2.

Strategy: Organised cases, Proof techniques

Problem S36

LogicShort answer

What is the smallest number of different whole numbers you must choose from 1 to 30 to be certain that two of your chosen numbers add up to 31?

Hint

Group 1 to 30 into pairs that add to 31.

Second hint

The pairs {1, 30}, {2, 29}, …, {15, 16} are the pigeonholes.

Full worked solution

Answer: 16

  1. Pair up 1 to 30 into the 15 pairs that add to 31: {1, 30}, {2, 29}, …, {15, 16}.
  2. Choosing one number from each pair, e.g. 1 to 15, gives 15 numbers with no two adding to 31 (the largest sum is 29). So 15 is not enough.
  3. With 16 numbers and only 15 pairs, two chosen numbers lie in the same pair (pigeonhole principle), and those two add to 31.
  4. So 16 always works and 15 does not.
  5. Answer: 16.

Why this works: The pigeonhole principle needs well-chosen ‘holes’: here the 15 pairs. An example with one fewer shows the bound is exactly right.

Where it leads: 15 numbers (one from each pair, e.g. 1 to 15) are not enough, so 16 is the minimum: bound plus example.

Strategy: Pigeonhole principle

Problem S37

LogicShort answer

Two players take turns removing 1, 2 or 4 counters from a pile. The player who takes the last counter wins. For how many starting pile sizes from 1 to 50 does the second player have a winning strategy?

Hint

Work out the winning and losing positions for small piles and look for a pattern.

Second hint

Losing positions for the player to move: 0, 3, 6, 9, … Check that removing 1, 2 or 4 from a multiple of 3 never gives a multiple of 3.

Full worked solution

Answer: 16

  1. Call a pile size losing if the player about to move loses with best play. 0 is losing (no counter to take: the previous player took the last).
  2. Moves remove 1, 2 or 4, which leave remainders 1, 2 or 1 on dividing by 3, never 0. So from a multiple of 3 every move leads to a non-multiple of 3.
  3. From a non-multiple of 3, removing 1 or 2 always reaches a multiple of 3.
  4. So by induction the losing positions are exactly the multiples of 3, and from any other pile the first player wins by moving to one.
  5. The second player wins for 3, 6, …, 48: 16 starting sizes.

Why this works: Classify positions as winning or losing from the end backwards; a pattern (here, multiples of 3, because 1, 2, 4 leave remainders 1, 2, 1) usually appears quickly and can then be proved.

Where it leads: 4 ≡ 1 (mod 3), so the move 4 acts like the move 1 modulo 3, and the game behaves like ‘remove 1 or 2’.

Strategy: Working backwards, Spot the pattern and generalise

Problem S38

LogicMultiple choice

Five boxes, numbered 1 to 5, carry labels. Box 1: “The prize is in an even-numbered box.” Box 2: “The prize is not in box 1.” Box 3: “The prize is in box 2 or box 5.” Box 4: “The label on box 3 is false.” Box 5: “The prize is in box 4.” Exactly one label is true. Which box holds the prize?

Hint

Labels 3 and 4 contradict each other, so exactly one of them is true. That uses up the one true label.

Second hint

If label 3 is the true one, the prize is in box 2 or 5; check labels 1, 2 and 5 then. Otherwise label 4 is true.

Full worked solution

Answer: A, Box 1

  1. Label 4 says label 3 is false, so labels 3 and 4 contradict each other: exactly one of them is true.
  2. Only one label is true in total, so labels 1, 2 and 5 are all false.
  3. Label 2 (‘not in box 1’) is false, so the prize is in box 1.
  4. Check the others: label 1 (even box) false ✓; label 5 (box 4) false ✓; label 3 (box 2 or 5) false, so label 4 is true — exactly one true label. ✓
  5. The prize is in box 1 (A).

Why this works: A pair of statements that contradict each other always contains exactly one truth. Using that to fill the ‘one true label’ quota makes all the others false at once.

Where it leads: Puzzles where exactly one statement is true are solved by trying each candidate for the true statement in turn.

Strategy: Organised cases

Problem S39

LogicShort answer

The date 21 February 2012 written as DDMMYYYY is 21022012, which reads the same backwards. How many dates from 1 January 2000 to 31 December 2099 have this property?

Hint

If the year is 20ab, what do the day and the month have to be?

Second hint

For year 20ab, the date must be ba02 reversed: day = ba, month = 02. So the month is always February.

Full worked solution

Answer: 29

  1. The date is DDMMYYYY with the year 20ab, i.e. digits D D M M 2 0 a b.
  2. Reading backwards must give the same string, so the day is ‘ba’ and the month is ‘02’ (February).
  3. So every palindromic date is in February, and its day is the year’s last two digits reversed. Each valid February day gives exactly one year: day ba → year 20ab (e.g. 21 February → 2012).
  4. Days 01 to 28 always exist. Day 29 needs year 2092, which is a leap year, so 29 February 2092 exists.
  5. Days 30 and 31 do not exist in February.
  6. So there are 29 such dates (from 10 February 2001 to 29 February 2092).

Why this works: A palindrome condition fixes half of the string from the other half, so only the free half needs counting, subject to the calendar’s rules.

Where it leads: Palindromic dates are rare and depend on the date format: in MMDDYYYY the count is different.

Strategy: Organised cases

Problem S40

LogicShort answer

N is a whole number from 1 to 100. Of the following five statements, exactly four are true: (1) N is a multiple of 6. (2) N has exactly 6 positive divisors. (3) N > 50. (4) The digits of N add up to 9. (5) N is odd. What is N?

Hint

Statements (1) and (5) cannot both be true. So exactly one of them is false, and (2), (3), (4) are all true.

Second hint

Exactly one of (1), (5) is false. If (5) is false, N is even and a multiple of 6 with 6 divisors, over 50, digit sum 9. If (1) is false, N is odd.

Full worked solution

Answer: 63

  1. Statement (1) says N is a multiple of 6, which is even; statement (5) says N is odd. They cannot both be true.
  2. Exactly four are true, so exactly one is false, and it must be (1) or (5). Hence (2), (3) and (4) are true: N has 6 divisors, N > 50 and its digits add to 9.
  3. If (1) is true, N is a multiple of 6 above 50 with digit sum 9: 54, 72 or 90. Their divisor counts are 8, 12 and 12, not 6. So (1) is false.
  4. So (5) is true: N is odd, above 50, with digit sum 9: 63 or 81.
  5. 63 = 32 × 7 has (2 + 1)(1 + 1) = 6 divisors; 81 = 34 has 5.
  6. N = 63.

Why this works: Find a pair of statements that clash; that tells you where the false one must be, and the rest become hard facts to filter with.

Where it leads: Self-referential statement puzzles reduce to checking which statement is false; contradictions prune the cases quickly.

Strategy: Organised cases

Problem S115

LogicShort answer

Two players take turns removing counters from a pile. On each turn a player must remove a perfect square number of counters (1, 4, 9, …). The player who takes the last counter wins. For how many starting piles from 1 to 20 counters can the second player force a win?

Hint

Label each pile size W (the player to move can win) or L. A pile is L when every move leads to a W pile.

Second hint

0 is L. 1 is W (take 1). 2: the only move leaves 1, which is W, so 2 is L. Continue up to 20.

Full worked solution

Answer: 8

  1. 0 counters: the player to move has lost, so 0 is L. A pile is W if some square move reaches an L pile, otherwise L.
  2. 1 → 0: W. 2 → 1 only: L. 3 → 2: W. 4 → 0: W. 5 → 4 or 1 (both W): L. 6 → 5: W. 7 → 6 or 3: L. 8 → 7: W. 9 → 0: W. 10 → 9, 6, 1: L.
  3. Continuing: 11 W, 12 L, 13 W, 14 W, 15 L, 16 W, 17 L, 18 W, 19 W, 20 L.
  4. L piles (second player wins): 2, 5, 7, 10, 12, 15, 17, 20: 8.

Why this works: Working backwards from the end of the game labels every position; a position is losing exactly when all moves lead to winning positions.

Where it leads: For this ‘subtract a square’ game there is no simple pattern, and it is known that the losing positions have density zero (Sarközy’s theorem in disguise).

Strategy: Working backwards

Problem S116

LogicShort answer

One square is removed from a 7 by 7 board. For how many of the 49 possible choices can the remaining 48 squares be tiled exactly by 1 by 2 dominoes?

Hint

Colour the board like a chessboard with the corners dark. How many dark and light squares are there?

Second hint

25 dark and 24 light. Every domino covers one of each.

Full worked solution

Answer: 25

  1. Chessboard colouring with dark corners: 25 dark squares, 24 light. A domino always covers one dark and one light square.
  2. So the removed square must be dark, otherwise 25 dark and 23 light remain. That rules out the 24 light squares.
  3. Every dark square works: the board minus one dark square can always be tiled (for example, cut the board into a spiral ‘path’ through all 49 squares; removing a dark square splits it into two paths of even length, each tiled by dominoes).
  4. Answer: 25.

Why this works: A colouring invariant rules out half the choices at once; a construction shows the rest all work.

Where it leads: Gomory’s theorem: removing one dark and one light square from an 8 × 8 board always leaves a tileable board, by the same Hamiltonian-cycle argument.

Strategy: Invariants, Parity and remainders

Problem S117

LogicMultiple choice

Each of A, B and C is a knight (always truthful) or a knave (always lies). A says: ‘B is a knave or C is a knight.’ B says: ‘A and C are both knaves.’ C says: ‘Exactly one of A and B is a knight.’ Which of them are knights?

Hint

Suppose B is a knight. What follows?

Second hint

If B were a knight, A and C would be knaves, but then A’s statement (‘B is a knave or C is a knight’) would be false, fine, and C’s would be true: a contradiction for a knave.

Full worked solution

Answer: B, A and C

  1. If B is a knight, A and C are knaves. Then exactly one of A, B (namely B) is a knight, so C’s statement is true: impossible for a knave. So B is a knave.
  2. B is a knave, so ‘B is a knave or …’ is true: A is a knight.
  3. Then exactly one of A, B is a knight, so C’s statement is true and C is a knight. Check B’s statement ‘A and C are knaves’: false, as a knave’s should be. ✓
  4. Knights: A and C (B).

Why this works: Testing the most restrictive statement (B’s ‘and’) first quickly leads to a contradiction, and everything else follows.

Where it leads: An ‘or’ statement is true as soon as one part is; an ‘and’ statement is false as soon as one part is. Exploiting this asymmetry is the key to most knight–knave puzzles.

Strategy: Organised cases, Proof techniques

Problem S118

LogicShort answer

What is the smallest number k such that among any k whole numbers there are always three whose sum is divisible by 3?

Hint

Look at remainders on division by 3. When do three numbers have a sum divisible by 3?

Second hint

Three equal remainders, or three different remainders.

Full worked solution

Answer: 5

  1. Three numbers have a sum divisible by 3 when their remainders are all equal or all different.
  2. k = 4 is not enough: 0, 0, 1, 1 (remainders 0, 0, 1, 1) contain no such triple.
  3. k = 5: if some remainder appears 3 or more times we are done. Otherwise each of the three remainders appears at most twice, and with 5 numbers all three remainders must appear: take one of each.
  4. So k = 5.

Why this works: The pigeonhole principle, with the two ways a triple can work, shows 5 numbers always succeed; an example shows 4 can fail.

Where it leads: Erdős–Ginzburg–Ziv: among any 2n − 1 whole numbers there are n whose sum is divisible by n. Here n = 3 gives 5.

Strategy: Pigeonhole principle, Extremal principle

Problem S119

LogicMultiple choice

Four objects have different, unknown weights. You have a balance that compares two objects at a time. What is the smallest number of comparisons that always suffices to put all four in order of weight?

Hint

How many possible orders are there, and how many outcomes can k comparisons have?

Second hint

24 orders; 4 comparisons have only 24 = 16 outcome patterns.

Full worked solution

Answer: C, 5

  1. There are 4! = 24 possible orders. Each comparison has 2 outcomes, so 4 comparisons can distinguish at most 16 cases: not enough.
  2. 5 comparisons suffice: compare A–B and C–D, then the two winners (now you know the heaviest and a chain of three). Insert the remaining object into the chain of three using 2 comparisons (compare with the middle first).
  3. So the answer is 5 (C).

Why this works: An information-counting lower bound (log2 24 > 4) plus a clever method meeting it settles the minimum.

Where it leads: Sorting n items needs at least log2 n! ≈ n log2 n comparisons; merge sort achieves this order. The exact minimum is known only for small n.

Strategy: Extremal principle, Proof techniques

Problem S120

LogicShort answer

In a group of people, every two are either friends or strangers. What is the smallest size of group that guarantees there are always three people who are all friends with each other or all strangers to each other?

Hint

Pick one person, P. With 5 others, P has at least 3 friends or at least 3 strangers among them.

Second hint

For 5 people, arrange them in a circle: neighbours friends, others strangers.

Full worked solution

Answer: 6

  1. With 6 people, take P. Of the other 5, at least 3 are friends of P or at least 3 are strangers to P (pigeonhole). Say 3 friends.
  2. If any two of those 3 are friends, they and P form three mutual friends. If not, the 3 are mutual strangers. Either way we are done (the strangers case is the same with roles swapped).
  3. With 5 people it can fail: sit them in a circle, neighbours friends, non-neighbours strangers. No three are mutual friends (no triangle of neighbours) and none are mutual strangers.
  4. The smallest size is 6.

Why this works: Pigeonhole on one person’s relationships forces a structure; a symmetric pentagon shows 5 is too few.

Where it leads: This is the Ramsey number R(3, 3) = 6. R(4, 4) = 18, but R(5, 5) is still unknown (between 43 and 46).

Strategy: Pigeonhole principle, Extremal principle

Problem S121

LogicShort answerWith a plan

The numbers 1, 2, 3, 4, 5, 6 are written on a board. A move is to rub out two numbers a and b and write ab/(a + b) instead. After five moves one number is left. What is it?

Hints, answer check and full worked solution. Included with every A Level, IB, IGCSE and CBSE plan.

See plansSign in

Strategy: Invariants

Problem S122

LogicMultiple choiceWith a plan

A pile has 2026 counters. Two players take turns to remove 1, 3 or 4 counters. The player who takes the last counter wins. With perfect play, who wins?

Hints, answer check and full worked solution. Included with every A Level, IB, IGCSE and CBSE plan.

See plansSign in

Strategy: Working backwards, Spot the pattern and generalise

Problem S123

LogicShort answerWith a plan

Ten people sit around a round table. Each is a truth-teller or a liar, and each says: ‘Both of my neighbours are liars.’ What is the smallest possible number of truth-tellers?

Hints, answer check and full worked solution. Included with every A Level, IB, IGCSE and CBSE plan.

See plansSign in

Strategy: Extremal principle, Pigeonhole principle

Problem S124

LogicShort answerWith a plan

Start with the pair (1, 1). A move replaces (a, b) by either (a + b, b) or (a, a + b). What is the smallest number of moves needed to reach (12, 7)?

Hints, answer check and full worked solution. Included with every A Level, IB, IGCSE and CBSE plan.

See plansSign in

Strategy: Working backwards, Invariants

Problem S125

LogicShort answerWith a plan

What is the smallest number of different whole numbers you must choose from 1 to 100 to be certain that one of the chosen numbers divides another?

Hints, answer check and full worked solution. Included with every A Level, IB, IGCSE and CBSE plan.

See plansSign in

Strategy: Pigeonhole principle, Extremal principle

Problem S126

LogicShort answerWith a plan

An island has 2026 inhabitants, each a knight (always truthful) or a knave (always lies). Every inhabitant says: ‘At least half of the other inhabitants are knaves.’ How many knights are there?

Hints, answer check and full worked solution. Included with every A Level, IB, IGCSE and CBSE plan.

See plansSign in

Strategy: Organised cases, Extremal principle

Keep going

More Senior problems: Number theory · Combinatorics · Geometry · Algebra · Probability · Calculus and functions

Logic at other levels: Junior (ages 11 to 13) · Intermediate (ages 13 to 16) · Olympiad-style (ages 15 to 18)

Problem-solving strategies · Where next · Extension & competition maths