Anyway, here is the description of the puzzle, from NPR:
Write down these two chemical symbols, on the first line write LI, for lithium, and FE for iron. Underneath write NE for neon. And AR for Argon. Reading across you get the four letter words, life and near. And reading down you get, line and fear, completing a miniature word square composed only of chemical symbols. The object is to create a 3X3 square, composed of nine chemical symbols, in which each of the three rows across and each of the columns down, spells a word. You may use either one letter or two letter chemical symbols, but the idea is to use as many two letter ones as possible. Only un-capitalized words are allowed. Our source for acceptable words will be Merriam-Webster 11th Collegiate Dictionary.
I initially tried to work it out by permutations of the 3x3 grid. I think I recall that there were 94 two letter element abbreviations, so putting out all of the ways that works into a 3x3 grid was... something like over 100 years of computation on a single processor assuming 100 million grid tests per second - which was more than I was willing to wait.
So I wrote code that took the 12dict wordlist (a relatively nerd-famous group of dictionary wordlists) - specifically the "2of12.txt" one (due to not having proper nouns or abbreviations), and stripped out all of the 3, 4, 5, and 6 letter length words. It looked at them and made sure that they could be made up of only of element abbreviations.
I looked all over the net for a text file of element abbreviations, but couldn't fine a basic one, so I decided that I had searched too long and just wrote one out by hand, figuring that would take less time.
The wordlist that I used was condensed down to less than 2k words.
I then brute forced the way through there, putting one in the first row of that 3x3 grid, and then put another one in the 2nd row, and then another in the 3rd row, and then checked to see if the columns made words that were also in that list. I made use of hashes for faster lookup times, and did a few other tricks along the way to reduce the number of computations - but the general idea was that we were going to have to at least through every word in the list in that first position - whether we looked any further was up in the air until the other tests passed.
If it passed all tests, then it was put into a success file.
There were 101 successes.
Assuming my code was correct, then the words weren't repeated, and the elements weren't repeated, and there was no such thing as a grid consisting of solely 6 letter words.
I submitted it to NPR and if you are interested, I can write more about it, but at this point I'm pretty tired and/or tipsy and off to bed.
