A Geeks approach to the Puzzler
On the NPR Show, Weekend Edition every Sunday, they have a puzzle. Usually, I don’t bother trying to figure them out, but last week’s puzzler seemed like a great programming puzzle. Take a letter from each of the first nine elements, in order, to form a common word in arithmetic.
A quick calculation revealed that there were approximately 18 million possible words. A script could easily be written that would generate all the possibilities and then put those words through a spell checker.
I decided to write this as a Bash script. The one problem is that the spell command in Linux returns everything that is misspelled, instead of everything that is spelled correctly. I could have gone out, checked the source for the spell program and written a new version that would give me only those words that were spelled properly, but that seemed like more of a project than I wanted to take on.
So, I wrote a script that called spell and checked the results and would return properly spelled words.
The combination of scripts were not very efficient and took three and a half days on a beat up old computer in the corner to run all the way. In addition, as I was reviewing this to write my blog post, I found that I had put in the wrong characters for Carbon.
Nonetheless, I came up with two different common words related to arithmetic. The first to pop up was ‘determine’. I can easily imagine a teacher asking her students to “Determine the numerator”. Yet this brings us to the second word that popped up, which was ‘numerator’.
I submitted ‘determine’ but didn’t hear anything back. I suspect they were looking for numerator and that many people solved it using a pencil and paper instead of a quick computer program. Yet it was a fun programming exercise.
Do you play the Puzzler on Sunday Weekend Edition? Have you ever attempted to solve the puzzles through computer programs? Let me know your experiences.