Alphametic Puzzle Generator

Note: The following link is a much faster version of this puzzle generator written in C++ instead of Perl. The current page is still available in case the other is unreachable.

Fast Alphametic Generator

This page will allow you to search for alphametic puzzles (for a description of what they are and for some examples, see my alphametics page) among a group of words. These puzzles are rare, but given a number of words to use, it's not unusual to find one or two. I've also written a web-based solver for these puzzles.

Note: This page was down for nearly a year due to my ISP's change to new servers that don't support running C programs on with web-hosted software. I have re-written it in Perl, but because of the way this language functions, it is much much slower and will stop searching after a limited time. A run of this with lots of words will likely not complete and will only generate some of the possible puzzles. I don't have a solution to this limitation right now.

The generator will search for puzzles among all the permutations of the words given and find all puzzles conforming to the specified parameters. For an example of how to use it, see the bottom of this page.

You need to enter at least three words (two if you allow duplication), or there won't be enough options for summands and a sum. If you want to try to find puzzles with the possibility of duplicated summands, you can set the button to allow repeated words. Note that allowing words to appear as summands more than once means that the maximum possible number of summands isn't limited by the number of words you enter, so set the maximum summands limit appropriately.

Try searching among all of the names in your family, or terms related to a hobby, or something you're interested in. If you find any good ones, I'd be interested if you'd email me about them.


What base do you want to search for puzzles in (10, normally)?

Minimum number of summands:

Maximum number of summands:

Do you only want puzzles with one solution?
      Yes (only puzzles with exactly one solution will be generated)
      No (puzzles with one or more solutions will be generated)

Do you want to only look for puzzles with the first listed word as the sum?
      No (search for puzzles with any of the listed words as the sum word)
      Yes (use only the first word listed as the sum word)

Do you want to allow repeated words among summands?
      No (all summands will be unique)
      Yes (repeated summands are allowed. This will increase processing time)

Enter the words to search for puzzles, one word per line:

Example:
mercury
venus
earth
mars
jupiter
saturn
uranus
neptune
pluto


Example: Look for puzzles among the names of the planets where the word 'planets' is the sum.

Use base 10, set minimum summands to 2 and maximum to 9. Ask for puzzles with only one solution, and select 'Yes' to only look for puzzles with the first listed (planets) word as the sum.
Don't allow repetition.

Enter the following words and make sure 'planets' is first:

planets
mercury
venus
earth
mars
jupiter
saturn
uranus
neptune
pluto
After you press the submit button, it should find the following puzzles:
SATURN + URANUS = PLANETS
MARS + SATURN + URANUS + NEPTUNE = PLANETS
SATURN + URANUS + NEPTUNE + PLUTO = PLANETS


Technical Details

If the solver terminates because it ran out of time, there are several things you can do. Usually the best thing to try first is to reduce the range between the minimum and maximum summands. For example, if you want to look for puzzles with from 2 to 6 summands, you can get the same results asking for from 2 to 3 in one run and 4 to 6 in another run. Allowing repeated words for summands can increase processing time significantly, so disallowing them will help. Additionally, you may want to shorten the list of words, only ask for puzzles with one solution, or ask for puzzles with a specific word as the sum. For anyone using bases other than ten, larger bases take more time. There's not a specific number of words that's a limit because how long the analysis will take depends on the words in the list. Since the time limit is based on clock time instead of CPU time, using this generator when my ISP is less busy will get you farther. When exactly that is I don't know, but I'd guess that late night and early morning Pacific time would be a good bet.

The program searches for puzzles among all of the permutations of the words given, but it weeds out ones that can't have solutions due to word length or having more letters than the specified base. For example, "I + LOVE = ANN" can't have a solution because the sum is too short, and "HILLARY + RODHAM = CLINTON" has too many letters to have a solution in base 10. The permutations not easily weeded out in one of these ways are potential puzzles. For each of these the program tries to find one or more solutions. The program uses a smart depth-first search from the left to the right of the puzzle. With average length words and a machine that's not too heavily loaded, it will do about 300 of these searches a second.


81,122 visits (18 today, 146 this week, 578 this month, 4,180 this year) since January 3, 2000.

Back to my alphametics index.
Back to my homepage.

Copyright 2000 by Truman Collins
For comments, email: Truman Collins (truman@tkcs-collins.com)
Most recent update: November 10, 2013
http://www.tkcs-collins.com/truman/alphamet/alpha_gen.shtml