A challenge from the Mensa Puzzle Calendar
Chris Myers
chris.myers at prov.ingenta.com
Thu Oct 3 15:25:28 EDT 2002
I have the "Mensa Puzzle Calendar" on my desktop, and one of the first
things I do in the morning, aside from checking my email, is to try to
solve the daily puzzle. Most of them are word-type problems,
cryptograms, anagrams, age problems, etc., but today's was a nice
numerical challenge that lent itself to writing a program to solve it:
The following multiplication example uses all the digits from 0 to 9,
and X's have been used to represent numbers, not the multiplication
sign.
7XX
XX
-----
XXXXX
I wrote (IMHO) a very nice piece of python code to solve this for me,
and then generalized it a bit: What if the first digit (7) is not
given? How many unique solutions do we get and what are they? (I
included those numbers that started with 0 for consistency.)
I'm a puzzle kind of guy, so I thought some of you might be, too.
I'd be very curious to see the kind of solutions people come up with.
My solution ended up being a total of 19 lines of code, including a
print statement to give me a nice formatted output for each solution,
resembling the initial problem from the calendar.
OK, folks. The gauntlet is down. Have at it!
(NOTE: I realize this is not really a Python thingy, but more of an
algorithm design thingy, but nonetheless, fun.)
More information about the Python-list
mailing list