I have an assignment that needs to solve a cryptarithm. But I cant understand the algorithms that I saw in the internet. Could anybody explain how to do this in simple words?
Asked
Active
Viewed 756 times
1
-
What algorithms have you tried? – Anders Lindahl May 15 '11 at 08:31
-
getting all the possible combinations of characters in a string then compute for the sum to solve the cryptarithm. But its very slow – amiel May 15 '11 at 10:42
-
Have you done a frequency analysis of the ciphertext? – Anders Lindahl May 15 '11 at 10:45
-
Giving links to the "algorithms you saw on the internet" would help us a lot. There are lots of different ways to solve these constraint problems, ranging in dificulty and complexity. How familiar are you with backtracking algorithms? – hugomg May 15 '11 at 14:40
2 Answers
1
It's possible to solve this kind of problem with Genetic Algorithm, here is a solution using GA https://github.com/pauloremoli/cryptarithmetic

pauloremoli
- 51
- 1
1
As a general case, most Constraint Satisfaction Algorithms are a two step process, where a guessing (or branching) phase is followed by a deductive phase, where as many assignments as possible are found without guessing. (Think Sudoku, for example)
Example:
S E N D
M O R E
M O N E Y
First step: guess D=1 (remaining guesses = ...)
S E N 1 | D=1
M O R E
M O N E Y
Guess E = 1 (Remaining guesses = ...)
S 1 N 1 | D = 1 | E = 1
M O R 1
M O N 1 Y
We can now deduce that Y = 2 and that the carry value in the second column is 0
0
S 1 N 1 | D = 1 | E = 1, Y = 2
M O R 1
M O N 1 2
When you reach a dead end, backtrack

hugomg
- 68,213
- 24
- 160
- 246