Can you help this captain make their cargo shipshape?

8 Aug 2016

Being the captain of a container ship has a lot of stresses attached to it, not least having to make sure that all the containers are placed correctly and safely. For this, maths comes into play.

Captain Halpin of the SS Fatima is preparing for the container ship’s next cruise. Shortly before the Fatima ships out of Dublin harbour, nine more containers arrive. As a matter of urgency, these containers need to be carried and space must be found.

Perhaps unsurprising for the captain of a container ship – on which precise weight and placement of containers is important – Captain Halpin’s mathematics skills are impressive. But this challenge could be the captain’s undoing.

Future Human

The containers weigh 1, 2, 3, …, 9 tonnes, and no two containers weigh the same.

As the ship’s departure was imminent, the hold was almost full. Luckily, nine spots remained on the ship.

This space consists of an aisle that can accommodate five containers, with four spots adjacent to the aisle forming two wings, as seen in this diagram.

Maths: layout of containers

To ensure that the containers are placed correctly, and don’t interfere with the ship’s passage, the weight of the five containers along the aisle must be equal to the total weight of the three containers that make up each of the two wings.

Is this possible, or will Captain Halpin’s maths skills be defeated at the crunch?

Scroll down for the solution to this week’s puzzle.

This week’s maths puzzle comes courtesy of Dr Bernd Kreussler, lecturer in mathematics at Mary Immaculate College in Limerick, who is actively involved in mathematics enrichment classes at the University of Limerick and the Irish Mathematical Olympiad.

Maths puzzle solution


Yes, it’s possible.

First, the captain starts by naming the nine locations for the containers as shown in this diagram.

Maths solution image A

At this point, Captain Halpin is thinking of each letter as the weight of the container at this position. To find a solution, the captain will have to replace each of these letters with one of the numbers 1, 2, 3, …, 9, so that each number is used only once.

In order to make sure that the containers are placed correctly, the captain carries out calculations using the following equations, where S stands for the weight of the five containers along the aisle.

A + B+ C+ D + E = S

F + B + H = S

G + D + I = S

Adding together these three equations gets Captain Halpin:

A + B + C + D + E + F + G + H + I + (B + D) = 3S

As the captain knows, A + B + … + I is equal to (in some order) 1 + 2 + … + 9, which is equal to 45. Therefore, the above equation can be rewritten as:

45 + (B + D) = 3S


B + D = 3(S – 15)

From this equation, the captain sees that B + D must be divisible by 3, as all weights are whole number values so no remainders are possible.

B + D can be, at most, 17 (8 + 9 = 17). However, as it must be divisible by 3, B + D cannot exceed 15.

Furthermore, B + D is at least 3 (1 + 2 = 3).

Hence, the possible range for S – 15 = (B + D)/3 is 1, 2, 3, 4, 5.

Therefore, the possible values for S are 16, 17, 18, 19 and 20.

By systematically considering all possibilities for B and D that sum to 9 (for S = 18) or 15 (for S = 20), Captain Halpin is able to figure out that there is no solution in which S can be 18 or 20.

For the remaining three values of S, there exist solutions (as follows) for Halpin to choose from.

Maths solution image B

Kirsty Tobin was careers editor at Silicon Republic