A Python in a maze: second fit

italian

Previously we saw a strategy to solve this puzzle (each letter stands for one and only one number)

FIVE -
FOUR =
------
 ONE +
 ONE =
------
 TWO

First we found a comfortable representation of the space of possible solutions, a representation we could handle with paper and pencil: to do this paradoxically we had to think in an algorithmic manner, as if we were going to instruct a computer to solve the problem – a very limited computer indeed!…

Let’s get started

One can rewrite the operations composing the statement of the puzzle to make the task a little bit easier. For instance rewriting the subtraction

FOUR +
 ONE =
------
FIVE

Therefore the last digit of R + E must equal E. For this to be true R = 0. From the addition

ONE +
ONE =
-----
TWO

Now the rightmost column says that O is the rightmost digit of E + E. Hence O must be one of 2, 4, 6, 8 (not 0, recall our earlier assumption), since TWO is an even number. But from the leftmost column of this sum we know that either O + O = T or (in case of carry from the nearby column) O + O + 1 = T, so that O cannot be greater than 4 (otherwise there would be a carry from the leftmost column, so that the result would be four digits long instead of three). Therefore either O = 2 or O = 4. We can use the rightmost column of the sum to infer that in the former case either E = 1 or E = 6, in the latter either E = 2 or E = 7.
Indeed if O=2

 1 +         6 +
 1 =   and   6 =
----        ----
 2          12  (we keep only the lsd 2)

Likewise for O=4

 2 +       7 +   
 2 =   e   7 =
----      ----
 4        14    (we keep only the lsd 4)

In turn we see from the addition

ONE +
ONE =
-----
TWO

that when O = 2 we can have either T = 4 or T = 5 (according to whether there is carry or not); while O = 4 implies that either T = 8 or T = 9 (again, carry).

To summarize what we’ve found

R O T E
0 2 4 1
0 2 4 6
0 2 5 1
0 2 5 6
0 4 8 2
0 4 8 7
0 4 9 2
0 4 9 7

Now let’s go back to the subtraction: since R = 0 we can write it as follows (just “forgetting” the rightmost column)

FOU +
 ON =
-----
FIV

The middle column says that either O + O = I or O + O + 1 = I (in case of carry, i.e. U + N >9). But wait a moment! We also had that either O + O = T or O + O + 1 = T. Since each letter represents a unique digit T and I cannot e equal. Let’s write this with a table (using what we know about O)

O T I
2 4 5
2 5 4
4 8 9
4 9 8

Put this into the larger table to obtain

R O T I E spare
0 2 4 5 1 36789
0 2 4 5 6 13789
0 2 5 4 1 36789
0 2 5 4 6 13789
0 4 8 9 2 13567
0 4 8 9 7 12356
0 4 9 8 2 13567
0 4 9 8 7 12356

This thing is becoming a bit large, but it enables us to keep the calculation down to a manageable size. I also added a column with the spare digits (i.e. digits we haven’t associated to a letter yet). Recall that we have the letters W, N, U, V, F yet to determine.

Now it’s time enough for another pause to reflect a little bit. I invite you to go on the path shown in this post, at least for a few steps. The end of the story in a following post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s