CryptArithmetic or verbal arithmetic is a class of mathematical puzzles in which the digits are replaced by letters of the alphabet or other symbols. Usually it is required that each letter would be replaced by a unique digit. Each letter having different value from the other letters.
Alphametic problem is a subset of CryptArithmetic where the arithmetic operation is summation. In artificial intelligence, this problem is under category of Constraint Satisfaction Problem (CSP), or Constraint programming.

## Example Note that if you set X=2, Y =9 the meaning of XY is not 2*9 but a number 29.

To answer the above problem, we know that 2Y = X, thus X must be even number. We also know that 2X = Z, thus Z is also even number. Since the digits are limited from 2 to 9, then we can simply try Y = 2, this will give us X = 4 and Z = 8. Thus, {X=4, Y=2 and Z=8} is one of the solutions to the puzzle above.

When we try Y = 3, it will give us X = 6 and Z = 12 as invalid answer (because Z has two digits). You may think there is no other solutions. However, when you keep trying on higher number, say Y=6 then X = 12 and this is allowed if we consider the 1 can be carried the next digit and the actual value of X is 2. Thus, the value of Z will be 2*2+1 = 5. Thus, {X=2, Y=6 and Z=5} is also one of the solutions to the puzzle above.

If the digit integers are limited from 1 to 9, the above puzzle has another solutions of {X=2, Y=1 and Z = 4}. If the domain of digit integers are 0 to 9, the above puzzle has yet another solution of {X=0, Y=5 and Z=1}.

Thus, for domain of digits from 0 to 9, here are the possible solutions:
{X=2, Y=1 and Z=4}
{X=0, Y=5 and Z=1}
{X=2, Y=6 and Z=5}
{X=4, Y=2 and Z=8}

```          21     05     26     42
21     05     26     42
--- +  ---- + ---- + --- +
42     10     52     84```

The following are Alphametic puzzles. Can you find the solutions?
SEND + MORE = MONEY
WIRE + MORE = MONEY
WRONG + WRONG = RIGHT
LETTERS + ALPHABETH = SCRABBLE
BASE + BALL = GAMES
GERALD + DONALD = ROBERT
ATTRACTIONS + INTENTIONS = REGENERATION
LIONNE + TIGRE = TIGRON (French)
WEIN + WEIB = LIEBE (German)
SEVEN - NINE = EIGHT
ABCDE x 4 = EDCBA

The solutions can be searched using backtracking algorithm or by searching from the list of all possible permutations.

< Content | Next >