Cryptarithmetic Solver

Posted by Dinesh on

Cryptarithmetic is a puzzle consisting of an arithmetic problem in which the digits have been replaced by letters of the alphabet. The goal is to decipher the letters using the constraints provided by arithmetic and the additional constraint that no two letters can have the same numerical value. This type of problem was popularized during the 1930s is the Sphinx, a Belgian journal of recreational mathematics. One of the wellknown Cryptarithmetic problems which published in the July 1924 issue of Strand Magazine by Henry Dudene.

In Cryptarithmetic problems, A letter cannot represent more than one digit, and a digit cannot be represented by more than one letter. For example, if you were given the problem SEND + MORE = MONEY, you would get that O = 0; M = 1; Y = 2; E = 5; N = 6; D = 7; R = 8; S = 9. When writing your answer, just write the original arithmetic problem, with the letters replaced by numbers. Thus, in this case, you'd write 9567+1085 = 10652.

Alphametic Cryptarithmetic Examples

APPLE + LEMON = BANANA

LETS + WAVE = LATER

DONALD + GERALD = ROBERT

BROWN + PINK = IVORY

CRASH + ERROR = FOLDER

FLOPPY + MEMORY = REBOOT

CORN + GARLIC = POTATO

CARROT + CELERY = POTATO

BASIC + LOGIC = PASCAL

Cryptarithmetic Alphametic Solver

+ =
 

Formula:

SEND + MORE = MONEY

Constraints of the Cryptarithmetic problem are as follows:

  1. The arithmetic operations are in decimal; therefore, there must be maximum ten different letters in overall strings which are being used.
  2. All of the same letters should be bound to a unique digit and no two different letters could be bounded to the same digit.
  3. As the words will represent numbers, the first letter of them could not be assigned to zero.
  4. The resulting numbers should satisfy the problem, meaning that the result of the two first numbers (operands) under the specified arithmetic operation (plus operator) should be the third number.

Reference:

Wikipedia https://en.wikipedia.org/wiki/Verbal_arithmetic