- 2072 Asoj · 1+6 marks
CSP and SEND+MORE=MONEY
Short answer
A CSP has variables, domains, and constraints; a solution assigns values satisfying all constraints. For SEND+MORE=MONEY, solving carries gives M=1, O=0, S=9, R=8, E=5, N=6, D=7, Y=2; 9567+1085=10652.
What do you understand by constraint satisfaction problem? Solve the following crypt-arithmetic problem: SEND + MORE = MONEY.
Constraint satisfaction problem (CSP)
A CSP consists of a set of variables, a domain of values for each variable, and constraints on the values the variables may take together. A solution assigns a value to every variable so that all constraints are satisfied. Examples: map colouring, 8-queens, cryptarithmetic.
SEND + MORE = MONEY
- Variables: S, E, N, D, M, O, R, Y; domain 0-9; all different; S and M non-zero.
S E N D
+ M O R E
---------
M O N E Y
Column equations (c1, c2, c3 = carries; c4 = M):
- D + E = Y + 10·c1
- N + R + c1 = E + 10·c2
- E + O + c2 = N + 10·c3
- S + M + c3 = O + 10·M
Solving
- M = 1: the sum of two 4-digit numbers is less than 20000, so the carry into the fifth digit is 1.
- Column 4: S + 1 + c3 = O + 10, so O = S + c3 − 9 ≤ 1 (since S ≤ 9). O ≠ 1 (M = 1), so O = 0 and S = 9 − c3, that is, S = 9 (c3 = 0) or S = 8 (c3 = 1).
- Column 3: E + 0 + c2 = N + 10·c3. If c3 = 0, then since E ≠ N we need c2 = 1 and N = E + 1. If c3 = 1, we would need E + c2 ≥ 10, which forces E = 9, c2 = 1 and N = 0 = O (clash). So c3 = 0, S = 9, c2 = 1, N = E + 1.
- Column 2: N + R + c1 = E + 10 ⇒ (E + 1) + R + c1 = E + 10 ⇒ R = 9 − c1. R ≠ 9 (S = 9), so c1 = 1 and R = 8.
- Column 1: D + E = Y + 10 (c1 = 1). Remaining digits: {2, 3, 4, 5, 6, 7}, with N = E + 1 and D + E ≥ 10.
| E | N | D needed (≥ 10 − E) | D + E − 10 = Y | Result |
|---|---|---|---|---|
| 2 | 3 | ≥ 8 | none available | fail |
| 3 | 4 | 7 | Y = 0 (= O) | fail |
| 4 | 5 | 6 or 7 | Y = 0 or 1 | fail (Y clashes with O or M) |
| 5 | 6 | 7 | Y = 2 | success |
| 6 | 7 | 4 or 5 | Y = 0 or 1 | fail |
| 7 | 8 | - | N = 8 = R | fail |
Hence E = 5, N = 6, D = 7, Y = 2 (all different from the others).
Verification
9 5 6 7
+ 1 0 8 5
---------
1 0 6 5 2
9567 + 1085 = 10652 ✓ (this is the only solution, confirmed by an exhaustive computer search).
Answer: S = 9, E = 5, N = 6, D = 7, M = 1, O = 0, R = 8, Y = 2.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- CSP and SWIM+WEAR=RELAX · Artificial Intelligence, chapter 2
- AI, Turing test, CSP examples · Artificial Intelligence, chapter 1
- Problem space; BASE+BALL=GAMES · Artificial Intelligence, chapter 2
- Cryptarithmetic LOGIC+LOGIC=PROLOG · Artificial Intelligence, chapter 2 · asked 3×
- Cryptarithmetic RIGHT+RIGHT=WRONG · Artificial Intelligence, chapter 2 · asked 3×
- Russell: wisdom more necessary with knowledge · Communication English, chapter 2 · asked 2×
- Making programs more readable · Instrumentation II, chapter 9
- Initial value problem y''−4y'+3y · Mathematics, chapter 4 · asked 3×
- Initial value problem y''+2y'+5y=0 · Mathematics, chapter 4 · asked 3×