WEBVTT
00:00:01.430 --> 00:00:04.650
In this video, we’re going to learn about cryptarithmetic puzzles.
00:00:04.950 --> 00:00:07.310
Some people call them cryptarithms or alphametics.
00:00:07.510 --> 00:00:13.580
But they’re a type of puzzle which involves thinking critically about alphabetic characters in arithmetic calculations.
00:00:14.650 --> 00:00:20.670
It’s generally thought that cryptarithmetic was invented a long time ago in China and called letter arithmetic or verbal arithmetic.
00:00:21.600 --> 00:00:28.600
Many similar puzzles also appeared in India during the Middle Ages, with calculations being presented with many missing digits represented by dots.
00:00:28.970 --> 00:00:31.230
And the challenge was to find the missing digits.
00:00:32.270 --> 00:00:36.980
For example, in this division puzzle, all the digits except sevens have been replaced by dots.
00:00:37.250 --> 00:00:38.710
And you have to fill in all the blanks.
00:00:38.870 --> 00:00:41.250
And there’s only one unique solution that works.
00:00:42.000 --> 00:00:43.090
So that’s quite tricky.
00:00:44.190 --> 00:00:50.570
Now, a bit of a refinement to this type of puzzle was to put different symbols or letters to represent each unique digit in the calculation.
00:00:50.570 --> 00:00:53.670
For example, this one here, ABC times DE.
00:00:54.050 --> 00:00:55.500
And then we’ve got the calculation below it.
00:00:55.850 --> 00:00:58.200
In this form, each letter represents a digit.
00:00:58.420 --> 00:01:03.580
And we know, for example, wherever we see the letter C, it will always be replacing the same digit in this particular puzzle.
00:01:05.060 --> 00:01:08.510
Another development was to pick the letters carefully so that they spelt words.
00:01:08.860 --> 00:01:12.300
And ideally, they had some kind of relationship to each other as they were written.
00:01:12.740 --> 00:01:20.980
A great example of this was the puzzle set by Henry Dewdney in Strand Magazine in 1924, SEND plus MORE equals MONEY.
00:01:21.410 --> 00:01:25.980
The back story was that it was a telegram sent by a son to his parents when he run out of money at college.
00:01:27.280 --> 00:01:29.710
Now, this is the sort of puzzle that we’re gonna talk about.
00:01:30.060 --> 00:01:37.730
And as well as restricting ourselves to puzzles that have apparently meaningful words in them, there’re a few extra rules that also apply to this sort of cryptarithmetic.
00:01:39.170 --> 00:01:42.810
Each letter corresponds consistently to a different digit from zero to nine.
00:01:43.210 --> 00:01:46.740
So for example, S could represent five, M could represent one, and so on.
00:01:47.040 --> 00:01:50.620
But it wouldn’t be allowed to have the same digit represented by two different letters.
00:01:50.790 --> 00:01:54.070
So we couldn’t have both S and M representing the digit one.
00:01:55.490 --> 00:01:58.510
Each letter is always used to represent the same digit in the puzzle.
00:01:58.640 --> 00:02:03.450
For example, E appears three times in this puzzle and must represent the same digit in each case.
00:02:04.500 --> 00:02:06.940
No number in the puzzle is allowed to have a leading zero.
00:02:07.160 --> 00:02:10.980
So neither S nor M here could represent the digit zero.
00:02:12.240 --> 00:02:14.520
We’re also only gonna talk about addition of two numbers.
00:02:14.600 --> 00:02:16.870
You can make puzzles with more than two numbers added together.
00:02:16.870 --> 00:02:19.360
Or you can rearrange them to make a subtraction calculation.
00:02:19.570 --> 00:02:20.680
But we’re not gonna consider that.
00:02:21.700 --> 00:02:28.780
To be strict about it, we’ll also consider a proper cryptarithmetic puzzle to have just one unique solution, although some puzzle writers don’t enforce this rule.
00:02:30.390 --> 00:02:34.040
The process of solving cryptarithms isn’t a matter of just following a simple formula.
00:02:34.040 --> 00:02:37.630
It requires a bit of reasoning, some trial and error, and a lot of perseverance.
00:02:38.010 --> 00:02:42.020
Let’s go through and solve the SEND plus MORE equals MONEY problem together to see how it could be done.
00:02:42.250 --> 00:02:42.960
There are other ways.
00:02:42.990 --> 00:02:46.220
But hopefully the techniques we talk about will help you to solve your puzzles.
00:02:47.620 --> 00:02:54.530
Of course, if you can write a bit of computer code, then it’s pretty straightforward to put together a simple program that tries out all the possibilities to find the right one.
00:02:55.560 --> 00:03:07.600
I wrote this one in Python and deliberately made it run through every possibility without trying to make it more efficient, just to see how long it took — just under two minutes by the way, although my equivalent QB64 version took just 0.7 seconds.
00:03:08.650 --> 00:03:16.570
For example, I didn’t eliminate S equal zero and M equal zero for my inquiries, which meant it came out with 24 unacceptable answers in which M was equal to zero.
00:03:17.840 --> 00:03:25.870
I also didn’t make any other efficiencies such as realizing that M must be equal to one because you can’t carry more than one when adding two numbers, but more of that later.
00:03:27.150 --> 00:03:39.140
Then with the letters S, E, N, D, M, O, R, and Y, each having 10 possible values, zero to nine, that makes a total of 10 to the power of eight combinations to try, a 100 million combinations.
00:03:39.430 --> 00:03:41.950
Imagine taking that approach by hand, it would take forever.
00:03:43.480 --> 00:03:48.310
Anyway, now let’s go through a few things that you can check to help you solve this puzzle manually.
00:03:49.650 --> 00:03:52.480
First thing, make a list of all the unique letters in your puzzle.
00:03:52.790 --> 00:03:57.710
We can make a table of their possible values from zero to nine and cross them off as we eliminate all the possibilities.
00:03:58.800 --> 00:04:01.700
For example, we said none of the leading digits can be zero.
00:04:01.700 --> 00:04:04.440
So S and M can’t be zero.
00:04:04.440 --> 00:04:05.530
So we can cross them off.
00:04:06.230 --> 00:04:08.880
Now, there are some other quick ways to cross off a few numbers.
00:04:10.100 --> 00:04:12.030
For example, if we had something like this.
00:04:12.310 --> 00:04:17.420
We’ve got the same letter A in the ones column twice.
00:04:17.680 --> 00:04:20.520
And the result has got the same digit in that column as well.
00:04:20.800 --> 00:04:23.740
The only possibility is that A is equal to zero.
00:04:24.640 --> 00:04:26.340
Now, all the digits will work in that place.
00:04:27.090 --> 00:04:31.190
But, sadly in our problem, we don’t have the same letter in the ones column.
00:04:32.600 --> 00:04:34.120
So that’s not gonna be much use to us.
00:04:35.250 --> 00:04:41.330
What if we had the same letter in the ones column for the two numbers but then a different letter in the ones column for the answer?
00:04:42.230 --> 00:04:46.320
Then B would have to be even, 0, 2, 4, 6, or 8.
00:04:46.580 --> 00:04:50.250
But again that’s not gonna help us because that’s not the pattern we’ve got in our column.
00:04:51.270 --> 00:04:52.480
What if we had something like this?
00:04:52.740 --> 00:04:58.220
We had a letter here and in the same position in the answer and then a different letter here.
00:04:59.540 --> 00:05:03.890
Well, again, B must be equal to zero in order for this to be true.
00:05:04.260 --> 00:05:07.180
But again, that’s not gonna help us with our particular problem.
00:05:08.270 --> 00:05:09.440
Okay, what about this then?
00:05:09.470 --> 00:05:12.650
We’ve got the same letter in a column which isn’t the ones column.
00:05:14.030 --> 00:05:15.240
Well, we’ve got two possibilities.
00:05:15.270 --> 00:05:23.880
These two digits here might add up to something like 10 or 11 or 12 which creates a carry digit, a plus one, carried into that column.
00:05:24.060 --> 00:05:27.930
Or maybe they sum to a number less than 10, so there wouldn’t be a carry.
00:05:29.020 --> 00:05:36.070
Now if a one is carried into the column, then if A was equal to nine, we’d have nine plus nine is 18 plus the one carried in would be 19.
00:05:36.290 --> 00:05:38.370
We would have a nine in that digit place there.
00:05:38.880 --> 00:05:42.200
If there wasn’t a carry in, then A equals zero would work.
00:05:43.300 --> 00:05:47.350
Interesting, but again, it’s not gonna help us with our particular problem here.
00:05:48.780 --> 00:05:55.260
What about this situation where one of the digits in our sum also appears in the answer but not in the ones column?
00:05:56.370 --> 00:06:03.200
Now again, the ones column could sum to 10 or more and have a carry or maybe it doesn’t and doesn’t have a carry.
00:06:04.470 --> 00:06:10.390
Well, if we didn’t have any carry over, then A must be zero in order for something plus B to be equal to B.
00:06:10.710 --> 00:06:14.230
But if we did have a carry coming in, then A would have to be equal to nine.
00:06:14.340 --> 00:06:15.570
So there are two possibilities.
00:06:15.950 --> 00:06:16.970
But you guessed it again.
00:06:16.970 --> 00:06:19.220
It’s not actually gonna help us with our particular problem.
00:06:20.580 --> 00:06:24.990
Then we can consider slightly more complicated situations where our conclusions aren’t quite so clear cut.
00:06:24.990 --> 00:06:27.020
So for example, this one here.
00:06:27.310 --> 00:06:34.590
We know that the C can only be one, because when you add two numbers together the maximum carry you can get is one.
00:06:35.940 --> 00:06:39.100
And we also know that A plus B must be at least 10.
00:06:39.100 --> 00:06:42.400
So A plus B is greater than nine in order to generate that carry.
00:06:42.780 --> 00:06:55.510
But if we had carry from the ones column into this column, then A plus B could be equal to nine, because nine plus one equals 10 and that generates our carry into the hundreds column.
00:06:57.100 --> 00:06:59.210
Okay, and that’s not gonna help us with our particular problem.
00:06:59.210 --> 00:07:04.490
But it’s this sort of analysis, this style of analysis, that helps us to cross off certain possibilities from our grid.
00:07:05.610 --> 00:07:12.290
Now before we go back to SEND plus MORE equals MONEY, let’s do MOO plus MOO equals COW to pick up some more logic tips.
00:07:13.610 --> 00:07:17.250
We know we’re not allowed leading zeros so M and C can’t be zero.
00:07:18.240 --> 00:07:21.300
Then O plus O is equal to W.
00:07:22.480 --> 00:07:26.180
Or if that result is bigger than 10, then O plus O is equal to 10 plus W.
00:07:27.160 --> 00:07:32.240
Because with O plus O, we’re adding the same number to itself, we’re doubling that number, we know that W is even.
00:07:33.320 --> 00:07:37.490
And if we look at the next column, we see that O plus O is equal to O in this column.
00:07:38.380 --> 00:07:44.680
And that tells us that there must have been some carrying from the ones column in order for the result to be different.
00:07:46.220 --> 00:07:52.590
So now we know that O must be at least five to generate that carry and there must be carry over into the hundreds column.
00:07:54.100 --> 00:07:57.660
So O plus O in the ones column generates the W, which we said was even.
00:07:57.810 --> 00:08:03.040
When we carry one over and do O plus O plus one, O the result must be odd.
00:08:04.170 --> 00:08:08.530
And we also know that O plus O plus one gives a result ending in the digit O.
00:08:08.530 --> 00:08:09.490
So what could it be?
00:08:10.900 --> 00:08:13.660
Zero plus zero plus one is not equal to zero.
00:08:13.690 --> 00:08:15.870
One plus one plus one is not equal to one.
00:08:15.870 --> 00:08:18.080
Two plus two plus one is not equal to two.
00:08:18.570 --> 00:08:21.990
But nine plus nine plus one is equal to 19.
00:08:21.990 --> 00:08:23.400
So O must be nine.
00:08:24.560 --> 00:08:26.760
And we can replace all the Os with nines.
00:08:28.220 --> 00:08:32.780
Well, now that we know that O is nine, we know that M can’t be nine, W can’t be nine, and C can’t be nine.
00:08:32.780 --> 00:08:35.020
So if we’d make a grid, we’d be able to cross those off.
00:08:36.120 --> 00:08:42.160
But in fact, more importantly than that, here we know that W must be — nine plus nine is 18 — W must be eight.
00:08:43.370 --> 00:08:46.020
And again we know that C and M can’t be eight.
00:08:47.380 --> 00:08:52.470
Now because we’ve got this carry here, we know that M plus M plus one is equal to C.
00:08:53.590 --> 00:08:57.290
And that tells us that this isn’t a proper cryptarithm because it’s not a unique answer.
00:08:57.290 --> 00:08:59.870
There are multiple possibilities left for M and C.
00:09:00.820 --> 00:09:04.250
We know that there’s no carry into the thousands column.
00:09:05.250 --> 00:09:08.260
So M plus M plus one is less than 10.
00:09:09.520 --> 00:09:14.020
So M plus M, that’s two M, is less than nine.
00:09:14.990 --> 00:09:17.010
And M is less than four and a half.
00:09:17.960 --> 00:09:20.050
Well, we knew that M couldn’t be zero, eight, or nine.
00:09:20.050 --> 00:09:22.810
But we’ve now just ruled out seven, six, and five as well.
00:09:22.810 --> 00:09:25.280
So the possibilities are one, two, three, or four.
00:09:26.450 --> 00:09:29.550
But if M was four, then C here would be nine.
00:09:29.620 --> 00:09:33.190
But C can’t be nine because we know that we’ve already got another letter that was nine, O.
00:09:34.360 --> 00:09:35.600
So M can’t be four either.
00:09:35.600 --> 00:09:38.010
There are three possibilities, one, two, and three.
00:09:38.980 --> 00:09:42.250
Then if M is one, one plus one plus one is equal to three.
00:09:43.010 --> 00:09:46.060
If M is two, two plus two plus one is equal to five.
00:09:46.850 --> 00:09:49.600
And if M is three, three plus three plus one is seven.
00:09:50.580 --> 00:09:56.200
So as we said, there are three different possible combinations of values that M, O, C, and W could have.
00:09:58.480 --> 00:10:01.390
Now back to our main event, SEND plus MORE equals MONEY.
00:10:02.720 --> 00:10:05.460
Well, the answer has got an extra digit.
00:10:05.740 --> 00:10:09.130
And the maximum that could be carried over when adding two numbers is one.
00:10:09.130 --> 00:10:12.650
So we know M is equal to one and none of the other letters are equal to one.
00:10:13.480 --> 00:10:17.770
So we can cross those off, but we also know that M is not equal to any of the other digits.
00:10:18.410 --> 00:10:19.670
So we can cross those off too.
00:10:20.510 --> 00:10:23.180
And we can start mapping out those answers in a little grid.
00:10:24.010 --> 00:10:25.710
We’ve got a one here and here.
00:10:27.080 --> 00:10:33.240
Now, we know that S plus M gives us a two-digit number in order for there to be a carry over here.
00:10:34.310 --> 00:10:35.980
And we already know that M equal to one.
00:10:35.980 --> 00:10:42.080
So S must be eight if there is a carry from here to here or nine if there wasn’t.
00:10:43.260 --> 00:10:47.200
Now in that case, O down here could be either zero or one.
00:10:47.200 --> 00:10:48.640
But we already know that M is one.
00:10:48.640 --> 00:10:50.290
So O must be zero.
00:10:51.560 --> 00:10:54.930
So we can update our working solution and our table.
00:10:55.960 --> 00:11:11.210
Now, since O is equal to zero, then the only way that we can get E plus O to be greater than nine, to generate the carry that we need down here, is for E to be nine and for there to have been a carry from the previous column.
00:11:12.430 --> 00:11:16.210
But then the answer digit would be zero and the letter at the bottom would be O not N.
00:11:16.250 --> 00:11:19.080
So we can’t have any carry over into the thousands column.
00:11:20.180 --> 00:11:25.920
And that means that S must be nine in order to generate our carry into the ten thousands column.
00:11:27.030 --> 00:11:30.990
Again, we can update our table and our working solution with S equals nine.
00:11:30.990 --> 00:11:38.330
Now remember, in the hundreds column we said that the E plus O equals N without carry and O equals zero.
00:11:38.330 --> 00:11:40.610
So we must have had carry from the tens column.
00:11:40.980 --> 00:11:46.250
And N must be one greater than E or it would be E plus zero equals E.
00:11:46.540 --> 00:11:48.750
So we could write N plus E equals one.
00:11:49.890 --> 00:11:55.490
Now remember, in the hundreds column, we’ve said that E plus O is equal to N without carry and O is equal to zero.
00:11:55.890 --> 00:11:57.650
So we must have had carry from the tens column.
00:11:58.050 --> 00:12:02.920
Now N must be one greater than E or it’d be E plus O equals E.
00:12:03.700 --> 00:12:05.950
Now we could write N is equal to E plus one.
00:12:06.920 --> 00:12:14.060
Now looking at our grid, if N is one bigger than E, then N clearly can’t be two and E can’t be eight.
00:12:15.340 --> 00:12:25.280
Now because we need to have carry from the tens into the hundreds column, we know that N plus R, possibly plus one if there’s carry from the ones column, must be greater than nine.
00:12:26.130 --> 00:12:28.090
In fact, we can be a little bit more specific than that.
00:12:28.090 --> 00:12:40.140
Because we know that the ones digit in the answer to N plus R possibly plus one is E, we can write N plus R possibly plus one is equal to 10 plus E.
00:12:40.570 --> 00:12:44.270
Now we’ve got two simultaneous equations that we can solve.
00:12:45.490 --> 00:12:49.920
Subtracting the first from the second gives us R possibly plus one is equal to nine.
00:12:51.070 --> 00:12:54.140
But remember, S is equal to nine, so R can’t equal nine.
00:12:54.440 --> 00:12:57.980
That means we did have to do this adding one to R to get nine.
00:12:58.800 --> 00:13:00.840
And that means that R must be equal to eight.
00:13:01.900 --> 00:13:04.820
And we can fill that out on our grid and working solution.
00:13:06.220 --> 00:13:09.110
But also remember this, N is equal to E plus one.
00:13:09.110 --> 00:13:11.050
And we know that N can’t be eight now.
00:13:11.050 --> 00:13:12.790
So we also know that E can’t be seven.
00:13:13.770 --> 00:13:14.870
So we can cross that off the grid.
00:13:15.850 --> 00:13:20.270
Now looking in the ones column, we can see that Y has got to be at least two.
00:13:20.590 --> 00:13:24.980
So D plus E must be greater than or equal to 12.
00:13:26.250 --> 00:13:32.390
Remember, we determined that we did have to add this one here so there must be carry from the ones to the 10s column.
00:13:33.560 --> 00:13:41.880
Now looking at the remaining possible values for E and D, they’ve got to be either six and seven, either way round, or five and seven in order to add up to at least 12.
00:13:42.990 --> 00:13:46.330
But remember, we said that N is one bigger than E.
00:13:46.330 --> 00:13:50.030
So if E was six and D was seven, then N would have be seven as well.
00:13:50.060 --> 00:13:51.130
And that’s not allowed.
00:13:52.190 --> 00:13:54.850
So E can’t be six and it must be five.
00:13:56.110 --> 00:14:02.110
And that means the N must be six, which leaves us with seven for D.
00:14:03.260 --> 00:14:09.770
And that means we can easily see that Y must now be two, because seven and five is 12.
00:14:11.390 --> 00:14:13.980
What we need to do then is a final check of our adding up.
00:14:14.280 --> 00:14:16.320
Seven and five is 12.
00:14:16.830 --> 00:14:19.800
Six and eight is 14, plus one is 15.
00:14:21.090 --> 00:14:24.120
Five and zero is five, plus one is six.
00:14:24.590 --> 00:14:26.600
Nine and one is 10.
00:14:27.020 --> 00:14:29.090
And one and nothing is one.
00:14:29.400 --> 00:14:29.830
So yep!
00:14:29.900 --> 00:14:30.870
That looks like it’s right.
00:14:32.190 --> 00:14:33.790
And there we can write out our answer.
00:14:34.380 --> 00:14:40.870
Now sometimes you get to a stage where you’ve done a lot of logical deduction and you just have to use a bit of trial and error with the last few numbers.
00:14:41.120 --> 00:14:42.820
And this is where the grid comes in handy.
00:14:43.710 --> 00:14:48.540
You can see which letter has the fewest possible digits remaining and try one of them to see where it leads.
00:14:48.790 --> 00:14:53.170
If you end up with a contradiction or an impossible situation, then that letter obviously wasn’t that value.
00:14:53.170 --> 00:14:54.930
So you can cross it off and try another one.
00:14:55.960 --> 00:15:00.350
So now you know how to solve possibly the most famous cryptarithmetic puzzle of all time.
00:15:00.550 --> 00:15:02.210
Hopefully, you can solve some more of your own.