Cryptarithmetic: Difference between revisions
From charlesreid1
(Created page with "Cryptarithmetic example: https://developers.google.com/optimization/puzzles/cryptarithmetic <pre> CP + IS + FUN -------- = TRUE </pre> The challenge is to fin...") |
No edit summary |
||
| Line 11: | Line 11: | ||
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 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 " | The "thousands" place has nothing on the left side, and a <math>\mbox{T}</math> on the right side. | ||
The "ones" place becomes the expression <math> | The "hundreds" place has an <math>F</math> on the left side and a <math>\mbox{R}</math> on the right side. | ||
The "tens" place becomes the expression <math>(C+I+U) \times base</math> on the left side and <math>U \times base</math> on the right. | |||
The "ones" place becomes the expression <math>P+S+N</math> on the left and <math>E</math> on the right, which, combining, gives: | |||
<math> | <math> | ||
\ | F \times base^2 + (C+I+U) \times base + (P+S+N) = T \times base^3 + R \times base^2 + U \times base + E | ||
</math> | </math> | ||
Revision as of 08:11, 17 July 2017
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 \times base^2 + (C+I+U) \times base + (P+S+N) = T \times base^3 + R \times base^2 + U \times base + E $