rowyn: (innocent)
[personal profile] rowyn
I have fifteen minutes left to my lunch break, and my mind is prodding at me to Do Something with it. I have assorted things that I could be doing, but I'm not too keen on doing any of them.

One of my coworkers sent me a "stupid math trick" email. You know the kind -- pick a random number, follow these steps, and be amazed that we can predict your results! My coworker wanted to know "How do they do that?"

Usually, these are obvious ones, where somewhere along the line you both divide and multiply by your number or somesuch, and it's easy to see why the result is always the same. This one was a little weirder. The word version went like this:

1. Grab a calculator. (you won't be able to do this one in your head) [And if you can, you're not going to be impressed by the results anyway.]
2. Key in the first three digits of your phone number (NOT the area code)
3. Multiply by 80
4. Add 1
5. Multiply by 250
6. Add the last 4 digits of your phone number
7. Add the last 4 digits of your phone number again.
8. Subtract 250
9. Divide number by 2
Do you recognize the answer?

I translated the word version of this problem into the following formula:

((n*80+1)*250+y*2-250)/2 = n*10000+y

(Actually, the first time I looked at it, I thought it was asking me for the first three digits of my phone number again, which isn't nearly as cute and gets you n*10001.)

In any case I knew, intellectually, that there must be a basic algebraic solution, a series of steps which I could apply to the first and get the second. But it wasn't until I started writing this entry that I could actually see how this one went. I feel better now for having worked it out. I was thinking this morning "Wow, I can't believe I've forgotten so much about algebra that the steps are no longer glaringly obvious." But the intervening steps are:

((80n+1)*250+2y-250)/2
(20000n+250+2y-250)/2
(20000n+2y)/2
10000n+y

I feel stupid for not being able readily to remember simple facts, like (80n+1)*250 = 20000n+250. On the other hand ... math illiteracy is rampant, as witnessed by the fact that my coworker had to ask me how it was done. And at least I knew not only "A solution exists!" but I eventually remembered how to get to it. O:)

Date: 2005-04-06 06:38 pm (UTC)
From: [identity profile] tuftears.livejournal.com
Heh, that's the stuff. It's Obfuscated Math!

(there's a regular Obfuscated C Coding contest that asks for people to submit code obfuscated as much as possible to disguise its actual intent - sort of the opposite of the usual expectation, i.e. that people will write clear, easy to understand code.)

Date: 2005-04-06 06:59 pm (UTC)
From: [identity profile] kawaiijen.livejournal.com
At my workplace it is very rare to get non-obfuscated code. The programmers think that is means job security if only they can understand it!

Date: 2005-04-06 08:20 pm (UTC)
From: [identity profile] cktraveler.livejournal.com
I recall reading an article about that from the 70s, the idea being that programmers who deliberately wrote compressed spaghetti code would 1) be able to make their 4k machines do 16k jobs, and 2) would have job security since no one else could debug the company's software.

Kind of chilling really, especially with procedural and object-oriented languages. No longer do we have the BASIC/FORTRAN luxury of being able to identify the beginning and end of a program at a glance ... ;)

Date: 2005-04-06 08:49 pm (UTC)
From: [identity profile] level-head.livejournal.com
It's certainly not instantaneous.

Knowing that it's a trick, you start looking for patterns that don't even need to be formalized in the written version:

The "add 1" and "subtract 250" cancel out immediately. And the "divide by 2" at the end means, instead, add your number only once and use 40 rather than 80.

So the key becomes 40 times 250, or 10000. Thus, AAA*10000 + BBBB, or AAABBBB.

But this is far from simple for the huge majority of the population, and your own skills here, seemingly modest to you, are all too rare. Even the concepts of approaching it though the formalizations of logic or algebra are likely alien concepts to most, even if they had been taught it at one time -- or so it seems to me.

===|==============/ Level Head

Date: 2005-04-06 10:27 pm (UTC)
From: [identity profile] makovette.livejournal.com
Elegant explanation LH, thank you! I solved it Rowen's way first too - too many inefficient if-then-else loops in my logic. :-)

Thanks!
Mako

January 2026

S M T W T F S
    12 3
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Active Entries

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 9th, 2026 08:09 pm
Powered by Dreamwidth Studios