Saturday, May 06, 2006

Ron's Puzzle: Linking, Shifting and a Latin Root

So, after a long week, with work and humor and other matters, it is now time to turn back to some relaxing mathematics. In particular, we're going to examine the secret working inside a puzzle posted by my friend Ron at A Wing and a Prayer. Here is the statement of the puzzle:
I heard this on a local radio station. Follow the directions:

1. Start with the first three digits of your telephone number.
2. Multiply by 80.
3. Add 1.
4. Multiply by 250.
5. Add the last four numbers of your telephone number.
6. Repeat Step 5.
7. Subtract 250.
8. Divide by 2.

The answer? You should be very familiar with it.
Now what is going on here?

First I will have to remind you of some background information.

Well, some time ago I called your attention to the strange property called commutivity, which does not have to do with driving to work. Commutativity is the property that makes 2+3 the exact same thing as 3+2 - or, as we math guys say, "addition over the integers commutes".

The fun thing is that not all operations commute! And as an example, I called your attention to the word "live" which is NOT the same thing as the word "evil", and wondered if you might see the hidden something which stands between the letters of those words.

You see, English words are read from left to right. And except for the few palindromes like "noon" or "radar", one cannot just reverse a word and get the SAME thing from right to left! So there is a certain something which links letters together, kind of like railroad cars, which can only couple at their ends, and never on their sides or top or bottom, or corner - AND more importantly, that linker has a handedness or chirality, like people, or sugar (what Latin root does "dextrose" contain?), and some other things. Which means this linking thing does NOT commute. (It walks to work. Hee hee hee. Or maybe I should say it works at home.)

What is that linking thing? Computer people call it the concatenation operator - which comes from a Latin root catena which means "chain". Hence the link. (Don't you just love these puns?) So when we make a word out of letters, we "concatenate" them, which I will write with the "~" sign:
"l"~"i"~"v"~"e" = "live"
but
"e"~"v"~"i"~"l" = "evil"
which is not the same, because "a"~"b" is NOT "b"~"a". Hurray.

Now how does that relate to Ron's puzzle? Well, as I hinted in my comment on his blogg, the puzzle depends on the fact that multiplication by the radix has the effect of a shift. OK, that's jargon, but it is simple to understand. Here's an example:

As I am a computer guy, I will use the computer symbol for multiply, which is "*".
When one multiplies 2 by 10, that is 2*10, the answer is 20.
When one multiplies 20 by 10, that is 20*10, the answer is 200.
When one multiplies 200 by 10, that is 200*10, the answer is 2000.
When one multiplies 2000 by 10, that is 2000*10, the answer is 20000.

You see how the two shifts to the left? Each multiplication by TEN moves it one place - ten is what we call the radix (another Latin word, meaning "root") or base of our number-notation scheme.

Now for the secret the mathematicians don't want me to tell, and which will make the philosophers cheer (if they are still awake.)

You see, those things which most of us call "numbers" like 2000 aren't REALLY numbers. They are notations for numbers. (Ah! Now you see! This is why I spent so much time talking about concatenation!) For inside a computer, the numbers are "kind of" like the way the math people talk - or maybe think - about them... but in order to SEE the numbers, we computer guys have to PRINT or display them - and that means we have to write them in a given notation. In case you think this is somehow a computer trick, it isn't. All this is just the same if we were just talking about numbers, or writing them in a book, or posting them in a blogg.

Sure, we could just as well write them in an old way, like Roman numerals, which is awkward, or in a new way, like "hexadecimal" or "octal" or "binary" which are closer to the way the computer holds a number, which may be even more awkward. But to write a number for MOST of us normal humans means writing it in base ten, or decimal, which is the usual way of doing things with numbers.

So that means anything where we multiply something by ten will just shove that something to the left. And multiplying by ten thousand will shove that something FOUR places to the left. That's the secret to Ron's puzzle. Now I will go over it, step by step.

First, let's say your telephone number is "abc-defg", and each of these seven letters stands for a DIGIT - that is, for one of the SYMBOLS for a number between zero and nine: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Here, you see we are just writing digits next to each other...

[A warning to attentive philosophers and computer scientists: I am skipping a step here! I'll explain in another post. Hint: the secret is 48.]

... so if we wanted to have the actual number p (the number, NOT the notation) which is written as "abc", we'd have to compute this:
p = a*100 + b*10 + c
and if we wanted the number q which is written as "defg" we compute this:
q = d*1000 + e*100 + f*10 + g
But we cannot just put two things down next to each other in math, and get them to "stick together" (to concatenate - not in MATH, though in computers, but that's a longer story!) Otherwise two added to two would be twenty-two, hee hee. So the original number, as a number isn't pq, but something a little more tricky.

In fact, the complete number, AS A NUMBER, would be n=p*10000+q... but this may be confusing, so I will give you an example.

If your number is "789-4321" since you are a human, you can EASILY see that this is seven million, eight hundred ninety four thousand, three hundred twenty one. but it's NOT easy for a computer, which is stupid. So we have to compute it in pieces. The top number p which is written "789" is the number seven hundred eighty nine, and we compute it as
p = 7*100 + 8*10 + 9
which comes out to 789, just as we said. But the difference is that one was DIGITS sitting next to each other (or, as we say, "concatenated") and the other is the actual number, but written in base ten.

Also, if we write q which is "4321" as 4*1000+3*100+2*10+1, we simply have q=4321.

But we are not allowed in MATH to write p beside q, and have that mean something (except when it means multiplying). So if we want to get back our telephone number, we're going to have to SHIFT p over by four, and then add in q, which means multiplying by ten thousand. So our complete number is 789*10000+4321, which is 7894321, as we said.

Now that I have pointed out this important and trivial difference, we'll do the puzzle.

1. Start with the first three digits of your telephone number.
That's our p.

2. Multiply by 80.
So we have 80*p

3. Add 1.
That's 80*p + 1

4. Multiply by 250.
OK, we'll write it as
250*(80*p+1)
which means we have to "distribute" (is that Chestertonian?)
250*80*p + 250
or
20000*p + 250

5. Add the last four numbers of your telephone number.
which means we add in our q:
20000*p + 250 + q

6. Repeat Step 5.
So we add q again:
20000*p + 250 +q+q
but I will write that as:
20000*p + 2*q + 250

7. Subtract 250.
Now things are getting simpler:
20000*p + 2*q

8. Divide by 2.
And behold:
10000*p + q

which is the formula I showed you that sticks the top and the bottom together as a complete number! So all this puzzle accomplishes is to take your phone number apart as two "numbers", then re-unite it by doing the appropriate "radix shift", as I said.

Whew. I hope this helps. It is kind of long to write out, and would probably be a lot easier if we were together, and had a blackboard. But it may be fun to work through with your own phone number!

Please note: this is perhaps a little tedious, and requires attention to detail. But it is not really complex. Computer programmers have to deal with all kinds of little tricks like this just to do the simplest kinds of work - and we have to know how to do the work ourselves, or we could not instruct the machinery to accomplish it.

If you have any questions, please see me after class (or post a comment).

OK, then - time for recess!

4 Comments:

At 06 May, 2006 13:54, Blogger rhapsody said...

You've lost me after, "start with the first three digits of your phone number"...

Will have to come back to it for review- or get a tutor!

:)

 
At 06 May, 2006 13:57, Blogger Rick Lugari said...

Hah...so the whole "add 1" and "subtract 250" thing was pointless stuff intended to make the whole exercise seem more *magical* or elaborate (they just canceled each other out). And any other combination of numbers could have been used as long as their result was to shift p over.

Thanks for the lesson, Doc. :)

 
At 06 May, 2006 14:04, Blogger Ron Rolling said...

This has been linked.

 
At 06 May, 2006 20:11, Blogger Dr. Thursday said...

Thanks Ron - it's all about a link, hee hee.

Sorry, Rhapsody. Maybe if you ask questions, I can get it more clear for you.

Yes, Rick - and though GKC was no mathematician, he recognized that this is the "usual trick" and mentioned it as such, trying to get people to be aware that it occurs in other places too - here is just a sample from a complete essay on this topic:

They that go about the world asking riddles and doing puzzles (those enemies of the human race) used to have one particular game which, after ramifications of arithmetic, ended with "taking away the number one first thought of." It is a silly game, and, like many other silly games, has been played by great empires and on a large scale. That touch of over-civilisation which is always the first touch of a returning barbarism can best be noted whenever we note this game of subtracting the original thought with which everything began. I mean that men will build up institutions and elaborations round the central pillar of some thought. Then, after the passage of centuries the central pillar falls down, but the rest of the edifice remains. Such an edifice is not always in danger, but it is in decay.
[GKC, ILN Mar 9 1912 CW29:253-4]

 

Post a Comment

<< Home