The MI5 task is my favourite of all the Mathematics Apprenticeship tasks. In it, the children have to design two security codes, position laser beams in the Head of Secret Service main office and consider other security features.

I want to focus here on one aspect of the task: writing a 4-digit security code to operate the main door at MI5 HQ. The children are asked to write a formula that each agent can use to work out their personal entry code. The formula must include personal information (so each agent has there own code); it must change with the date; and it must always give a 4-digit product. In the prompt, an example formula is given:

**(L x A x 20) – D**

*L is the number of letters in your first name
A is age
D is day of week (Monday = 1, Sunday = 7)*

Early in the task, I show the children the extent to which this formula works. For example, a 25 year-old called James going to work on Tuesday would calculate his code as follows: (5 x 25 x 20) – 2 = 2498. A 62 year-old called Charlotte going to work on Friday would have the following code: (9 x 62 x 20) – 5 = 11,155. However, this is a 5-digit product. Consequently, this formula is not ideal.

The children will then start to create their own formulas. Which variables should they use? How many variables? And how, exactly, should they use them? I tend to scaffold the maths here more than in any other area of TMA, but always giving the children freedom to explore their own ideas.

Here are some typical points to consider. When choosing your variables, think about the range of possible values. For example, ‘day of month’ (1-31) varies more than ‘number of letters in day of week’ (6-9). Also, note that if you multiply you will normally get a wider range of outcomes than if you add or subtract. Some groups may also realise that an easy way to produce a 4-digit code is to use ‘year’ as a variable, as it is a 4-digit number.

Here are some of the examples from my current class:

*A is age
B is 1 less than your age
C is using Greek alphabet code (below)*

We highlighted the strengths of this code: for example the ingenuity of the use of the Greek alphabet and the use of 3 variables. We then reflected on the fact that A and B are essentially the same variable: that B = A – 1. Also, we drew out the maximum and minimum likely products (based on a minimum age of 21, and a maximum age of 65):

**Maximum code: 4160
Minimum code: 501**

The children were able to figure out that if they added 500 to their code, it would always result in a 4-digit product. This, for me, was a really meaningful learning experience.

My favourite formula was the one below:

This formula always produces a 4-digit product, and notice that the group had worked out the year in which the formula would give an answer that would be a 5-digit product – 2024! They had chosen their variables carefully, and had toyed with their formula until it was perfected. They were acutely aware of the largest and smallest possible products that their formula would give.

The MI5 task provides a really powerful context for learning. When managed well by the teacher, it results in some amazing learning experiences for the children too.