# Non-trivial "I know what number you're thinking of"

Consider the following 'trick' (WARNING: very lame)

Think of a number. Multiply this number by two. Add four. Divide the number by two. Subtract the number you were originally thinking of. I guess that the number now in your head is two.

This trick might stump non-mathematicians for a few minutes, but most people will eventually figure it out. The trick relies on the distributive law of numbers, which is not entirely trivial, but most people will find the trick rather lame once they figure it out.

I was wondering if it is possible to do a "I know what number you're thinking of" that relies on less trivial results, from number theory for example, tricks that require some heavier results to explain and are thus more 'magical'. Too avoid being flagged as too subjective or vague, I will try to specify this.

Consider two people, the mathematician $M$ and the non-mathematician $N$. $M$ asks $N$ to think of a number ($M$ may restrict the numbers from which to choose to a sufficiently large set, like the numbers between 1 and 1000 or the prime numbers) and then lets $N$ apply a finite sequence of functions to this number. These functions should preferably be easy and well-known, i.e. basic arithmetic operations, division with residue, decimal representation of a number (e.g. "take the fifth digit"), à la limite prime factorisation, but no functions which require a calculator like trigonometric functions. The following two conditions are imposed:

1. The function must have a finite image, i.e., $M$ should be able to give a finite, preferably small, set in which the image of the function always lies. For example "Either you're thinking of 5 or you're thinking of 29" would still impress $N$. On the other hand, the trick bellow relies on some serious number theory, but gives an infinite image, which I think is less impressing to most people.

Think of a natural number which cannot be written as a sum of three squares of natural numbers. If the number you're thinking of is divisible by four, divide it by four. Keep dividing by four untill you can no longer do so in $\mathbb{N}$. Add one to the number you now have. The number you end up with is divisible by eight.

1. The function uses specific properties of the natural numbers or integers, not just algebraic manipulations. This is what I mean by non-trivial. In particular, the same trick should not work in any commutative ring $A$. For example, tricks relying on the fact that $\mathbb{Z}/p\mathbb{Z}$ is a field for any $p$ prime could satisfy this.

I'd be interested in knowing what's possible here.

• "Think of two non-zero real numbers $a$ and $b$. Now, multiply $b$ by the imaginary unit $i$ and add it to $a$. To this number, add an additional $1/2$. The number you are thinking of is not a root of the Riemann Zeta Function" Commented May 30, 2016 at 21:31
• goniometric functions? I'm a mathematician and have never heard of them. Commented May 31, 2016 at 1:03
• One simple example that may seem magical to a layperson is that you can recover two numbers knowing their sum and product (Hint: from Vieta you then know a quadratic equation having them as roots). Commented May 31, 2016 at 21:12
• @LSpice The correct formula is $\,(s\pm\sqrt{s^2-4p})/2.\,$ Revealing the formula amounts to revealing the trick, which spoils the "magic" (and the hint). Typically one disguises it a bit more by adding some obfuscatory context around the sum $s$ and product $p.\$ Commented Jun 3, 2016 at 18:59
• @LSpice The $\pm$ sign in the quadratic formula has nothing to do with "positivity". Rather, it denotes the roots $\,x = \pm d\,$ of $\, 0 = x^2-d^2 = (x-d)(x+d).\$ Commented Jun 3, 2016 at 19:52

I have a "magic trick" I like to perform for classes on a random day throughout the semester (I cannot take credit for its creation! I do not know the original source...).

"Magic" trick:

1. Pick a four digit number with at least two distinct digits (four is completely arbitrary).

2. Rearrange this number any way you like, swapping at least one pair of digits (it can be any non-identity permutation).

3. Subtract the smaller of these two numbers from the larger, the original and mixed-up. For example, if you pick $3572$ as your number and mix it up to form $7235$, you'll subtract $7325 - 3572 = 3753$. (It actually doesn't need to be $\text{larger} - \text{smaller}$, but negatives confuse the class, even though they don't matter mathematically)

4. Now take the result of the subtraction, and keep one of its nonzero digits a secret. Tell me the other digits in any order you like. (I tell the class that picking $0$ is "too boring!" After reading and seeing how this trick works, think about why I won't let them pick $0$.)

I will know your secret digit by the time you've told me your last digit. How can I possibly do that?

"Magic" Revealed:

Recall that the sum of digits of a number $n$ (the "digital root") is the remainder upon division of $n$ by $9$. But clearly any permutation of the digits doesn't affect this sum, so our original number $n$ and our mixed up number $n'$ have the same digital root, so that $n - n' \equiv 0 \pmod 9$. Thus, having told our participant to keep any nonzero digit to themselves, their secret digit must be whatever it takes to make the sum of digits $0 \bmod 9$. For example, suppose I'm given the digits $3, 3,$ and $7$ (perhaps the participant chose $7325 - 3572$ as their difference). Their sum is $3 + 3 + 7 \equiv 4 \pmod 9$, and they must have been keeping $5$ to themselves, since $4 + 5 \equiv 0 \pmod 9$.

It's certainly not the deepest mathematics involved, but I consider it nontrivial -- and quite fun!

• So they can't pick $0$, but can they pick $9$? Commented May 31, 2016 at 20:22
• Yes, that's exactly right. I believe it's arbitrary which you disallow, $0$ or $9$, as there's no way for the difference to be all $0$'s or all $9$'s (I'm not completely sure about the impossibility of all $9$'s, but I believe it's impossible), given the restrictions. But you must disallow one (to see why, think about the situation in which somebody reads off the three digits $1, 3$, and $5$). Commented May 31, 2016 at 20:43
• Surely subtracting a smaller four-digit number from a larger won't ever yield 9999? Commented May 31, 2016 at 20:55
• By the way, a variant on this is one of Art Benjamin's mathemagics tricks, so you are not alone in considering it fun! Commented Jun 3, 2016 at 19:08
• @LSpice Ah, interesting! I inherited some notes to teach a course for future primary school educators, and this was included in the section on divisibility and divisibility tests. I should ask the creator of the notes for their source of the trick (I'm now wondering if it originated with Art Benjamin; I don't recall hearing of him before). Commented Jun 4, 2016 at 3:01

Kaprekar's constant

Start with any number of up to $4$ digits, with at least two different digits: add leading $0$'s if necessary to make $4$ digits. Write the digits in decreasing order and in increasing order, and subtract the second from the first. Repeat $7$ times. The result will be $6174$.

For example: start with $1234$

$4321 - 1234 = 3087$

$8730 - 0378 = 8352$

$8532 - 2358 = 6174$

$7641 - 1467 = 6174$ (4 times)

EDIT: You might also look at some of the answers to this MathOverflow question.

• This is neat but if I were to ask my mom to perform 7 subtractions in her head with 4 digit numbers I don't think she would find it very fun.
– user223391
Commented May 30, 2016 at 22:03
• Hell, if someone asked ME to perform 7 subtractions in my head with 4 digit numbers I don't think I would
– user223391
Commented May 30, 2016 at 22:05
• So don't do it in your head. It's easy to do with pencil and paper. If you don't like pencil and paper, use a calculator. Yes, I know the OP requested " no functions which require a calculator", but nearly everyone these days has a cell-phone with a calculator app. Commented May 30, 2016 at 22:30
• I'm actually fine with calculators, I just wanted $N$ to have a grip on what's happening, that's why I did not want to use functions beyond their comprehension. Subtraction is okay. :P Commented May 31, 2016 at 14:21

Maybe a little off topic but I got given something similar a few years ago:

1. Pick a number from [1, 10]
2. Multiply the number by 9
3. If the result is 2 digits sum them, otherwise continue with your number
4. Subtract 5
5. Map your answer to a letter of the alphabet (1=A, 2=B etc )
6. Think of a country who's name begins with the letter
7. Take the second letter of the country's name and think of an animal that begins with that letter
8. Think of the colour of that animal

Grey elephants don't live in Denmark!

• Do Jaguars live in Djibouti? Commented May 31, 2016 at 15:45
• Maybe ocelots in Dominica? But the Copenhagen Zoo does have gray elephants. Commented May 31, 2016 at 22:29
• I'm not claiming it's particularly clever. But it will get most people - unfortunately. Commented May 31, 2016 at 22:41
• @DanielFischer No, Jaguars are native to the Americas. But Jacanas do. Commented Jun 1, 2016 at 18:31

Pick any integer number between 100 and 999. Write it again next to the number, and now you have a 6 digits number. Divide it by 7, divide it by 11, divide it by 13. In no step there should be any remainder (you can simulate that you're guessing or thinking very hard about them). The end result is the number chosen initially.

For example for 439:

439439 (write it again, next to the number)

439439 / 7 = 62777

62777 / 11 = 5707

5707 / 13 = 439

Why does this work? Because 7 x 11 x 13 = 1001

• If I were asked to pick a number between 100 and 999, I'd pick $100\pi$. Commented Jun 1, 2016 at 3:00
• Good catch :) Usually you don't need to be that precise when doing magic tricks, but I added a clarification. Commented Jun 1, 2016 at 18:15

Based on the Chinese Remainder Theorem:

Pick an integer $n$ between $0$ and $59$. Let $r_3$, $r_4$, and $r_5$ be the respective remainders upon dividing $n$ by $3$, $4$, and $5$.

You calculate the remainder in dividing $40\cdot r_3+45\cdot r_4 + 36\cdot r_5$ by $60$. This remainder is the original value of $n$.

• I think that $N$ will definitely be upset if asked to deal with "r sub 3, r sub 4, and r sub 5", and so any instructions will have to be on the order of "multiply the remainder upon division by 3 by 40, the remainder upon division by 4 by 45, and the remainder upon division by 5 by 36, and then add all your answers together and divide that by 60"—which basically serves only to remind how nice it is to be able to use variables. Commented Jun 3, 2016 at 19:05
• They can just tell you the remainders. You can do the calculation yourself and magically tell them their number. Commented Jun 4, 2016 at 2:53
• Oh, I hadn't thought of it that way. Good point! Commented Jun 4, 2016 at 3:09
• Nice. I think it would go smoother, though, with "an integer between 1 and 60". Commented Jun 5, 2016 at 20:12

Think of a number 0-9. When you are ready - here is the number:

7

• I got 0-9 = -9. :-) Commented Jun 16, 2016 at 2:04
• hahaha this is good, i believe there is actually some interesting psychological research behind this which backs it up Commented Jul 11, 2016 at 1:54
• @frogeyedpeas, look at this: youtube.com/watch?v=BjueOXCy3OM
– Lehs
Commented Jul 12, 2016 at 17:15