Jun 072011
 

One of the things I like the least about New Scientist (which, in many respects, is probably the best popular science magazine out there) is the “Enigma” brainteaser. I am sure it appeals to the “oh I am ever so smart!” Mensa member crowd out there but…

Well, the thing is, I never liked brainteasers. Are you really smarter than someone else because you happen to remember a random historical factoid? Does it really make sense to ask you to complete a series like, say, 1, 4, 9, 16, ? when the answer can be anything, as there is no compelling reason other than psychology (!) for it to be a homogeneous quadratic series?

But then… sometimes brainteasers reveal more about the person solving them than about the solution itself. I remember when I was in the second or third grade, our teacher gave us a simple exercise: add all the numbers from 1 to 100. (Yes, this is the same exercise given to a young Gauss.) Like Gauss, one of my classmates discovered (or perhaps knew already) that you can add 1+100 = 101; 2+99 = 101, 3+98 = 101, and so on, all the way up to 50 + 51 = 101; and 50 times 101 is 5050, which is the correct answer.

Trouble is, my classmate didn’t finish first. I did. I just added the darn numbers.

Between quick and smart, who wins? What if you’re so quick, you don’t need to be smart? Is it still smart to waste brainpower to come up with a “clever” solution?

Last week’s New Scientist Enigma puzzle caught my attention because it reminded me of this childhood memory. It took me roughly a minute to solve it. Perhaps there is a cleverer way to do it, but why waste all that brainpower when I can do this instead:

/* New Scientist Enigma number 1647 */

#include <stdio.h>

int main(int argc, char *argv[])
{
    int d1, d2, d3, d4, d5, d6, n;

    for (d1 = 1; d1 <= 9; d1++)
        for (d2 = 1; d2 <= 9; d2++) if (d2 != d1)
            for (d3 = 1; d3 <= 9; d3++) if (d3 != d1 && d3 != d2)
                for (d4 = 1; d4 <= 9; d4++)
                    if (d4 != d1 && d4 != d2 && d4 != d3)
                        for (d5 = 1; d5 <= 9; d5++)
                            if (d5 != d1 && d5 != d2 && d5 != d3 && d5 != d4)
                                for (d6 = 1; d6 <= 9; d6++)
                                    if (d6 != d1 && d6 != d2 && d6 != d3 &&
                                        d6 != d4 && d6 != d5)
    {
        n = 100000 * d1 + 10000 * d2 + 1000 * d3 + 100 * d4 + 10 * d5 + d6;

        if (n % 19 != 17) continue;
        if (n % 17 != 13) continue;
        if (n % 13 != 11) continue;
        if (n % 11 != 7) continue;
        if (n % d4 != d3) continue;
        printf("ENIGMA = %d\n", n);
    }

    return 0;
}

Yes, I am quick with C. Does that make me smart?

 Posted by at 2:21 pm