Copyright © University of Cambridge. All rights reserved.

'Your Number Was...' printed from https://nrich.maths.org/

Show menu


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:

  1. Think of a number: $x$   $\lt\lt\lt$ [Input] number
  2. Add $3$: $x+3$     
  3. Double it: $2x+6$    $\lt\lt\lt$ Begin to balance out dividable equation
  4. Add $4$: $2x+10$    $\lt\lt\lt$ Equation can now be easily divided
  5. Divide by $2$: $x+5$    $\lt\lt\lt$ Simplify equation
  6. Subtract [original] number from [current] number: $x+5\hspace{2mm}-x$  $\lt\lt\lt$ Balace equation [balancing $x$ with $-x$]
  7. $x=$ always $5$     $\lt\lt\lt x$ is always fixed at $5$