Ask The Wizard #89

A friend sent me this, I was wondering if there was a formula as to how this works.


Often these mind reading number puzzles work because an interesting mathematical oddity. If the sum of digits of a number is divisible by 9 then the number it self is divisible by 9. Let’s try it on the phone number of the Las Vegas Tropicana (702-739-2222). The sum of digit is 7+0+2+7+3+9+2+2+2+2 = 36. 36 divides evenly by 9, so 702739222 must also be divisible by 9. Here is a proof of this.

  1. Let n bet any integer. Express n as d0*1 + d1*10 + d2*100+ d3*1000+ ... + dn*10n, where dn is the first digit, dn-1 is the second, and so on.
  2. n = [d0 + d1 + d2 + ... + dn ] + [d1*9 + d2*99+ d3*999+ ...+ dn*999...9 ( a number with n nines)]
  3. n = [d0 + d1 + d2 + ... + dn ] + 9*[d1*1 + d2*11+ d3*111+ ... dn*111...1 (a number with n ones)]
  4. 9*any integer is evenly divisible by 9. So if d0 + d2 + d2 + ... + dn , or the sum of digits, is divisible by 9, then the entire number must be divisible by 9.

Now that we have that proof out of the way we can look at this magic trick. The problem asks you to pick any number. Then rearrange the digits to make a second number. Then subtract the smaller number from the larger number.

The answer is always going to have a sum of digits divisible by 9. Why? For every digit in the original number it appears somewhere else in the other number. Going one set of digits at a time, changing all the other numbers to zero, we could boil down each set as +/- n*[10x - 10y] (where x>=y and n is the digit) = +/-n *10y * (10x-y - 1) = 10y * (a number composed of only nines) = a number divisible by 9.

Let’s look at an example. Let the original number be 1965. Scramble it up to get 6951. 6951 - 1965 = 6*(1000-10) + 9*(100-100) + 5*(10-1) + 1*(1-1000) = 6*990 + 9*0 + 5*9 + 6*-999. Note that each part is divisible by 9, thus the number you get after subtracting must also be divisible by 9, and finally the sum of digits is also divisible by 9.

The trick then asks you to circle a number except 0 and enter the sum of all the other digits. The program then only needs to add a number to the number you entered so that the sum is divisible by 9. For example if you said the sum of your digits was 13 then you must have circled a 5, because 13+5 = a number divisible by 9.

The reason you can’t circle a zero is because if you did and then entered a number already divisible by 9 then the program wouldn’t know whether you circled a 0 or a 9.

Your Money Management page says:

"For those who sometimes lose too much and later regret their actions some self-constraints may be in order. I would suggest setting a specific loss point in these cases, for example $200. Personally I don’t set such limits on myself. If I’ve lost too much it won’t be fun any more and I’ll step away for that reason."

But for you, what does "too much" mean? On every other web page of your wonderful site, you warn against using gut feelings. But when it comes to losing, you say you stop when it doesn’t feel good. Especially with video poker, I set a bankroll size, and I stop when I lose that. Losing always sucks, whether it’s 1 credit or 300 credits.


You are right that I am not specific about money management. Unlike other gambling writers I do not put a lot of emphasis on how much to bet or when to walk away. For the recreational gambler there is no method of money management that can either add to or take from the house edge over the long run, so why dwell on it? So while I’m very specific on how to play your cards how much to bet is up to you. There should be some room for free will in gambling anyway. However I do say that if you’ve lost so much that gambling isn’t for fun any more then it is time to walk away.

A fair sided die is rolled 30 times. What is the expected number of times that number 1 will come up? What is the probability that number 1 will come up it’s expected number of times?


The expected number of ones is 30*(1/6) = 5. The probability of exactly 5 ones is combin(30,5)*(1/6)5*(5/6)25 = 19.21%.

If the house edge in a shoe game of blackjack is "x" percent for the first hand after a shuffle, does the house edge also work out to be exactly "x" percent on average if you play through the entire shoe (assuming flat betting and basic strategy)?


In a cut card game the answer is no. However in a game where the dealer dealt exactly x hands every shoe the answer would be yes. The reason is hard to explain. For more information please see my blackjack appendix 10.

Can you recommend a free baccarat game for the Mac?


My webmaster Michael Bluejay is a loyal Mac user and has a helpful page about Macintosh casino games.