Fun with numbers
Posted on October 5, 2005
Filed Under LOD |
Give this a whril, Fido Puzzle.
After being amazed by its mind reading powers - try to figure it out and post how it works.
Comments
4 Responses to “Fun with numbers”
Leave a Reply
RSS Feeds
-
Recently Written
-
Categories
-
Archives
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- June 2005
- May 2005
- April 2005
- March 2005
- February 2005
- January 2005
- December 2004
- November 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- May 2004
- April 2004
- March 2004
- February 2004
- January 2004
- December 2003
- November 2003
- October 2003
- September 2003
- August 2003
- July 2003
- June 2003
- May 2003
-
Blogroll
- Antonia Zerbisias
- Baron Lam
- Ben Hammersley
- BlogTO Podcast - Toronto blog
- Bob and AJ
- Boing Boing
- Cam Hotchkies
- Canadian Podcast Buffet - Get your fill of Canada
- CBC Podcasting
- CBC.ca
- CEO Bloggers - Bloggin Hi-Tech CEOs
- ChangeThis Newsletter
- Chris Ness
- Clean Break
- CNet News
- David Sifry
- Doc Searls
- Electric Sky - podcasting visual insound
- Globe and Mail
- in over your head - podcasting, hip hop, and how to keep your kids off 50 cent
- Jian Ghomeshi
- Joel Spolsky
- Kuro5hin
- Lawrence Lessig
- Leonard Brody
- Linux Journal
- Linwood Barclay
- Malcolm Gladwell
- Mark Evans
- McMaster Dailynews
- Miguel de Icaza
- Needs No Introduction
- Password Generator
- Randy Yu
- Rick Mercer Report
- Seth Godin
- Slashdot
- Stones Throw Podcast - New Music from Stones Throw Records
- The Hour - w/ Strombo
- The Register
- Tim Bray
- Tim O'Reilly
- Tod Maffin
- Weather -- Toronto
- WordPress
Never to be one to back down on a good math challenge, I took a shot at it. I have most of the details, but I’m missing something to put a whole proof together. It doesn’t help that my mathematical induction/proof skills have been unused in a good 3 years along with math relations and identities.
Some definitions:
Let x be the number you pick with digits a0, a1, … , aN
Let y be the number with digits b0, b1, … , bN that is rearranged digits from x
The difference would be z=|x-y| made up of digits c0, c1, …, cN; cN = |aN - bN|
A bunch of random test cases show that the sum of the digits of z is always divisble by 9. ie: (c0 + c1 + … + cN) mod 9 = 0. So, given all the digits except 1, you can always figure out the missing digit.
Now any of you remember, a number is divisible by 9 iff the sum of its digits is divisible by 9. The same property holds for the number 3. So in our case, z = |x-y| must be a multiple of 9.
Here’s where I’m stuck. Why is z with digits cN divisible by 9? I’ll sleep on it and see if something comes to me… Yes, I dream math. At least I don’t own a pocket protector. *cough* http://www.nesser.org/blog/archives/8 *cough*
Damn you Mark. I couldn’t stop scribbing out a mess of algebraic notation on my little scrap piece of cardboard. It even caused my mom to ask “What the hell is that mess?” But I think I got it. Plain HTML text is gonna make this a mess so hopefully it’s readable.
Extending my notation above,
Let x = (aN * 10^N) + … + (a1 * 10^1) + (a0 * 10^0)
Let y = (bN * 10^N) + … + (b1 * 10^1) + (b0 * 10^0)
-> we are just breaking down a number into sums of their place value. For example, 1234 = (1 * 1000) + (2 * 100) + (3 * 10) + (4 * 1).
Define a function sigma(m, n, expression) such that you take the summation of the expression where m is from 0 to n. So then, we have:
x = sigma(j, N, (aj * 10^j))
y = sigma(j, N, (bj * 10^j))
Let’s assume x is bigger than y such that z = x - y >= 0. Just so we don’t have to deal with absolute values. So here’s the math:
z = x - y
= sigma(j, N, [aj * 10^j]) - sigma(j, N, [bj * 10^j])
= sigma(j, N, [(aj * 10^j) - (bj * 10^j)])
= sigma(j, N, [(aj - bj) * 10^j])
Now, 10^N can be rewritten as [1 + (N-1 number of 9’s)]. For example, 100 = 1 + 99. Generally, this is 10^N = 1 + sigma(j, N-1, [9 * 10^j]). Substituting this into our x-y expression gives:
= sigma(j, N, [(aj - bj) * (1 + sigma(i, N-1, [9 * 10^i]))])
= sigma(j, N, [aj - bj]) + sigma(j, N, [(aj - bj) * sigma(i, N-1, [9 * 10^i])])
For the second term, we can factor out the constant 9 out of the nested sigmas giving:
9 * sigma(j, N, [(aj - bj) * sigma(i, N-1, 10^i)])
This is obviously divisible by 9 so we look at the first term.
We need sigma(j, N, [aj - bj]) to be divisible by 9 as well for z=x-y to be divisible by 9. But remember we defined the digits bj to be rearranged digits of aj? Therefore, the sum of aj is the same as the sum of bj and the sigma evaluates to 0.
So z = 0 + 9 * (some big sigma evaluation)
and we’re done! z is always divisible by 9 no matter what digits you pick in your original number. The Fido flash program then takes the digits you feed it, sums it, takes a mod 9, and spits out your answer!
Think clearly.
So I was bored while sitting here waiting and smelling the turkey in the oven and came back to double-check last night’s math. Everything still seems in order, a non-math explaination that I made.
“10^N can be rewritten as [1 + (N-1 number of 9’s)]” is not true. It should read “10^N can be rewritten as [1 + (N number of 9’s)]”. The math though is correct. In my example, 100 = 1 + 99 which is 10^2 = 1 + (2 9’s). And in case the next step where I put it into sigma notation isn’t clear, 1 + 99 = 1 + 9*10^1 + 9*10^0. Which is where the N-1 typo spawned from.
I don’t know why I suddenly had this obsession. Someone please check my work so I can forget about this ;)
Well since Baron was the only one to attempt solving the puzzle.. I guess you are the only one that still reads my blog :) … I will post the solution.
Now Baron, it must have been the case that the combination of a long-weekend and lots of food and drink made you ramble. The sigma method in comment #2 was an interesting way of expressing the solution. I think it overcomplicated your solution, but result is still correct up to the algorithm to determine the missing number.
In short, the solution is show that the difference of the numbers you chose, and those numbers jumbled is a factor of nine (Baron, you did this). Then using the property that you correctly mentioned in Comment #1, Any multiple of 9 has its digits sum to a multiple of 9.
Where your brain was working faster than your fingers was the line:
The Fido flash program then takes the digits you feed it, sums it, takes a mod 9, and spits out your answer!
If this were correct, then I take my result of 432, circle 2, sum 4 + 3 = 7. 7mod9 = 7 –> not 2.
So you’ve got the pieces, just didn’t put them together correctly, therefore the correct algorithm is:
9 - (sum remaining digits)mod 9 = circled digit
Thanks for your efforts Baron. Enjoy impressing friends with your mind reading capabilities.
I’ll post another one soon.