![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
|
A Math challenge
Mods: This doesn't belong in this forum. Originally I was going to ask about flash and disassembly but since that isn't the case here, it would be better off in the lounge. Please move it there.
Someone sent this link to me. http://digicc.com/fido/fido.swf It's a puzzle that has you randomly select a 3 or 4 digit number and then subtract from it a different 3 or 4 digit number created using the same digits. You then enter your answer into the flash program leaving out a digit that you have selected. The program then figures out which number you have selected. For example, if I pick 8530 and then rearrange that number to form 5803, the difference is 2727. By entering into the program any combination of 2, 7 and 7, it figures out that you selected the number 2. What I'd like to know is how this is done. I've been sitting here for awhile now trying to see what kind of pattern emerges when you subtract two numbers with the same digits but I just don't see the pattern. This isn't a homework question so knowing the answer isn't the end of the world. It would just be nice to satisfy my own curiosity. |
|
|
|
|
|
#2 |
|
Newbie
|
Re: A Math challenge
I'm figuring this out more as I go along. If you enter 0, you get 9. Enter 1 and you get 8 all the way up to 8 -> 1. Enter 9 and you get 9. The process at this point is trivial. The only thing I don't understand is why you need two numbers with the same digits. I don't know what property of numbers is being used.
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: A Math challenge
Google Magic Nines. You'll find this and lots of other similar "magical" goodies.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Newbie
|
Re: A Math challenge
That's interesting. I've seen other "magical" programs but I never realized it was all based on 9s.
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Jun 2007
Posts: 133
Rep Power: 2
![]() |
Re: A Math challenge
9 is an interesting number, it is the maximum number of cubes that are needed to sum to any positive integer.
|
|
|
|
|
|
#6 |
|
Professional Programmer
|
Re: A Math challenge
There is some other interesting things about 9:
http://en.wikipedia.org/wiki/Casting_out_nines Also since the topic is about Math tricks, do any of you guy know Vedic Math? Here are some pages which explain what it is and how it works: http://www.vedicmathsindia.org/tutorials.htm http://en.wikipedia.org/wiki/Vedic_mathematics There also are a bunch of vids on youtube, you just have to search for them. I hope some of you will find this interesting and or useful.
__________________
JG-Webdesign |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
Re: A Math challenge
The real proof for this would be lengthy.
The digits always add up to a multiple of nine, so it is simple arithmetic to find the missing digit. The number is a multiple of nine so the digits will add up to nine. This is the part that is going to get cut short: (As a side note, it won't work if you don't jumble the numbers at all) Basically, if you have a number of four digits, it can be represented as a*10^3+b*10^2+c*10^1+d*10^0 -or- 1000a + 100b + 10c + d (a,b,c,d live in integers). If you jumble the digits, you will end up with: a*10^e + b *10^f + c*10^g + e*10^h, where all variables are integers when you subtract: a*10^3 + b*10^2+c*10^1+d*10^0 -a*10^e + b *10^f + c*10^g + e*10^h a*(10^3 - 10^e) + b * (10^2 - 10^f) + c * (10^1 - 10^g) + d * (10^0 - 10^h) If you are familar with number theory, you may be familiar with modulo spaces. If not, I'm sure many people here can explain this. (im using '=' for modular equals, because i don't have the proper character set.) Lemma 1: if a = 0(mod b), a is a multiple of b Lemma 2: if a=b(mod c), a^k = b^k(mod c) 10 = 1(mod 9) by lemma 2, since 10 = 1(mod 9), 10^k = 1(mod 9) thus in (mod 9), 10^3 = 10^2 = 10^1 = 10^0 = 10^e = 10^f = 10^g = 10^h = 1 so 10^3 - 10^e in mod 9 is equivalent to 1 - 1, or 0; 10^2 - 10^f in mod 9 is equivalent to 1 - 1, or 0; 10^1 - 10^g in mod 9 is equivalent to 1 - 1, or 0; and 10^0 - 10^h in mod 9 is equivalent to 1 - 1, or 0. From lemma 1, that means that all of these values are multiples of 9. That means so a*(10^3 - 10^e) will be a multiple of nine, as will b*(10^2 - 10^f) and so forth When you add up these multiples of nine, they will equal a multiple of nine, due to the distributive property. This is a lot sloppier than if written on paper, but hopefully it gets the point across. I would assume this is a subset of what Dawei is referring to by "magic nines" Last edited by Harakim; Nov 14th, 2007 at 3:41 AM. Reason: Salvage at least some clarity |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Uman's WEEKEND CHALLENGE | uman | Coder's Corner Lounge | 34 | Aug 5th, 2008 9:25 PM |
| Computer Science Prereqs - Math | bigguy | Coder's Corner Lounge | 22 | Mar 15th, 2006 12:19 AM |
| Math Games | Sane | Coder's Corner Lounge | 8 | Dec 22nd, 2005 3:30 AM |
| Recommended math book to accompany course? | Jessehk | Coder's Corner Lounge | 7 | Nov 15th, 2005 6:05 PM |
| Weekend Challenge | theduck | Community Announcements and Feedback | 43 | Jun 3rd, 2005 4:58 PM |