Nine Digits Sum

ABC+DEF=GHI. Replace each letter with a unique digit from 1 to 9, such that GHI is
  1. as small as possible.
  2. as large as possible.
Repeat for ABC+DEF=GHIJ, using the digits 0 to 9, with no leading zeros.

To avoid duplication in answers, maximize DEF in each solution. I'm interested more in analytical proofs than in computer generated solutions.

Source: Original. Based on a puzzle from The 2001 Mensa Puzzle Calendar.


Solutions were received from Philippe Fondanaiche, Joseph DeVincentis, Jozef Hanenberg, Claudio Baiocchi, Dane Brooke, Denis Borris, Francesc Sunol, Graeme McRae, Al Zimmermann. In general, it seems it took longer to write up the analytical solution than to actually find the answers. Al's computer provided a quick summary of the results:
Without zeroes
    Min GHI:    173 + 286 = 459
    Max GHI:    235 + 746 = 981

With zeroes
    Min GHIJ:   437 + 589 = 1026
    Max GHIJ:   743 + 859 = 1602
Some representative solutions follow.

From Jozef Hanenberg:
Case: ABC + DEF = GHI

Because the digits 1 to 9 add up to 45, which is a multiple of 9, you will have a multiple of 9 if you add ABC, DEF and GHI. And because GHI is half of this sum, GHI itself must be a multiple of 9. So G+H+I is a multiple of 9.

We look for the smallest value: G must at least be 3. In that case A=1 and D=2. The possibilities GHI = 315,324,342,351 fail because of A or D. The other possibilities with G=3 are
 
1.4       1..        1..       1..  
2.5       2..        2..       2..   but they all fail at the next step.
369       378        387       396    
So G must be at least 4. GHI = 423 or 432 fail because D must be 2 or 3. The next possibility gives the answer: 173 + 286 = 459.

Looking for the largest value isn't difficult as the first possibility GHI = 981 is bullseye: you get 324 + 657 = 981 and also 235 + 746 = 981.

Case: ABC + DEF = GHIJ

An identical argument as given above leads to the conclusion that GHIJ is a multiple of 9 and therefore G+H+I+J is a multiple of 9.

The smallest value of GHIJ again comes fast, as 437 + 589 = 1026.

Looking for the largest value of GHIJ, note that G=1 and H=7 (in that case A=8 and D=9) or H=6 (in that case A=7 and D=8 or 9)

 
We get 
 8..     8..      7..      7..     7..     7.4     7..     7..     7.4     743
 9..     9..      8..      9..     9..     8.5     9..     8..     9.8     859 
1764    1746     1692     1683    1638    1629    1620    1620    1602    1602
They fail at the next step, except fot the last one: it gives the answer 743 + 859 = 1602.

Writing all this down took much more time then finding the answers. Who would want a computer to generate the answers?
From Graeme McRae:

----------------------------------------------------------
First Puzzle: ABC+DEF=GHI, minimize GHI, then maximize DEF
----------------------------------------------------------

First, some general observations...

(1) There must be an odd number of carries because the sum of the digits
1 through 9 is 45, so if the sum of the digits A+B+C+D+E+F is even
then the sum of G+H+I is odd, and vice versa.  This can only happen
if there are an odd number of carries.

(2) Since there can be no carry from the hundreds column, then there
must be either a carry from the ones column or a carry from the
tens column but not both.

(3) The sum of the digits of the sum, GHI, must be 18.  Here's why:

Since there's one carry, then either

A+D=G and 1+B+E=H and C+F-10=I

or

1+A+D=G and B+E-10=H and C+F=I

In either case, A+B+C+D+E+F-9 = G+H+I
Since A+B+C+D+E+F = 45-(G+H+I), we have
45-(G+H+I)-9 = G+H+I
G+H+I=18

Now, the solution to this problem...

Can G be 3?  Then A=1, D=2, and no carry into the hundreds column.
So there must be a carry into the tens column.  But the smallest
digits available for B and E are 4 and 5, and 4+5+carry=10.
This violates "no carry into the hundreds column".  So G can't be 3.

G must be at least 4.  That means H+I=14, so the smallest possible H is
5, and the smallest possible GHI is 459.

Either C and F are 1 and 3 (carry from ones to tens) or
C and F are 1 and 2 (carry from tens to hundreds).

If C and F are 1 and 3, then the carry must be from the ones column
into the tens column.  The smallest tens digit in the sum, GHI, is 8,
because 2+5+carry=8 are the smallest digits available for B and E.
Since G+H+I=18, GHI is 486.  (127+359=486)

Perhaps we can do better by allowing a carry from the tens column.

If the hundreds column is 1+2+carry=4, then these digits are
available for the tens column: 3, 5, 6, 7, 8, and 9.

The combinations of these digits with a carry out of the tens
place but no carry into the tens place are

5+8=13, 6+7=13, 6+9=15, 7+8=15, 8+9=17.

The first two make GHI less than 459, which is impossible.
The next one makes H equal to 5 but uses up the 9 needed to yield 459.

The fourth one gives H equal to 5 and leaves 3, 6, and 9 for the
ones column.  The final answer is 173+286=459

----------------------------------------------------------
Second Puzzle: ABC+DEF=GHI, maximize GHI, then maximize DEF
----------------------------------------------------------

The maximum GHI is 981 because if G and H are 9 and 8
then I is 1, because G+H+I=18.

Our next priority is to maximize DEF, so let's try D=7.
In that case, A can't be 1, so A=2 and the carry must be
from the ones column to the tens column.

So far we've used 1, 2, 7, 8, and 9.  We have yet to place
the last two digits of each addend from among 3, 4, 5, and 6.

Since there's a carry into the tens column, there's only one
way to get a sum of 8, and that's 3+4+carry=8.  That leaves
5+6=11 for the ones column.  235+746=981.

------------------------------------------------------------
Third Puzzle: ABC+DEF=GHIJ, minimize GHIJ, then maximize DEF
------------------------------------------------------------

Similar observations to those made for puzzles one and two:

(1) There must be an odd number of carries because the sum of the digits
1 through 9 is 45, so if the sum of the digits in ABC,DEF is even
then the sum of GHIJ is odd, and vice versa.  This can only happen
if there are an odd number of carries.

(2) Since there must be a carry from the hundreds column, then there
must be either a carry from both other columns or neither of the
other columns.

(3) The sum of the digits of the sum, GHIJ, must be 9 or 18.  Here's why:

If there's one carry, then A+B+C+D+E+F-9 = G+H+I+J, so
G+H+I+J = 18

If there are three carries, then A+B+C+D+E+F-27 = G+H+I+J, so
G+H+I+J = 9

Now to the puzzle:

The smallest possible GHIJ is 1026 because no leading zero is permitted
and the sum of G+H+I+J must be 9 or 18.

There are three carries in this problem, because that's the only way to
make G+H+I+J=9.

The digits available for the hundreds column are 3, 4, 5, 7, 8, and 9.

The only combination of A+D+carry=10 is 4+5+carry=10.

That leaves 3, 7, 8, and 9 from which to pick the tens digits.

The only combination of B+E+carry=12 is 3+8+carry=12.

That leaves 7 and 9, and luckily, 7+9=16  So the answer is 437+589=1026.

-------------------------------------------------------------
Fourth Puzzle: ABC+DEF=GHIJ, maximize GHIJ, then maximize DEF
-------------------------------------------------------------

G must be 1, and ABC+DEF can be at most 975+864=1839, so H
can be at most 8.

If GH is 18 then ABC+DEF can be at most 964+753=1717, so H
can be at most 7.

If GH is 17 then A and D must be chosen from among 2, 3, 4, 5, 6, 8, and 9.
The only combination of A and D from this group is 8+9, and so there
can be no carry (except from the hundreds place).  Therefore the sum of 
G+H+I+J
is 18, so the sum of I+J is 10.  The only way to pick I and J
from among 0, 2, 3, 4, 5, and 6 so that I+J=10 is 4+6 (or 6+4), so if GH is
17 then GHIJ is 1746 or 1764.  The remaining numbers are 0, 2, 3, and 5.
No pair of these numbers adds up to 4, and no pair adds up to 6, so GH can't
be 17.  H can be at most 6.

If GH is 16 then A and D must be chosen from among 2, 3, 4, 5, 7, 8, and 9.
The only combination of A and D from this group is 7+8+carry=16, so
there must be three carries.  The sum of G+H+I+J is 9, so I+J=2, so they 
must be
0 and 2 (1 is taken).  So if GH is 16 then GHIJ is 1620 or 1602.

The digits left to fill the tens and ones places are 3, 4, 5, and 9.  No
combination of these adds up to 10 but 3+9=12, so these are the ones digits.
That leaves 4+5+carry=10, so the final answer is 743+859=1602.

Mail to Ken