Your number was...
Problem
This problem follows on from Your Number Is...
Press the button in the interactivity below to investigate what this machine does:
Try starting with other numbers - maybe decimals or negative numbers.
How is the machine working out your starting numbers?
Can you devise your own set of instructions so you can work out someone else's starting numbers in the same way?Getting Started
One way to begin thinking about this is to collect together some outputs and their corresponding inputs:
Finishing Number | Starting Number |
Can you write each step of the machine's instructions as a function machine?
What happens if you work backwards?
Student Solutions
Students from Westridge School for Girls in the USA, Cedric from Australian International School Malaysia, Poppy and Gracie from Walton High School in England, students from Humanitree in Mexico, Florence from Walthamstow Hall Junior School in the UK, Eric and Lucia from Willowbank School in New Zealand, Abdullah from Poland, students from Frederick Irwin Anglican School
in Australia, John from Poolesville ES in the USA, Bracha and Antoine from St Philip's CofE Primary School Cambridge in the UK, Park from Renaissance International School Sigon in Korea, Diya from the UK, Deniz from North Leamington School in the UK, Ira from Coldspring3 and Adi from the New Beacon in the UK all described how the computer works out your starting number.
Kristin from Westridge School for Girls sent this explanation:
All you have to do is do the problem backwards.
For example, if your number is 1 then you add 4, double that, subtract 7, and you will get 3.
All the computer has to do is do the problem backwards.
3$+$7 (opposite of $-$7) is 10.
10$\div$2 (opposite of $\times$2) is 5.
$-$4 (opposite of $+$4) is 1, which was my original number.
Luigi from Humanitree and Karrthic from Australian International School Malaysia found an algebraic expression for the final number. This is Karrthic's work:
The operation is
$(x +4) \times 2 -7= y$
For example
$(5 + 4) = 9\\
9 \times2 = 18\\
18-7=11$
When you reverse the operation, you find $x$
Furkan from TED Ankara Koleji in Turkey, Bernd and Qianwei from Humanitree and Shriya from International School Frankfurt in Germany showed what the computer does algebraically. This is Qianwei's work:
$(x+4) \times 2 - 7=y$
If we want to get $x$, we need to do the opposite of this equation.
Start with $y.$ In the equation $7$ [was subtracted], so we need to add $7$ to $y$
$(7+y)$
In the equation, $(x+4)$ was doubled, we need to divide it by two to get the opposite.
$(7+y)\div2$
In the equation, $x$ was added [to] $4$, to get the opposite, we need to take away $4$ from $x.$
$(y+7)\div2-4$
Finally the equation we used to find $x$ will be:
$(y+7)\div2-4=x$
Furkan and Shriya simplified the equation before 'reversing' it. This is Furkan's work:
$(x+4) \times2 - 7$ is equal to $2x + 1,$ so we subtract $1$ from the result and divide by $2$ to get the starting number.
Alex from Humanitree and Fernando from Academia Britanica Cuscatleca in El Salvador noticed a different pattern in the numbers from the computer. This is Fernando's work:
When following the instructions given in the problem, if [you give the computer random integers as the result of your calculation], you will get random numbers.
However, when we start with 1 and try until five, you will notice the sequence:
Number you tell the computer was your answer | Number the computer says you started from |
---|---|
1 | 0 |
2 | 0.5 |
3 | 1 |
4 | 1.5 |
5 | 2 |
As you can see, the sequence is progressing by 0.5, thus is linear. It is adding 0.5 so, and we can see that when 0.5$\times n$ is done, you the sequence now looks like this:
Number you tell the computer was your answer ($n$) | Number the computer says you started from | 0.5$\times n$ |
---|---|---|
1 | 0 | 0.5 |
2 | 0.5 | 1 |
3 | 1 | 1.5 |
4 | 1.5 | 2 |
5 | 2 | 2.5 |
The answer to the subsitution is always 0.5 greater than the actual answer,
therefore, we need to always substract 0.5
Therefore, the instructions are directly 0.5$n-$0.5 !
Can you see how this result is related to Furkan's equation?
We received lots of sets of instructions for similar activities.
These instructions are from Tamara from Humanitree:
.Think of a number
.multiply it by 4
.subtract 2
.add 1
Your number was”¦
So if the final number was 19 first you would need to subtract 1. That would equal to 18. Then you would need to add 2, which would equal to 20. And [finally] you would need to divide it by 4. This equals to 5 so the first number would be 5.
Federico from Humanitree used algebra:
Subtract 10
Divide by 4
Add 5
If the number was $n$
You would do
$(n-5) \times4 +10 = $ end number ($x$)
Then the computer would do this operation to get the original value of $n:$
$(x-10)\div4 +5 =$ starting number
This operation would give you the original results.
Abdullah from Poland wrote a Python program to guess your number:
print("YOUR NUMBER WAS...")
print()
print("Press [ENTER] after you made each move.")
print()
input("Think of a number.")
print()
input("Add 9")
print()
input("Divide it by 4")
print()
input("Subtract 6")
print()
input("Triple it")
print()
input("Subtract 23")
number = float(input("Now, type in number you finished with and then press enter."))
print("Processing...")
answer = (((number + 23) / 3) + 6) * 4 - 9
print("You chose the number %s" % answer)
Leila C and Scarlett K from Westridge School for Girls and KSc from Cheadle Academy sent in interesting sets of instructions which will always give the same result, like in the problem Your Number Is...
If you follow these instructions, will it ever be possible for the computer to work out what number you started from?
These are KSc's instructions:
- Think of a number: $x$ $\lt\lt\lt$ [Input] number
- Add $3$: $x+3$
- Double it: $2x+6$ $\lt\lt\lt$ Begin to balance out dividable equation
- Add $4$: $2x+10$ $\lt\lt\lt$ Equation can now be easily divided
- Divide by $2$: $x+5$ $\lt\lt\lt$ Simplify equation
- Subtract [original] number from [current] number: $x+5\hspace{2mm}-x$ $\lt\lt\lt$ Balace equation [balancing $x$ with $-x$]
- $x=$ always $5$ $\lt\lt\lt x$ is always fixed at $5$
Teachers' Resources
Why do this problem?
This problem provides a great opportunity to introduce the concept of representing operations on unknown numbers algebraically. It leads to work on inverse operations and solving simple linear equations. When first shown the interactivity, students may be amazed and astonished that it can always work out the starting number. The intention is to provoke their curiosity so they become
determined to explain the mystery.
Possible approach
One way to begin thinking about this is to collect together some outputs and their corresponding inputs, for example:
Finishing Number | Starting Number |
11 | 5 |
17 | 8 |
3 | 1 |
23 | 11 |
14 | 6.5 |
- Represent the instructions as a function machine, and explore what happens when the functions are inverted.
- Represent the chosen number as $x$ and write an expression for the final number $y$ in terms of $x$. Then rearrange to get $x$ in terms of $y$.
- Discuss simplification to make the functions easier to invert (so representing it as $y=2x+1$ rather than $y=2(x+4)-7$.
At the end of the lesson, a selection of students can read out their instructions for the class to try, and then work out starting numbers from the final numbers.
In the "Settings" menu for the interactivity, you can edit the functions used by the machine. Click below to learn more.
You can enter your own sequence, separated by hyphens, using the code "a" for add, "s" for subtract, "m" for multiply and "d" for divide. The sequence a4-m2-s7 in the screenshot represents "Add 4, Multiply by 2, Subtract 7".
Once you have entered your chosen sequence, click to load it in the current window or a new resizable window.
Key questions
If you think of a number and add four, what do you need to do to get back to where you started?
If you think of a number, add four, and then double, what do you need to do to get back to where you started?
Is there a way of representing the "Think of a number" trick that helps you to get back to the starting number?
Possible support
In the problem Your Number Is..., students can explore visual and symbolic ways of representing number tricks.Possible extension