blacksmith gunpowdery

In this old blog post, I worked out how to write a computer program to find five words of five letters using 25 different letters of the alphabet.

there is no solution to this problem, but I discovered "blacksmith gunpowdery", which together use twenty letters. Pretty close, so I'm maintaining a blog post here for bragging rights.

in her blog, this girl who went to my high school wrote:

  1. I don’t know if this is dorky or just sort of OCD, but when I’m anxious or bored, I try to come up with 5 five letter words using 25 letters of the alphabet. I’ve been trying to accomplish this feat for 9 years. I don’t know if 5 such words exist, but I do it anyway.

Well, I wrote a computer program. It’s still running, so I don’t know if there’s an answer yet. I’m inclined to suspect there isn’t. Lots of four word sets (one of my faves above), but the field narrows very rapidly. I suspect I might be able to find six four letter words.

키스의 고유조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다

If you limit to five letter words and eliminate all the words that have repeated letters (e.g. ‘fluff’), you wind up with 6,345 words, at least in the OSX dictionary. Lots of them are pretty questionable: zhmud, kreng, oftly. thruv, rhumb, etc. I first tried to recursively check all combinations, but there are lots of them. Lots and lots. Specifically, 6345! / 6340! = 63456344634363426341 = 10,267,708,000,000,000,000 (10 quintillion). 10 19 possibilities.

Törkylempijä vongahdus

One quintillion pennies would cover the earth, or would make a cube 5 miles on a side source. There are ten times as many combinations as grains of wheat ever grown, ten times the weight of the earth’s atmosphere in pounds source

This would take a long time

So I came up with a nifty trick by noticing how often the same compare gets done. I build a compare table – a hash where each key is a dictionary word, and the value is an array of all the words that do not have common letters and are alphabetically later. Then, if I have N words, all I have to do is merge the arrays corresponding to those words keeping only the ones that are common to all N and loop through the result. The table takes a half an hour to build. Once that’s done, it’s way faster, but still… way fucking slow. I think fast enough to come up with an answer.

いろはにほへと ちりぬるをわか よたれそつねな らむうゐのおく やまけふこえて あさきゆめみし ゑひもせす

I tried finding an answer online, but didn’t see anything. It’s a hard thing to search for… Pangrams are close, but those have to be a sentence and have flexible word sizes. I bet someone else has done it, and I bet I won’t know that until I’ve got an answer (if there is one) and I google for it.

Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία

I think my algorithm and code are pretty spiffy, a nice tradeoff between elegance, readability, and speed. If the fate of the world depended on it, I can think of ways to speed this up at least an order of magnitude, but since I only have to run it once and there’s no time limit, not a big issue. The particularly nice thing about this problem is it goes faster as it gets later in the alphabet. I’m guessing it’ll take less than a day to get through the entire set.

comments powered by Disqus back
follow me
qr to /blog/blacksmith-gunpowdery