0% found this document useful (0 votes)
64 views12 pages

Cryptarithmetic Problem

Cryptarithmetic problems are a type of constraint satisfaction problem where digits are replaced with letters or symbols. The task is to substitute digits for letters while satisfying arithmetic rules and ensuring unique replacements. An example problem is solved step-by-step to demonstrate assigning values to letters to make the addition equations correct. The constraints and solving techniques for cryptarithmetic problems are also outlined.

Uploaded by

Charis Oneyemi
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)
64 views12 pages

Cryptarithmetic Problem

Cryptarithmetic problems are a type of constraint satisfaction problem where digits are replaced with letters or symbols. The task is to substitute digits for letters while satisfying arithmetic rules and ensuring unique replacements. An example problem is solved step-by-step to demonstrate assigning values to letters to make the addition equations correct. The constraints and solving techniques for cryptarithmetic problems are also outlined.

Uploaded by

Charis Oneyemi
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/ 12

Constraint satisfaction problem

(Cont.)

Cryptarithmetic Problem
Cryptarithmetic Problem
• Cryptarithmetic Problem is a type of constraint satisfaction problem where the game
is about digits and its unique replacement either with alphabets or symbols.

• It is a class of mathematical puzzles in which the letters are replaced by a unique digit

• In cryptarithmetic problem, the digits (0-9) get substituted by some possible


alphabets or symbols.

• The task in cryptarithmetic problem is to substitute each digit with an alphabet to


get the result arithmetically correct.

2
Cryptarithmetic Problem (Cont.)
• The constraints on a cryptarithmetic problem are as follows:

• There should be a unique digit to be replaced with a unique alphabet.(No two alphabets must
have same value)

• The result should satisfy the predefined arithmetic rules, i.e., 2+2 =4, nothing else.

• Digits must range from 0 – 9 (Digits should be from 0-9 only).

• There should be only one carry forward, while performing the addition operation on a
problem.

• Sum of digits must be as shown in the problem

• The problem can be solved from both sides, i.e., left hand side or right-hand side 3
Cryptarithmetic Problem Example
• Given a cryptarithmetic problem e.g. BASE + BALL = GAMES
• If BASE + BALL = GAMES, then what is the sum of G +A + M + E + S
• BA S E
• + BA L L Letter Digits
• GA M E S B
• Each of the terms have 4 digits but their sum has 5 digits A
• What is the value of G S
• The values to assign are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
E
• G is allocated to 1(Basic principle, first letter to the left must be 1)
L
• B + B = A (G, A must be >= 10)
• B + B >= 10 G 1
• 2B >= 10 M
• B >= 5 4
Cryptarithmetic Problem Example (Cont.)
• if B >= 5
• Hence B value can either be 5, 6, 7, 8, or 9
• Starting from the left hand side, the terms are B and B. Assign a digit which could give a
satisfactory result. Let’s assign B ⇒ 9 , 9 + 9 = 18, i.e. B + B = A write 8 carry 1
• Adding :
• BA S E
• + BA L L
• G AMES
• and then substitute 8 for A and the add to get M, 8 + 8 = 16 write down 6 and carry 1.
• Since it has been established earlier that B = 9, therefore, 9 + 9 + 1 = 19, but B + B ≠ 19,
write 9 carry 1
• hence B can not be = 9
• Then try the next value, B = 8, 8 + 8 = 16, i.e. B + B = A 5
Cryptarithmetic Problem Example (Cont.)
• write 6 carry 1
• Substitute the value of A (6) into the initial question and add, A + A = M (6 + 6 = 12)
• Write down 2, carry 1, add carry 1 to the value of B (8 + 8 + 1 = 17) write down 7 carry
1, but B + B = A and A ≠ 7
• Therefore, B ≠ 8
• Then try the next value, B = 7, 7 + 7 = 14, write down 4 carry 1
• B + B = A, if A = 4,
• Substitute the value of A (4) into the initial question and add, A + A = M (4 + 4 = 8)
• B is allocated to 7 and
• A is allocated to 4
• 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• G A L B 6
Cryptarithmetic Problem Example (Cont.)
• 74S E
• +74LL Letter Digits
• 14MES B 7
• From the right hand side, E + L = S ……………….(1) A 4
• If E + L < 10, then, value = S, or S
• E + L = S + 10……………..(2) E
• But if the E + L > 10, carry 1 and add to S + L
L
• also
G 1
• S + L = E ………………….(3) or
M
• S + L = E + 10………….(4)
• Substitute the value of S from (1) into (4)
• S + L = E + 10 7
Cryptarithmetic Problem Example (Cont.)
• E + L + L= E + 10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• 2L = 10
G A L B
• L=5
• Then substitute the value of L into (1) and (3), Letter Digits
• E + L = S ………….(1) B 7
• S + L = E…………..(3) A 4
• Then initial equation become, S
• 74SE+
E
• 7455
• 14MES L 5
• Hence, G 1
• E + 5 = S…………….(5) M
• S + 5 = E……………..(6) 8
Cryptarithmetic Problem Example (Cont.)
• The difference between S and E is 5
• All the possible cases to get 5 are
• (5, 0), (6, 1) (7, 2) (8, 3) (9, 4) but which of these peers satisfy the conditions
• (5, 0), does not satisfy the condition, 5 ⇒ L
• (6, 1), does not satisfy the condition, 1 ⇒ G
• (7, 2), does not satisfy the condition, 7 ⇒ B
• (8, 3) has not been assigned
• (9, 4), does not satisfy the condition, 4 ⇒ A
• Then substitute S = 8, E = 3 into (5) and then the initial equation
• E+5=S
• 3+5=8
9
Cryptarithmetic Problem Example (Cont.)
• 7483+
Letter Digits
• 7455
B 7
• 14938 BA S E
• 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 + BA L L A 4
• G E A L B S M G +A+ M+ E +S S 8
• G +A + M + E + S E 3
•1 4 9 3 8 L 5
G 1
M 9

10
Cryptarithmetic Problem Example (Cont.)
• Given T O + G O = OUT, find the sum and hence solution to the question.
• T O
• + G O
• =OU T
• Left most letter will always be allocated or assigned to 1
Letter Digits
• If O ⇒ 1, then
• T O
T 2
• + G O
• =OU T
O 1
• 21 G
• G1 U
• =1U2
• 2 + G = U +10 11
Cryptarithmetic Problem Example (Cont.)
• If G ⇒ 9, then 2 + 9 = 11, this does not satisfy the condition,
• If G ⇒ 8, then 2 + 8 = 10, then write down 0 and carry 1
• Therefore, G ⇒ 8, and U ⇒ 0
Letter Digits
2 1 T 2
+8 1
O 1
=102
G 8
U 0

12

You might also like