A Python in a maze: third fit

italian

Let’s continue the story from a previous post.

Since ONE + ONE = TWO we can hope to constraint the values of N to the value of W somehow. For starters we can say that because of the rightmost column when E>4 then W is odd because of the carry, while W is even when E<5

 1
ONE +
ONE =    when E is greater than 4
-----
TWO

 0
ONE +
ONE =    when E is less than 5
-----
TWO

In a table this becomes:

E W
1 even (0,2,4,6,8)
6 odd (1,3,5,7,9)
2 even (0,2,4,6,8)
7 odd (1,3,5,7,9)

Likewise, there is a similar relationship linking T and N: if T is odd there must be some carry from the nearby column, so that N>4, while T even implies N<5. In a table

T N
4 (0,1,2,3,4)
5 (5,6,7,8,9)
8 (0,1,2,3,4)
9 (5,6,7,8,9)

Notice that there are conflicts: we will resolve them sticking these minitables into the master table we are maintaining, in a moment. When W is even (no carry from E + E) the rightmost digit of N + N is W (when W is odd we must decrease it by 1 of course). A similar argument can be made for the latter table. Since we know that R = 0 we can drop the cases where either W or N are 0, or those where W = N. This leads to the table

W N
2 1
2 6
4 2
4 7
6 3
6 8
8 4
8 9
1 5
3 1
3 6
5 2
5 7
7 3
7 8
9 4

Were we to inject this table – which is quite long – into the master table that would make it too long to be manageable by hand; or not, depending on your laziness: it saturates mine for sure, so we have to find some smarter trick. The following table could be a starting point, we add columns to list the possible values for W

R O T I E W spare (including W)
0 2 4 5 1 even (2,4,6,8) 36789
0 2 4 5 6 odd (1,3,5,7,9) 13789
0 2 5 4 1 even (2,4,6,8) 36789
0 2 5 4 6 odd (1,3,5,7,9) 13789
0 4 8 9 2 even (2,4,6,8) 13567
0 4 8 9 7 odd (1,3,5,7,9) 12356
0 4 9 8 2 even (2,4,6,8) 13567
0 4 9 8 7 odd (1,3,5,7,9) 12356

We now exclude the values of W that conflict with the other letters, so in example in the first row

R O T I E W spare (including W)
0 2 4 5 1 even (2,4,6,8) 36789

W cannot have the values 2 or 4, so we get

R O T I E W spare (including W)
0 2 4 5 1 even (6,8) 36789

Now we add the column for N starting from the values for W

R O T I E W N spare (including W and N)
0 2 4 5 1 even (6,8) (3,8;4,9) 36789

We can exclude the conflicts here too

R O T I E W N spare (including W and N)
0 2 4 5 1 even (6,8) (3,8;9) 36789

Then we get the new table

R O T I E W N spare (including W and N)
0 2 4 5 1 even (6,8) (3,8;9) 36789
0 2 4 5 6 odd (3,7) (1,6;3,8) 13789
0 2 5 4 1 even (6,8) (3,8;9) 36789
0 2 5 4 6 odd (3,7) (1,6;3,8) 13789
0 4 8 9 2 even (6) (3) 13567
0 4 8 9 7 odd (1,3,5) (5;1,6;2) 12356
0 4 9 8 2 even (6) (3) 13567
0 4 9 8 7 odd (1,3,5) (5;1,6;2) 12356

Now since

T N
even (0,1,2,3,4)
odd (5,6,7,8,9)

we obtain

R O T I E W N spare (including W and N)
0 2 4 5 1 even (6) (3) 36789
0 2 4 5 6 odd (3,7) (1;3) 13789
0 2 5 4 1 even (6, 8) (8;9) 36789
0 2 5 4 6 odd (7) (8) 13789
0 4 8 9 2 even (6) (3) 13567
0 4 8 9 7 odd (3, 5) (1;2) 12356
0 4 9 8 2 even (6) () 13567
0 4 9 8 7 odd (1, 3) (5;6) 12356

(Second to last row is empty, so we can drop it)

Now the master table becomes

R O T I E W N spare
0 2 4 5 1 6 3 789
0 2 4 5 6 3 1 789
0 2 4 5 6 7 3 189
0 2 5 4 1 6 8 379
0 2 5 4 1 8 9 367
0 2 5 4 6 7 8 139
0 4 8 9 2 6 3 157
0 4 8 9 7 3 1 256
0 4 8 9 7 5 2 136
0 4 9 8 7 1 5 236
0 4 9 8 7 3 6 125

Now We extract the last bit of information from the statement of the puzzle:

FOU +
 ON =
-----
FIV

Looking the rightmost column we see that

a. the rightmost digit of U+N equals V
b. when I is even there is no carry, hence U+N < 10, on the other hand when I is odd U+N > 9

Let’s augment the master table with the possible values for the sum of U and V

R O T I E W N spare U+N constraint
0 2 4 5 1 6 3 789 (10,11,12) U+N>9
0 2 4 5 6 3 1 789 (8,9,10) U+N>9
0 2 4 5 6 7 3 189 (4,11,12) U+N>9
0 2 5 4 1 6 8 379 (11,15,17) U+N<10
0 2 5 4 1 8 9 367 (12,15,16) U+N<10
0 2 5 4 6 7 8 139 (9,11,17) U+N9
0 4 8 9 7 3 1 256 (3,6,7) U+N>9
0 4 8 9 7 5 2 136 (3,5,8) U+N>9
0 4 9 8 7 1 5 236 (7,8,11) U+N<10
0 4 9 8 7 3 6 125 (7,8,11) U+N<10

We must enforce the constraint, obtaining

R O T I E W N U+N U V
0 2 4 5 1 6 3 (10,11,12) (7,8,9) (0,1,2)
0 2 4 5 6 3 1 (10) (9) (0)
0 2 4 5 6 7 3 (11,12) (8,9) (1,2)
0 2 5 4 6 7 8 (9) (1) (9)
0 4 8 9 2 6 3 (10) (7) (0)
0 4 9 8 7 1 5 (7,8) (2,3) (7,8)
0 4 9 8 7 3 6 (7,8) (1,2) (7,8)

If we eliminate the conflicts we delete most of the rows arriving finally at

R O T I E W N U V
0 2 4 5 6 7 3 (8) (1)
0 2 5 4 6 7 8 (1) (9)

This gives the only two solutions

3496 -
3210 =
------
 286 +
 286 =
------
 572

9516 -
9280 =
------
 236 +
 236 =
------
 472

One can verify these solutions by using the python script presented in the first post of this series.

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