Copyright © University of Cambridge. All rights reserved.

'Your Number Was...' printed from

Show menu

We received many correct solutions to this problem.

Tim from Wilson's School noticed that: 
To work out the number you started with, all you have to do is reverse the instructions that it gives you. 

Jack, also from Wilson's School, explained further...

there is a simple calculation that is done when you enter in your result.
The machine reverses the order in which things are done.

You add 4,
then you double the result,
then you subtract 7

and you get the answer.

When you type that in and it says that it is "processing data" what it is actually doing is the calculation
Add 7
then divide by 2
then subtract 4
Andreas, also from Wilson's, worked through an example:

If the last number was 39, what you would do is:
39 + 7 which equals 46.
Then you divide by two, giving 23.
Finally you subtract 4 and get 19.

So 19 was the starting number.

What you are doing is reversing the operations done, to get the original number.
An equation would be: A= ([y+7] ÷2) -4
David from Comberton Village College noticed that there is a quicker alternative:
Imagine your number was x.
So when you think of a number, you effectively think:
Next you add 4: x+4
Then you double it: 2(x+4) = 2x+8
Then you subtract 7: 2x+1

All the machine has to do now is
Subtract 1: 2x
And then halve the result: x

This gives you the starting number.  
Charlotte & Thom from Twyford C of E High School described both methods:
The machine can work out the number someone started with, in a few different ways.
Firstly the machine can do the inverse operation:

If you end up with the answer 13 you can work out the starting number like so:
13 + 7 = 20
20 ÷ 2 = 10
10 - 4 = 6
So that means the number you started with must have been 6.

We can check this by following the original set of instructions and using the number 6 for the calculations like so:
6 + 4 = 10
10 x 2 = 20
20 - 7 = 13
We now know that this theory is correct.

However the machine could use a different way.
When you test out different numbers you start to see a pattern emerging:

If you start with the number 6 you get the answer 13
If you start with the number -2.5 you get then answer -4
If you start with the number 71 you will get the answer 143
If you start with the number 0.12 you will get the answer 1.24

When you start to look at the relationships between the first number and the answer, you can make an equation:
if the first number you think of is n,
and the answer is y,
the equation to work out the answer would be: y = 2n + 1

This means that the answer you get is two times the number you started with, plus 1.
Therefore the machine can work out your staring number once again by doing the inverse operations in reverse order, so it subtracts 1 from the number you got and then divides it by 2.

Megan, also from Twyford C of E High School, reached the solution by working algebraically:
x = the number you thought of
x + 4
2 (x + 4)
2 (x + 4) -7 
equals the number you finished with, which we are going to call y

2 (x + 4) - 7 = y
2x + 8 - 7 = y
2x + 1 = y
2x = y - 1
x = $\frac{y - 1}{2}$

To find the number you thought of, you take away 1 from the number you finished with and then divide by 2.

Niteesh from Vidya Shilp Academy in Bangalore created a similar puzzle:

All the machine needs to do to get the original number is undo the procedure.
The machine first adds 7, then halves the answer and then subtracts 4 to get the original number.

If I were to make a similar machine the rules would be:
Think of a number
Double it
Add 2
Halve the answer
Enter the result

So the machine would have to take the result and
Double it
Subtract 2
Halve the answer.
And the result would be the user's original number.
Well done to you all.