0% found this document useful (0 votes)
180 views3 pages

CSP Crypto Puzzle

Great note for AI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
180 views3 pages

CSP Crypto Puzzle

Great note for AI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSP: Cryptarithmetic puzzles

 Variables: the letters


 Possible values: {0,1,2,3,4,5,6,7,8,9}
 Constraints: all letters have different values, addition works as intended,
leading digits aren't zero.

Each of the different letters stands for a different digit. The aim is to find a substitution of
digits for the letters such that the above equality is arithmetically correct.

SOULTION:

To begin, start in the 5th column. Since 9999 + 9999 < 20000, we must have M = 1.

Then go to the 4th column. Since 999 + 999 < 2000, we either have 1 + S + 1 = O + 10, or S
+ 1 = O + 10, meaning S = O + 8 or S = O + 9, and O = 0 or 1. Since S is a single digit, and
M = 1, we must have O = 0.

In the 3rd column, since E cannot equal N, we cannot have E + 0 = N. Thus we must have 1 +
E + 0 = N. Since N cannot be 0, we must also have E less than 9. So there cannot be
carryover in this column, and the 2nd column must have carryover.

Returning to the 4th column (which has no carryover from the 3rd), we must have S + 1 = 10,
which means S = 9.

Now we know 1 + E = N, and there must be carryover from the 2nd column. So we have two
cases: N + R = E + 10, or N + R + 1 = E + 10. We can substitute 1 + E = N in both cases to
get (1 + E) + R = E + 10 –> R = 9 (but 9 is already taken), or we have 1 + E + R + 1 = E + 10
–> R = 8. So we must have R = 8.
Now in the units column D + E = Y, and it must have carryover. Since Y cannot be 0 or 1, we
need D + E ≥ 12. Since 9 and 8 are taken for S and R, we can have 5 + 7 = 12 or 6 + 7 = 13.
So either D = 7 or E = 7.

If E = 7, then E + 1 = N so N = 8–which is not possible since R = 8. So we must have D = 7,


meaning E is either 5 or 6.

If E = 6, then N = 7 which is not possible as D = 7. So we must have E = 5 and N = 6. This


means D + E = 7 + 5 = 12, and thus Y = 2.

So we have solved for all the letters!

SEND + MORE

9567 + 1085 = 10652.

Solution: S = 9, E = 5, N = 6, D = 7, M = 1, O = 0, R = 8, and Y = 2.

Q: Explain the constraint satisfaction procedure to solve the


cryptarithmetic problems.
 Variables: the letters
 Possible values: {0,1,2,3,4,5,6,7,8,9}
 Constraints: all letters have different values, addition works as intended,
leading digits aren't zero

Each of the different letters stands for a different digit. The aim is to find a
substitution of digits for the letters such that the above equality is arithmetically
correct.

SOULTION: C=9, R=6, 0=2, S=3, A=5, D=1, N=8, G=7, E=4
TRY TO SOLVE THE PROBLEMS STEP BY STEP

You might also like