A cryptarithmetic puzzle is an equation with words whose letters represent decimals digits.
Questions tagged [cryptarithmetic-puzzle]
63 questions
7
votes
6 answers
Faster implementation of verbal arithmetic in Prolog
I already made a working generalized verbal arithmetic solver in Prolog but it's too slow. It takes 8 minutes just to run the simple expression S E N D + M O R E = M O N E Y. Can someone help me make it run faster?
/*…

user974036
- 91
- 1
- 5
6
votes
2 answers
Cryptogram Puzzle with Prolog CLPFD
I recently found a small game on the Google Play app store called Cryptogram. There are dozens of apps similar to this one. The idea is to match the number to the colors such that all of the equations sound true.
I was able to get through problems…

bananafacts
- 163
- 6
6
votes
1 answer
Get one of many possible solutions in Prolog
I'm trying to learn Prolog. I looked at this script:
:- use_module(library(clpfd)).
puzzle([S,E,N,D] + [M,O,R,E] = [M,O,N,E,Y]) :-
Vars = [S,E,N,D,M,O,R,Y],
Vars ins 0..9,
all_different(Vars),
S*1000 + E*100 + N*10 + D + M*1000 + O*100…

Jesse Aldridge
- 7,991
- 9
- 48
- 75
6
votes
7 answers
A more efficient approach to Verbal arithmetic / Alphametics?
Perhaps most of you know the Send + More = Money. Well, I'm currently learning java and one of the exercises is I have to solve HES + THE = BEST.
Now, so far I can/should use if-for-while-do loops, nothing else. Although I'm sure there are different…

Grumpy ol' Bear
- 725
- 3
- 15
- 27
6
votes
3 answers
Making a cryptaritmetic solver in C++
I am planning out a C++ program that takes 3 strings that represent a cryptarithmetic puzzle. For example, given TWO, TWO, and FOUR, the program would find digit substitutions for each letter such that the mathematical expression
TWO
+ TWO…

norman
- 5,128
- 13
- 44
- 75
6
votes
2 answers
Solving a Crypt-Arithmetic Puzzle with Relational Database
Say you are given the crypt-arithmetic puzzle:
SEND + MORE = MONEY
The goal is to substitute numbers (0-9) for letters, so that the addition works out.
I understand how to approach the problem mathematically, but I am not sure how to solve this…

wilco
- 406
- 4
- 18
5
votes
5 answers
Efficient way of Solving Cryptarithms
Hi i came across this puzzle which is a subset of famous kind of word and numbers based puzzles called Cryptarithms. Say you have an expression as
S E N D + M O R E = M O N E Y
Now the interesting part there is that, each alphabet is representing…

Anirudh Goel
- 4,571
- 19
- 79
- 109
5
votes
2 answers
Prolog Cryptarithmetic Puzzle
I have been asked to solve a Cryptarithmetic Puzzle using Prolog:
GIVE
* ME
------
MONEY
The above is the puzzle, I cannot figure out where is the problem, the result always returns false. Plus I am not allowed to use any library in…

kyo
- 53
- 4
5
votes
4 answers
How to Solve Cryptarithmetic Puzzle in Prolog
I have to write a Prolog program for solving a cryptarithmetic puzzle.
I need to write a function solve([A, M, P, D, Y]) which assigns the variables [A, M, P, D, Y] to values from 0 to 9 so that it satisfies the equation AM+PM=DAY. Each variable is…

codergirl
- 53
- 1
- 4
4
votes
1 answer
Using apply in core.logic Clojure (CLP) Cryptoarithmetic
(ns verbal-arithmetic
(:require
[clojure.core.logic :refer [all run* everyg lvar == membero fresh conde succeed fail conso resto]]
[clojure.core.logic.fd :as fd]))
(comment
"Solving cryptarithmetic puzzle"
" SEND
+ MORE
______
…

Clojurevangelist
- 564
- 1
- 8
- 13
4
votes
2 answers
Prolog "singleton variable" warning
I keep getting a "singleton variable for [WMAPDY]" warning. I read somewhere that sometimes that warning is useless. I also read that the program will not compile all the clauses because of the warning?
The program I'm trying to do is a…

NoobCoderChick
- 617
- 3
- 21
- 40
4
votes
1 answer
Cryptarithmetic puzzle (Prolog)
I was asked to write a Prolog code to solve the cryptarithmetic puzzle, using "generate and test". For example I get solve([R,O,B],[B,E,R,T],[N,O,R,E,S]) and I need to find an assign for the letters.
So I wrote this code:
sum(List1,List2,SumList)…

Ygandelsman
- 453
- 7
- 16
3
votes
3 answers
Using Prolog to solve a brain teaser (Master Mind)
A friend from work shared this with our whatsapp group:
This lock has a 3 digit code.
Can you guess it using only these hints?
We solved it using something akin to a truth table. I'm curious however, how would this be solved in Prolog?

haroldcampbell
- 1,512
- 1
- 14
- 22
3
votes
3 answers
Efficiency of Cryptarithmetic Algorithm solver decomposition
The problem is the following: Given "ABC+DEF=GHI" format string, where A,B,C etc. represent unique digits, find the expression that gives maximum GHI. Ex: Input string is AAB+AAB=AAB, then there's no solution. If it is instead AAA + BBB = AAA, a…

SenselessCoder
- 1,139
- 12
- 27
3
votes
2 answers
Cryptarithmetic Multiplication Prolog
I have the grasp of the idea of crypt arithmetic and addition but I cannot figure out how to do a multiplication crypt arithmetic problem. It's simply TWO*SIX=TWELVE or something along those lines without the middle additional part of the…

user2318083
- 567
- 1
- 8
- 27