The magician will perform some mathematical magic. He asks his guest to secretly pick any two digit number and then perform a number of operations on it.
- If the number is even, divide by 2, if it is odd subtract 3 and then divide by 2.
- Multiply by 3.
- Add 5.
- If the number has 3 digits, subtract 102.
- Multiply by 6.
- Subtract 21.
- Compute the sum of the digits and continue with this sum. For example if you have 41, continue computing with 5=4+1. *
- If the number has only a single digit, multiply by 2.
- Subtract 5.
At this point, the magician reveals the number the guest arrived at after step 9.
How does this trick work?
Edit: * As noted in the comments, it can happen that you have a negative number at this point. In this case just ignore the minus sign in front. So for example the sum of digits of -16 would be 7.