From charlesreid1

Revision as of 08:13, 17 July 2017 by Admin (talk | contribs)

Cryptarithmetic example: https://developers.google.com/optimization/puzzles/cryptarithmetic

      CP
+     IS
+    FUN
--------
=   TRUE

The challenge is to find integers to swap out for each letter such that the equation holds true. This is a constrained programming problem, and can be re-cast in terms of an arbitrary radix as follows:

The "thousands" place has nothing on the left side, and a $ \mbox{T} $ on the right side.

The "hundreds" place has an $ F $ on the left side and a $ \mbox{R} $ on the right side.

The "tens" place becomes the expression $ (C+I+U) \times base $ on the left side and $ U \times base $ on the right.

The "ones" place becomes the expression $ P+S+N $ on the left and $ E $ on the right, which, combining, gives:

$ F r^2 + (C+I+U) r + (P+S+N) = T r^3 + R r^2 + U r + E $

where r is the radix.

We can also limit the search space by constraining C, I, F, T to be nonzero.