M
M
Mercury132016-09-30 21:50:01
Algorithms
Mercury13, 2016-09-30 21:50:01

DONALD + HERALD = ROBERT, or How to translate an arithmetic rebus?

Here is an arithmetic puzzle I found in an old Soviet book. Obviously, this is some Dudeney or Gardner, DONALD + GERALD = ROBERT, quickly and clumsily localized into Russian. And immediately a problem arose.
There is a dictionary. What are the ways to effectively pick up three Russian words with the same layout of letters (preferably all possible triples)? What kind of preprocessing is needed for such a dictionary?
I recall the rules of the arithmetic rebus. Here is a correct arithmetic example, each digit is replaced by a letter, the same letters are the same digits, different letters are different digits.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2016-09-30
@OLS

I see the following way to speed up the search:
1) we remove all the characters that occur only once - only at the final stage it will be necessary to check that the selected triple does not violate the uniqueness of the discarded letters between themselves and between the discarded and left ones; conditionally we get DO*ALD+*ERALD=RO*ER*
2) select the word with the most remaining characters and start the journey through the dictionary; for each potential candidate for the first word, we look for candidates for the second and third, checking the coincidence of the remaining letters and the uniqueness of the discarded ones.
To speed up the search, I would create an array NxNxK, where N is the number of words of length K in the dictionary, and raise in it in position K for the letter in the first word the bits of the positions of the same letter in the second word. The same array could help in finding the initial contenders for the first word (you need to analyze the cells [i, i, *])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question