- Asked 3/12
- 2069 Poush · 7 marks
Cryptarithmetic RIGHT+RIGHT=WRONG
Short answer
Using constraint satisfaction with column equations and carries, one solution is R=4, I=2, G=0, H=6, T=5, W=8, O=1, N=3 (42065+42065=84130).
Solve the following crypto-arithmetic problem, where different letters denote different integers and identical letters denote the same integer: RIGHT + RIGHT = WRONG. Show all the steps of solving it through constraint satisfaction problem.
This is a constraint satisfaction problem.
- Variables: R, I, G, H, T, W, O, N
- Domain: {0, 1, ..., 9}
- Constraints: all letters different; R and W (leading letters) non-zero; the addition must be arithmetically correct.
R I G H T
+ R I G H T
-----------
W R O N G
The result has the same number of digits, so there is no carry out of the leftmost column.
Column equations (c1...c4 = carries, each 0 or 1)
- T + T = G + 10·c1
- H + H + c1 = N + 10·c2
- G + G + c2 = O + 10·c3
- I + I + c3 = R + 10·c4
- R + R + c4 = W (W ≤ 9)
Solving by constraint propagation and backtracking
- Column 1: G = 2T mod 10, so G is even and c1 = 1 if T ≥ 5.
- Column 5: W = 2R + c4 ≤ 9 ⇒ R ≤ 4, and W is even if c4 = 0.
- Choose T = 5: 5 + 5 = 10 ⇒ G = 0, c1 = 1.
- Column 2: H + H + 1 = N + 10·c2. Choose H = 6: 13 ⇒ N = 3, c2 = 1.
- Column 3: G + G + c2 = 0 + 0 + 1 = 1 ⇒ O = 1, c3 = 0.
- Column 4: I + I + 0 = R + 10·c4. Choose I = 2: 4 ⇒ R = 4, c4 = 0.
- Column 5: R + R + c4 = 8 ⇒ W = 8.
- Check distinctness: R = 4, I = 2, G = 0, H = 6, T = 5, W = 8, O = 1, N = 3, all different and R, W ≠ 0 ✓.
Verification
4 2 0 6 5
+ 4 2 0 6 5
-----------
8 4 1 3 0
42065 × 2 = 84130 = WRONG ✓
Answer: R = 4, I = 2, G = 0, H = 6, T = 5, W = 8, O = 1, N = 3 (42065 + 42065 = 84130).
Note: the puzzle has several valid assignments (a computer search gives 11 in all, e.g. RIGHT = 47065, 10678, 15648, 31854). Any one that satisfies all constraints is correct.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Cryptarithmetic LOGIC+LOGIC=PROLOG · Artificial Intelligence, chapter 2 · asked 3×
- Cryptarithmetic WRONG+WRONG=RIGHT · Artificial Intelligence, chapter 2
- CSP and SWIM+WEAR=RELAX · Artificial Intelligence, chapter 2