There are six different 6-digit positive integers that add up to a seventh 6-digit integer. Interestingly, all seven of these numbers consist of combinations of only two different digits. That is, only two different digits are used to write the complete set of seven numbers--the same two digits in each number.

So far you can't deduce what the numbers are, but if I were to tell you that seventh number, that is, the total, you'd know what the other six numbers were that made up that total.

What are the seven numbers?

From Enigma No. 1702, "All the sixes",by Ian Kay, New Scientist, 16 June 2012, page 32.

Let a and b represent the two digits, where a>b.

Let zi be the number of a's in the ith column, when the digits are represented in this form:

_ _ _ _ _ _ +

_ _ _ _ _ _ +

_ _ _ _ _ _ +

_ _ _ _ _ _ +

_ _ _ _ _ _ +

_ _ _ _ _ _ +

= ?

For example, if a is the last digit of 4 of the 6 numbers then (z6) =4. If a is the first digit of 3 of the 6 numbers then (z1)=3.

Now we can form an equation for the sum of all 6 numbers:

sum = 100000*[(z1)a + (6-(z1))b] + 10000*[(z2)a + (6-(z2))b] + 1000*[(z3)a + (6-(z3))b] + 100*[(z4)a + (6-(z4))b] + 10*[(z5)a + (6-(z5))b] + 1*[(z6)a + (6-(z6))b].

By re-arranging the above equation, we get:

666666b + 100000(z1)*(a-b) + 10000(z2)*(a-b) +1000(z3)*(a-b) + 100(z4)*(a-b) + 10(z5)*(a-b) + (z6)*(a-b)

Now because of the 666666b term, if b>1, then the sum automatically exceeds a 6 digit integer.

Therefore b is either 0, or 1. b cannot be 0 however, because if b is 0, then (z6) = 6, since 0 cannot be the leading digit in any number. If (z6) = 6, then a cannot exceed 1, else the sum would form a 7 digit number. Therefore a would have to be 1. But then the sum's first digit would exceed 1, thus not satisfying the questions criteria. <b>Therefore b must be 1.<b>

Since b = 1, we have a new formula for the total:

666666 + 100000(z1)*(a-1) + 10000(z2)*(a-1) +1000(z3)*(a-1) + 100(z4)*(a-1) + 10(z5)*(a-1) + (z6)*(a-1).

Since the first term is 666666, and all other terms are positive, it is obvious that a cannot be 6 or less than 6. (since only number with just 6's and 1's is less than 666666). Therefore a must be 7, 8, or 9.

Therefore (a-b) is either 8,7, or 6. Therefore the term 666666 + 100000(z1)*(a-1) will create a 7 digit number, unless (z1) = 0. Therefore (z1)=0, and the first digit of all 6 numbers must be 1.

1 _ _ _ _ _ +

1_ _ _ _ _ +

1_ _ _ _ _ +

1_ _ _ _ _ +

1_ _ _ _ _ +

1_ _ _ _ _ +

= ?

We can also note that there are no combinations of six 9 and 1s, that give a digit ending in 9 or 1. Similarly there are no combinations of six 7 and 1s that give a digit ending in 7 or 1. There is one combinations of 8's and 1s that give a digit ending in 1 however. That is, 8+8+8+8+8+1 = 41.

Therefore a = 8 and (z6) = 5. The equation now becomes:

1 _ _ _ _8 +

1_ _ _ _ 8+

1_ _ _ _ 8 +

1_ _ _ _ 8 +

1_ _ _ _ 8 +

1_ _ _ _ 1 +

= ?

Complete this process until you find all values for (zi)