SlideShare a Scribd company logo
3
Most read
4
Most read
9
Most read
Cryptarithmetic Problem
Lecture-13
Hema Kashyap
1
Cryptarithmetic Problem
“It is an arithmetic problem which is represented in letters. It
involves the decoding of digit represented by a character. It is in
the form of some arithmetic equation where digits are distinctly
represented by some characters. The problem requires finding of
the digit represented by each character. Assign a decimal digit to
each of the letters in such a way that the answer to the problem is
correct. If the same letter occurs more than once, it must be
assigned the same digit each time. No two different letters may be
assigned the same digit”.
2
Procedure
• Cryptarithmatic problem is an interesting constraint satisfaction problem
for which different algorithms have been developed. Cryptarithm is a
mathematical puzzle in which digits are replaced by letters of the alphabet
or other symbols. Cryptarithmatic is the science and art of creating and
solving cryptarithms.
• The different constraints of defining a cryptarithmatic problem are as
follows.
1) Each letter or symbol represented only one and a unique digit throughout the problem.
2) When the digits replace letters or symbols, the resultant arithmetical operation must be
correct.
• The above two constraints lead to some other restrictions in the problem.
3
Example
• Consider that, the base of the number is 10. Then there must be at most 10
unique symbols or letters in the problem. Otherwise, it would not possible to
assign a unique digit to unique letter or symbol in the problem. To be semantically
meaningful, a number must not begin with a 0. So, the letters at the beginning of
each number should not correspond to 0. Also one can solve the problem by a
simple blind search. But a rule based searching technique can provide the solution
in minimum time.
4
Step 1
• In the above problem, M must be 1. You can visualize that, this is an
addition problem. The sum of two four digit numbers cannot be more than
10,000. Also M cannot be zero according to the rules, since it is the first
letter.
5
Step 2
• Now in the column s10, s+1 ≥ 10. S must be 8 because there is a 1 carried
over from the column EON or 9. O must be 0 (if s=8 and there is a 1
carried or s = 9 and there is no 1 carried) or 1 (if s=9 and there is a 1
carried). But 1 is already taken, so O must be 0.
6
Step 3
• There cannot be carry from column EON because any digit +0 < 10, unless
there is a carry from the column NRE, and E=9; But this cannot be the case
because then N would be 0 and 0 is already taken. So E < 9 and there is no
carry from this column. Therefore S=9 because 9+1=10.
7
Step 4
• In the column EON, E cannot be equal to N. So there must
be carry from the column NRE; E+1=N. We now look at the
column NRE, we know that E+1=N. Since we know that
carry from this column, N+R=1E (if there is no carry from
the column DEY) or N+R+1=1E (if there is a carry from the
column DEY).
• Let us see both the cases:
– No carry: N +R =10 +(N- 1)= N + 9
– R = 9
• But 9 is already taken, so this will not work
– Carry: N +R + 1= 9
– R = 9 – 1= 8 This must be solution for R
8
Step 5
• Now just think what are the digits we have left? They are 7, 6, 5,
4, 3 and 2. We know there must be a carry from the column DEY.
So D+E>10.N = E+1, So E cannot be 7 because then N would be
8 which is already taken. D is almost 7, so E cannot be 2 because
then D +E <10 and E cannot be 3 because then D+E=10 and
Y=0, but 0 is already taken. Also E cannot be 4 because if D
>6,D+E<10 and if D=6 or D=7 then Y=0 or Y=1, which are both
taken. So E is 5 or 6.
• If E=6, then D=7 and Y=3. So this part will work but look the
column N8E. Point that there is a carry from the column
D5Y.N+8+1=16(As there is a carry from this column). But then
N=7 and 7 is taken by D therefore E=5.
9
Step 6
• Now we have gotten this important digit, it
gets much simpler from here
N+8+1=15, N=6
10
Step 7
• The digits left are 7, 4, 3 and 2. We know there
is carry from the column D5Y, so the only pair
that works is D=7 and Y= 2.
Which is final solution of this problem.
11

More Related Content

PDF
Problem Characteristics in Artificial Intelligence
PPTX
PDF
Lab report for Prolog program in artificial intelligence.
PPTX
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
PPT
Data representation
PPTX
Truth management system
PDF
Data Mining & Data Warehousing Lecture Notes
PPT
Data structures & problem solving unit 1 ppt
Problem Characteristics in Artificial Intelligence
Lab report for Prolog program in artificial intelligence.
Constraint Satisfaction Problem (CSP) : Cryptarithmetic, Graph Coloring, 4- Q...
Data representation
Truth management system
Data Mining & Data Warehousing Lecture Notes
Data structures & problem solving unit 1 ppt

What's hot (20)

PPT
Np cooks theorem
PPTX
Pigeon hole principle
PPTX
Backtracking
PPT
Problems, Problem spaces and Search
DOC
Chapter 4 (final)
PPTX
String matching algorithms
PPTX
First and follow set
PPTX
8 queens problem using back tracking
PPTX
Hashing
PPTX
Problem solving agents
PPTX
Pigeonhole Principle
PPT
Heuristic Search Techniques {Artificial Intelligence}
PPTX
Knapsack Problem
PPTX
Lecture 16 memory bounded search
PPTX
Sum of subset problem.pptx
PPT
Trees
PPTX
Dynamic programming
PDF
Functions in discrete mathematics
PPT
BackTracking Algorithm: Technique and Examples
PPT
predicate logic example
Np cooks theorem
Pigeon hole principle
Backtracking
Problems, Problem spaces and Search
Chapter 4 (final)
String matching algorithms
First and follow set
8 queens problem using back tracking
Hashing
Problem solving agents
Pigeonhole Principle
Heuristic Search Techniques {Artificial Intelligence}
Knapsack Problem
Lecture 16 memory bounded search
Sum of subset problem.pptx
Trees
Dynamic programming
Functions in discrete mathematics
BackTracking Algorithm: Technique and Examples
predicate logic example
Ad

Viewers also liked (19)

PPTX
Lecture 17 Iterative Deepening a star algorithm
DOC
Chapter 2 (final)
PPTX
Expressions and equations with cryptarithmetic
PPTX
Lecture 05 problem solving through ai
PPT
Problem space
PPTX
Lecture 12 Heuristic Searches
PPT
State Space Search(2)
PPT
Lecture 11 Informed Search
PPT
Artificial intelligence
PPTX
Lecture 14 Heuristic Search-A star algorithm
PDF
16890 unit 2 heuristic search techniques
PPT
Breadth first search
PPTX
Lecture 11 informed consent to treatment
PPT
Alpha beta prouning
PPTX
AI: AI & Problem Solving
PPTX
Minimax
PPT
Amit ppt
PPTX
Knowledge representation and Predicate logic
PPT
Knowledge Representation in Artificial intelligence
Lecture 17 Iterative Deepening a star algorithm
Chapter 2 (final)
Expressions and equations with cryptarithmetic
Lecture 05 problem solving through ai
Problem space
Lecture 12 Heuristic Searches
State Space Search(2)
Lecture 11 Informed Search
Artificial intelligence
Lecture 14 Heuristic Search-A star algorithm
16890 unit 2 heuristic search techniques
Breadth first search
Lecture 11 informed consent to treatment
Alpha beta prouning
AI: AI & Problem Solving
Minimax
Amit ppt
Knowledge representation and Predicate logic
Knowledge Representation in Artificial intelligence
Ad

Similar to Lecture 13 Criptarithmetic problem (20)

PPTX
Vedic part 1
PDF
Ai lecture 13(unit02)
PDF
C5 5.1
PPTX
Multiplication The Complement Method
PDF
500 most asked apti ques in tcs, wipro, infos(105pgs)
DOC
Digital logic circuits important question and answers for 5 units
PPT
Everyday Math And Algorithms Ppt July 06
PPT
Vedic mathematicss-R.SANKAR
PPT
Vedic mathematicss by SANKAR
PDF
DLD solutions.pdf digital logic design book
PDF
500 questions.pdf
PDF
Course project solutions 2019
PPTX
Insider mathematical
PPT
Fun with calculations
PPTX
Maa word math making letters into numbers ppt 12 24 2014
PDF
Crypt inst-guide
PPTX
Linear equations
PPTX
Computer arthtmetic,,,
PPTX
Computer arthtmetic,,,
PDF
Math for 800 03 real numbers
Vedic part 1
Ai lecture 13(unit02)
C5 5.1
Multiplication The Complement Method
500 most asked apti ques in tcs, wipro, infos(105pgs)
Digital logic circuits important question and answers for 5 units
Everyday Math And Algorithms Ppt July 06
Vedic mathematicss-R.SANKAR
Vedic mathematicss by SANKAR
DLD solutions.pdf digital logic design book
500 questions.pdf
Course project solutions 2019
Insider mathematical
Fun with calculations
Maa word math making letters into numbers ppt 12 24 2014
Crypt inst-guide
Linear equations
Computer arthtmetic,,,
Computer arthtmetic,,,
Math for 800 03 real numbers

More from Hema Kashyap (20)

PPTX
Lecture 30 introduction to logic
PPTX
Lecture 29 genetic algorithm-example
PPTX
Lecture 28 genetic algorithm
PPTX
Lecture 27 simulated annealing
PPTX
Lecture 26 local beam search
PPTX
Lecture 25 hill climbing
PPTX
Lecture 24 iterative improvement algorithm
PPTX
Lecture 23 alpha beta pruning
PPTX
Lecture 22 adversarial search
PPTX
Lecture 21 problem reduction search ao star search
PPTX
Lecture 20 problem reduction search
PPTX
Lecture 19 sma star algorithm
PPTX
Lecture 18 simplified memory bound a star algorithm
PPTX
Lecture 15 monkey banana problem
PPTX
Lecture 10 Uninformed Search Techniques conti..
PPTX
Lecture 09 uninformed problem solving
PPTX
Lecture 08 uninformed search techniques
PPTX
Lecture 07 search techniques
PPTX
Lecture 06 production system
PPTX
Lecture 04 intelligent agents
Lecture 30 introduction to logic
Lecture 29 genetic algorithm-example
Lecture 28 genetic algorithm
Lecture 27 simulated annealing
Lecture 26 local beam search
Lecture 25 hill climbing
Lecture 24 iterative improvement algorithm
Lecture 23 alpha beta pruning
Lecture 22 adversarial search
Lecture 21 problem reduction search ao star search
Lecture 20 problem reduction search
Lecture 19 sma star algorithm
Lecture 18 simplified memory bound a star algorithm
Lecture 15 monkey banana problem
Lecture 10 Uninformed Search Techniques conti..
Lecture 09 uninformed problem solving
Lecture 08 uninformed search techniques
Lecture 07 search techniques
Lecture 06 production system
Lecture 04 intelligent agents

Recently uploaded (20)

PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Well-logging-methods_new................
PPTX
Sustainable Sites - Green Building Construction
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
additive manufacturing of ss316l using mig welding
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPT
Project quality management in manufacturing
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Lecture Notes Electrical Wiring System Components
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Artificial Intelligence
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Foundation to blockchain - A guide to Blockchain Tech
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Well-logging-methods_new................
Sustainable Sites - Green Building Construction
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
additive manufacturing of ss316l using mig welding
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Project quality management in manufacturing
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
bas. eng. economics group 4 presentation 1.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Lecture Notes Electrical Wiring System Components
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
UNIT 4 Total Quality Management .pptx
Artificial Intelligence
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Operating System & Kernel Study Guide-1 - converted.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT

Lecture 13 Criptarithmetic problem

  • 2. Cryptarithmetic Problem “It is an arithmetic problem which is represented in letters. It involves the decoding of digit represented by a character. It is in the form of some arithmetic equation where digits are distinctly represented by some characters. The problem requires finding of the digit represented by each character. Assign a decimal digit to each of the letters in such a way that the answer to the problem is correct. If the same letter occurs more than once, it must be assigned the same digit each time. No two different letters may be assigned the same digit”. 2
  • 3. Procedure • Cryptarithmatic problem is an interesting constraint satisfaction problem for which different algorithms have been developed. Cryptarithm is a mathematical puzzle in which digits are replaced by letters of the alphabet or other symbols. Cryptarithmatic is the science and art of creating and solving cryptarithms. • The different constraints of defining a cryptarithmatic problem are as follows. 1) Each letter or symbol represented only one and a unique digit throughout the problem. 2) When the digits replace letters or symbols, the resultant arithmetical operation must be correct. • The above two constraints lead to some other restrictions in the problem. 3
  • 4. Example • Consider that, the base of the number is 10. Then there must be at most 10 unique symbols or letters in the problem. Otherwise, it would not possible to assign a unique digit to unique letter or symbol in the problem. To be semantically meaningful, a number must not begin with a 0. So, the letters at the beginning of each number should not correspond to 0. Also one can solve the problem by a simple blind search. But a rule based searching technique can provide the solution in minimum time. 4
  • 5. Step 1 • In the above problem, M must be 1. You can visualize that, this is an addition problem. The sum of two four digit numbers cannot be more than 10,000. Also M cannot be zero according to the rules, since it is the first letter. 5
  • 6. Step 2 • Now in the column s10, s+1 ≥ 10. S must be 8 because there is a 1 carried over from the column EON or 9. O must be 0 (if s=8 and there is a 1 carried or s = 9 and there is no 1 carried) or 1 (if s=9 and there is a 1 carried). But 1 is already taken, so O must be 0. 6
  • 7. Step 3 • There cannot be carry from column EON because any digit +0 < 10, unless there is a carry from the column NRE, and E=9; But this cannot be the case because then N would be 0 and 0 is already taken. So E < 9 and there is no carry from this column. Therefore S=9 because 9+1=10. 7
  • 8. Step 4 • In the column EON, E cannot be equal to N. So there must be carry from the column NRE; E+1=N. We now look at the column NRE, we know that E+1=N. Since we know that carry from this column, N+R=1E (if there is no carry from the column DEY) or N+R+1=1E (if there is a carry from the column DEY). • Let us see both the cases: – No carry: N +R =10 +(N- 1)= N + 9 – R = 9 • But 9 is already taken, so this will not work – Carry: N +R + 1= 9 – R = 9 – 1= 8 This must be solution for R 8
  • 9. Step 5 • Now just think what are the digits we have left? They are 7, 6, 5, 4, 3 and 2. We know there must be a carry from the column DEY. So D+E>10.N = E+1, So E cannot be 7 because then N would be 8 which is already taken. D is almost 7, so E cannot be 2 because then D +E <10 and E cannot be 3 because then D+E=10 and Y=0, but 0 is already taken. Also E cannot be 4 because if D >6,D+E<10 and if D=6 or D=7 then Y=0 or Y=1, which are both taken. So E is 5 or 6. • If E=6, then D=7 and Y=3. So this part will work but look the column N8E. Point that there is a carry from the column D5Y.N+8+1=16(As there is a carry from this column). But then N=7 and 7 is taken by D therefore E=5. 9
  • 10. Step 6 • Now we have gotten this important digit, it gets much simpler from here N+8+1=15, N=6 10
  • 11. Step 7 • The digits left are 7, 4, 3 and 2. We know there is carry from the column D5Y, so the only pair that works is D=7 and Y= 2. Which is final solution of this problem. 11