## Word Arithmetics - Part 8

This one is really tough:

```            A
----
BCD)AEFG
HICJ
----
HAE```

Try to solve it before you look at my solution.

My solution:

We can easily list the possible permutations of A, H, D, and J:

```            x              x
A = 2222233333444466677777888899999
H = 1111122222333355566666777788888
D = 3478946789278937923489234923467
J = 6846828147882682441863642287643```

Two of those can be eliminated, as H and J cannot be the same. Now an important clue is that AxBCD=HICJ, where H is one less than A. Only certain values of B will work for the above permutations:

```            x y            x
A = 22222x33334444666777x7888899999
H = 11111x22223333555666x6777788888
D = 34789x67892789379234x9234923467
J = 68468x81478826824418x3642287643
B = 55555 76667977988889 8999
76676 98789 98 9 99
87897  99
999```

Those are all of the possible values of B which do not conflict with the other four letters. That eliminates the six columns on the right. Also, we see that E is less than H, but is not zero. That eliminates the five columns on the left. It also eliminates the column that I marked "y" above. We can list the above permutations, adding the letters E and G to the list:

```   A = 33 333 33 44 4 44 44 6 66 6 77 77 7 7 8 8 8
H = 22 222 22 33 3 33 33 5 55 5 66 66 6 6 7 7 7
D = 66 888 99 22 7 88 99 3 77 9 22 33 4 9 2 3 4
J = 88 444 77 88 8 22 66 8 22 4 44 11 8 3 6 4 2
B = 79 679 68 79 9 79 78 9 89 8 89 89 9 8 9 9 9
E = 11 111 11 11 2 11 22 4 44 3 55 55 5 5 5 6 6
1    11 2 33 2 33 44 3 4 4 5 5
1 11 1 11 22 2 2 3 2 3
1 1 1 1 1
G = 99 555 88 99 0 33 88 2 66 7 99 66 3 8 1 0 8
9    77 0 55 6 77 55 1 7 0 9 7
9 33 5 55 33 0 5 9 6 5
9 4 7 5 3```

In several permutations, G conflicts with other letters. I'll mark those with x's:

```        x      x  x   xx
A = 3x 333 3x 4x 4 xx 44 6 66 6 77 77 7 7 8 8 8
H = 2x 222 2x 3x 3 xx 33 5 55 5 66 66 6 6 7 7 7
D = 6x 888 9x 2x 7 xx 99 3 77 9 22 33 4 9 2 3 4
J = 8x 444 7x 8x 8 xx 66 8 22 4 44 11 8 3 6 4 2
B = 7x 679 6x 7x 9 xx 78 9 89 8 89 89 9 8 9 9 9
E = 1x 111 1x 1x 2 xx 2x 4 xx 3 5x xx 5 x 5 6 x
x    x1 2 xx x xx 44 3 x 4 x x
x 11 x 11 xx 2 2 x 2 3
x 1 x 1 1
G = 9x 555 8x 9x 0 xx 8x 2 xx 7 9x xx 3 x 1 0 x
x    x7 0 xx x xx 55 1 x 0 x x
x 33 x 55 xx 0 5 x 6 5
x 4 x 5 3```

Let me list the remaining permutations (removing the x's):

```   A = 3 333 3 4 4 44 66 66 6 777 77 777 77 88 888 88
H = 2 222 2 3 3 33 55 55 5 666 66 666 66 77 777 77
D = 6 888 9 2 7 99 33 77 9 222 33 444 99 22 333 44
J = 8 444 7 8 8 66 88 22 4 444 11 888 33 66 444 22
B = 7 679 6 7 9 78 99 89 8 889 89 999 88 99 999 99
E = 1 111 1 1 2 21 42 11 3 511 44 532 21 54 621 31
G = 9 555 8 9 0 87 20 33 7 955 55 310 54 10 065 53```

H+I=10+E or H+I=9+E (if there is a borrow from E). So we can add I to this list:

```   A = 3 333 3 4 4 44 66 66 6 777 77 777 77 88 888 88
H = 2 222 2 3 3 33 55 55 5 666 66 666 66 77 777 77
D = 6 888 9 2 7 99 33 77 9 222 33 444 99 22 333 44
J = 8 444 7 8 8 66 88 22 4 444 11 888 33 66 444 22
B = 7 679 6 7 9 78 99 89 8 889 89 999 88 99 999 99
E = 1 111 1 1 2 21 42 11 3 511 44 532 21 54 621 31
G = 9 555 8 9 0 87 20 33 7 955 55 310 54 10 065 53
I =   99            7           8   5  5     5  6```

Notice that only eight columns work. So we have reduced the permutations to eight. And we have looked at eight of the letters. The other two letters (C and F) can only have a couple of possible values each. Here is a list of all the possible values of AxBCD=HICJ:

```    678  768  943  923  934  829  913  914
x3   x3   x6   x7   x7   x7   x8   x8
---- ---- ---- ---- ---- ---- ---- ----
2034 2304 5658 6461 6538 5803 7304 7312```

Six of these can be eliminated immediately (because C is not the same above and below), and one more (the right one) can be eliminated with a little checking. And that leaves only one permutation. And this is the solution:

```            7
----
934)7210
6538
----
672```