In this entry, I shall generalize a very interesting math trick.

#### Background

A fun and intriguing math performing trick is the “find the missing digit” trick. The mathemagician asks you to think of a number N preferably long, 5 or 6 digits. He will not know this number. He asks you to subtract from it, the sum of the digits of N. He then asks you to call out ALL EXCEPT ONE of the digits of the answer that you got in the previous step and IN ANY ORDER. He will tell you the digit that you didn’t call out.

**Example**

Lets say audience chooses N= 264983. They subtract 2+6+4+9+8+3 = 32 from 264983. So they will end up with 264983- 32 = 264951. They call out… 2..9..4..6..5 and leave out 1. The mathemagician will have 2+9+4+6+5 = 26 in his hand and the next multiple of 9 is 27. So he will know that the audience left out 1.

*The logic behind this trick is that subtracting the sum of digits from a number leaves the number as a multiple of 9.*

Why we try to make this a multiple of 9 is because *the sum of digits of a multiple of 9 is also a multiple of 9. *Which means that if the mathemagician has 5 of the 6 digits, he can simply check which digit would make the sum of the digits a multiple of 9.

#### Generalization

The problem with the above method is that you need the number to be a multiple of 9 which makes this trick very specialized and the problem with most magic tricks is that once you’ve seen them enough times, they lose their charm. By attempting to generalize this particular trick, one can open the doors to whole new set of tricks. My goal is to find the missing digit when it is a multiple of not just 9, but any number like 4 or 7 or 3. For this we need to know the basics of number theory.

Let us take a start with a digit number that needs to be divisible by a number . I shall define a set of base values S = {} where

The following table shows the base numbers for 4 digit numbers for various

p | Base Numbers |
---|---|

7 | 6,2,3,1 |

17 | -3,-2,10,1 |

31 | 8,7,10,1 |

The principle will remain the same as before. In order to find the missing digit, the number of the audience should be a multiple of of our choosing. We shall use the base numbers corresponding to .

Once we have and , we’re almost good to go. Here is the caveat*. You cannot allow the audience to scramble the digits and they have to tell you which position’s digit they omit.*

Perform the following algorithm:

Step 1: Multiply the digits of the number with its corresponding base numbers. For instance, multiply the first digit by , the second digit by .. and the digit by

Step 2: Add them all up. The sum will be a multiple of .

Step 3: We check which is the nearest **next **or **previous** multiple of and figure out the missing digit either by quick observation or by using the euclidean algorithm

**Much Needed Example:**

Number: 6258 (multiple of 7). This you would make the audience end up with using some simple ‘mathemagic’ manipulations.

So you ask them to omit the 3rd digit from the right and say the rest. So they will say 6..5..8.

Step 1: Look up the table. The base digits for p=7 are 6, 2, 3 and 1. You will do inside your head, where is the missing digit.

Step 2: This equals

Step 3: we know that is a multiple of 7. What is the **next** (since we’re adding to 59)nearest multiple of 7? 63! so and that gives us the missing number 2 !

**Another Example!**

Number: 1632 (multiple of 17).

So you ask them to omit the 3rd digit from the right and say the rest. So they will say 1..3..2

Step 1: Look up the table. The base digits for p=7 are -3, -2, 10 and 1. You will do inside your head.

Step 2: This equals

Step 3: we know that is a multiple of 7. What is the **previous **(since we’re subtracting from 29) nearest multiple of 7? 17! so and that gives us the missing number 6

You will notice that the answers are pretty obvious here. That is because the base number of the corresponding missing digit is 2 which is a low number and is easy to calculate in your head. In cases where the base number of the missing digit is a large number, then the Euclidean algorithm would need to be used which I shall cover in another post.