×

Cryptarithmetic Problem in AI

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 other symbols. 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.

We can perform all the arithmetic operations on a given cryptarithmetic problem.

The rules or constraints on a cryptarithmetic problem are as follows:

  • There should be a unique digit to be replaced with a unique alphabet.
  • The result should satisfy the predefined arithmetic rules, i.e., 2+2 =4, nothing else.
  • Digits should be from 0-9 only.
  • There should be only one carry forward, while performing the addition operation on a problem.
  • The problem can be solved from both sides, i.e., lefthand side (L.H.S), or righthand side (R.H.S)

Let’s understand the cryptarithmetic problem as well its constraints better with the help of an example:

  • Given a cryptarithmetic problem, i.e., S E N D + M O R E = M O N E Y
Send More money

In this example, add both terms S E N D and M O R E to bring M O N E Y as a result.

Follow the below steps to understand the given problem by breaking it into its subparts:

  • Starting from the left hand side (L.H.S) , the terms are S and M. Assign a digit which could give a satisfactory result. Let’s assign S->9 and M->1.
cryptarithmetic problem

Hence, we get a satisfactory result by adding up the terms and got an assignment for O as O->0 as well.

  • Now, move ahead to the next terms E and O to get N as its output.
move ahead to the next terms E and O to get N

Adding E and O, which means 5+0=0, which is not possible because according to cryptarithmetic constraints, we cannot assign the same digit to two letters. So, we need to think more and assign some other value.

Adding E and O

Note: When we will solve further, we will get one carry, so after applying it, the answer will be satisfied.                       

  • Further, adding the next two terms N and R we get,
next two terms N and R

But, we have already assigned E->5. Thus, the above result does not satisfy the values

because we are getting a different value for E. So, we need to think more.                           

Again, after solving the whole problem, we will get a carryover on this term, so our answer will be satisfied.        

after solving the whole problem

            where 1 will be carry forward to the above term

Let’s move ahead.

  • Again, on adding the last two terms, i.e., the rightmost terms D and E, we get Y as its result.
rightmost terms D and E, we get Y as its result

                    where 1 will be  carry forward to the above term

  • Keeping all the constraints in mind, the final resultant is as follows:
Keeping all the constraints
  • Below is the representation of the assignment of the digits to the alphabets.
representation of the assignment of the digits to the alphabets

More examples of cryptarithmatic problems can be:

examples of cryptarithmatic problems
we can also perform multiplication on the cryptarithmatic problem.

Similarly, we can also perform multiplication on the cryptarithmatic problems.


Related Topics

Gradient Descent

Gradient Descent When training a neural network, an algorithm is used to minimize the loss. This algorithm is called as Gradient Descent. And loss refers to the incorrect outputs given by...

6 minutes read.

Backward Chaining in AI: Artificial Intelligence

Backward Chaining is a backward approach which works in the backward direction. It begins its journey from the back of the goal. Like, forward chaining, we have backward chaining for Propositional logic as...

6 minutes read.

Quantifying Uncertainty

The concept of quantifying uncertainty relies on how an agent can keep away uncertainty with a degree of belief. The term uncertainty refers to that situation or information which is either unknown or...

5 minutes read.

Alpha-beta Pruning | Artificial Intelligence

Alpha-beta pruning is an advance version of MINIMAX algorithm. The drawback of minimax strategy is that it explores each node in the tree deeply to provide the best path among all the...

3 minutes read.

Top 7 Artificial Intelligence and Machine Learning trends for 2024

Artificial Intelligence is the ability of machines to perform the same function as human beings, like problem-solving, learning, reasoning and recognizing. Machine Learning is another branch of Computer Science and...

6 minutes read.

Hill Climbing Algorithm in AI

Hill Climbing Algorithm: Hill climbing search is a local search problem. The purpose of the hill climbing search is to climb a hill and reach the topmost peak/ point of...

4 minutes read.

8 best topics for research and thesis in artificial intelligence

AI, abbreviated as Artificial Intelligence, is a field which has a long history. Artificial Intelligence is the ability of machines that perform the same function as human beings, like problem-solving,...

3 minutes read.

Dynamic Routing

Dynamic Routing Dynamic routing is used to update the routing table and find networks on the routers. It is easier than static routing and default routing, but it is more expensive in terms of...

3 minutes read.

Adversarial Search in Artificial Intelligence

AI Adversarial search: Adversarial search is a game-playing technique where the agents are surrounded by a competitive environment. A conflicting goal is given to the agents (multiagent). These agents compete...

3 minutes read.

Artificial Intelligence Tutorial | AI Tutorial

Today, Artificial Intelligence (AI) has become the norm of how humans communicate with and understand technology. Even though you've been hearing this buzzword now and then, do you know what...

6 minutes read.

Probabilistic Reasoning

Probabilistic Reasoning Probabilistic Reasoning is the study of building network models which can reason under uncertainty, following the principles of probability theory. Bayesian Networks Bayesian network is a data structure which is used to represent the dependencies among variables....

7 minutes read.

Reinforcement Learning in AI

Reinforcement Learning in AI Reinforcement LearningMarkov’s Decision ProcessQ leaningGreedy Decision MakingNIM GameNIM Game Implementation with Python Reinforcement Learning Reinforcement Learning is about learning from experience, where agents are given a set of rewards...

15 minutes read.

Inference in First-order Logic

Inference in First-order Logic While defining inference, we mean to define effective procedures for answering questions in FOPL. FOPL offers the following inference rules: Inference rules for quantifiersUniversal Instantiation (UI): In this, we can infer any sentence by...

5 minutes read.

5 algorithms that demonstrate artificial intelligence bias

Unfortunately, in the machine learning algorithm, AI bias is the output due to the prejudiced assumption made due to the algorithm development process. AI systems have biases due to the...

3 minutes read.

Inference Rules in Proposition Logic

Inference rules are those rules which are used to describe certain conclusions. The inferred conclusions lead to the desired goal state. In propositional logic, there are various inference rules which can be applied to...

3 minutes read.

Knowledge Representation in AI

In this section, we will understand how to represent the knowledge in the form which could be understood by the knowledge-based agents. The knowledge that is stored in the system is related to...

5 minutes read.

Hidden Markov Models

Hidden Markov Model is a partially observable model, where the agent partially observes the states. This model is based on the statistical Markov model, where a system being modeled follows the Markov process...

4 minutes read.

Problem-solving in Artificial Intelligence

The reflex agents are known as the simplest agents because they directly map states into actions. Unfortunately, these agents fail to operate in an environment where the mapping is too large to...

7 minutes read.

Differences in Artificial Intelligence

Difference between Intelligence and Artificial Intelligence Intelligence Artificial Intelligence It is a natural process or quality given to human beings. ...

3 minutes read.

Artificial Satellites

Many objects like stars, satellites and the moon are visible in the night sky. Satellites are objects revolving around the planet or a more significant object. Moon is the most...

6 minutes read.