Here’s a conversation that took place between two students.

A: Hey, want to see a magic trick?

B: Sure, how does it go?

A: Think of any number. Any nonnegative integer, I should say.

B: Okay.

A: Multiply it by 3.

B: Okay....

A: Now divide it by 2, and if you get a decimal, then round down. Tell me if you rounded down or not.

B: I did have to round down.

A: Multiply it by 3 then divide it by 2 again. Again, tell me if you rounded down.

B: Okay, hang on... I did not have to round down this time.

A: Great, now just tell me: how many times does 9 go into this last number?

B: You want me to divide by 9?

A: Yes, just the quotient.

B: Um, the quotient is 4.

A: So your original number was 19.

B: That’s right! How did you do that? Let me think....

Can you figure out how it works?

  • 2
    $\begingroup$ According to your example, if B picks 19, B will report 4. If B picks 28, B will also report 4. How is A supposed to tell what B picked if B says 4? $\endgroup$
    – Magma
    Commented Mar 16 at 1:09
  • $\begingroup$ Also, if B picks 0 or 1, the process will never end. Is this intended? $\endgroup$
    – Magma
    Commented Mar 16 at 1:13
  • $\begingroup$ @Magma 0 x 1.5 = 0 and the process stops. But in any case 0 is not a positive integer, so is not a valid starting number. $\endgroup$
    – fljx
    Commented Mar 16 at 1:23
  • $\begingroup$ right, only with 1 the process never ends $\endgroup$
    – Magma
    Commented Mar 16 at 1:27
  • $\begingroup$ i have adjusted the question. $\endgroup$ Commented Mar 16 at 1:28

1 Answer 1


The short version of how/why it works:

You are multiplying by 3 twice and later dividing by 9, so that’s essentially a wash. You are also dividing by 2 twice, so to recreate the original number from the final result, you need to multiply by 4 and then add some value to account for any fractional parts that were rounded away in the intermediate steps.

Whether or not you rounded at each stage tells us what the original number was mod 4 (and therefore how much we have to add back at the end): if you didn’t have to round at all, it was 0 mod 4 (because the original number already contained two factors of 2 to divide by without leaving a fractional part); if you had to round down just the second time then it was 2 mod 4 (i.e. the original number was even but only had a single factor of 2 to divide out); if you had to round just the first time it was 3 mod 4, and if you had to round both times it was 1 mod 4,. So add the appropriate value to recreate the original number.

In the example given, the final result was 4. We multiply this by 4 to get 16. Then, because they rounded down the first time but not the second, we add 3 to get the original number 19.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.