*Spoiler forĀ New Scientist Enigma 1702:*

I have before me six different six-digit numbers, whose sum also contains six digits. Each of the 42 digits has one of only two values. If I told you the sum, you would be able to identify all six numbers. What is the sum?

Now, this is an enigma!

The sum of six six-digit numbers must be 666,666 or greater, so the first digit in the sum must be 6, 7, 8, or 9. This is one of our two digits, and the other digit must be 1 to keep the sum under 1,000,000.

Suppose we use 1 and 6. If we add six digits each of which is either 1 or 6, we get 6, 11, 16, 21, 26, 31, or 36. All of these end with 1 or 6, so any combination of 1s and 6s could be used in the rightmost column and we’d get a valid final digit for the sum. Unfortunately the carry into the next column would be 0, 1, 2, or 3, and of these only 0 can result in the next digit of the sum being valid. Likewise for all the rest of the columns; the only set of six-digit 1-and-6 numbers that add to a six-digit 1-and-6 number is 111,111 six times. But we need six *different* numbers. So 6 and 1 are not our digits.

Nor are 7 and 1; the sums we get are 6, 12, 18, 24, 30, 36, or 42, none of which end with 1 or 7 so we have no valid possibility for the final column. Similarly we can’t use 9 and 1. We’re left with 8 and 1.

The sums we get then are 6, 13, 20, 27, 34, 41, and 48. Of these only the last two are possibilities for the rightmost column, and in either case the carry into the next column is 4. That column then must have 3 or 4 8s producing a sum, with the carried 4, of 31 or 38; the carry into the next column is 3. And so on, as follows:

Column | Carry in | # of 8s | Sum (with carry) | Carry out |
---|---|---|---|---|

6 (rightmost) | 0 | 5 | 41 | 4 |

or 6 | 48 | 4 | ||

5 | 4 | 3 | 31 | 3 |

or 4 | 38 | 3 | ||

4 | 3 | 6 | 51 | 5 |

3 | 5 | 0 | 11 | 1 |

or 1 | 18 | 1 | ||

2 | 1 | 2 | 21 | 2 |

or 3 | 28 | 2 | ||

1 | 2 | 0 | 8 | 0 |

So in columns 1 and 4 we have a forced number of 8s, and in the other four we have a choice of two possibilities. Altogether there are sixteen possibilities, each associated with a different sum. What we want is a choice for our four columns for which there is one, and only one, set of six different numbers compatible with that sum.

Consider columns 2 and 5: these can be 23 (2 8s in column 2 and 3 8s in column 5), 24, 33, or 34. Eliminating as many duplications as possible gives:

23: | 24: | 33: | 34: |
---|---|---|---|

11 | 11 | 11 | 11 |

18 | 18 | 18 | 18 |

11 | 18 | 11 | 18 |

18 | 18 | 88 | 81 |

81 | 81 | 81 | 88 |

88 | 88 | 88 | 88 |

In poker terms, for 23, 33, and 34 there are two pairs (e.g. two 11 and two 18); for 24, there is one three of a kind (18). To get six distinct numbers we can use columns 3 and 6: e.g. in the 23 case, in column 3 put the 8 in row 1 and in column 6 put the 1 in row 2. But we could also put the 8 in column 3 row 2 and the 1 in column 6 row 3. This means there are two sets of numbers giving rise to the same sum, so the 23 case does not give a solution. Nor do the 33 and 34 cases.

For 24, though, we can turn the three of a kind into three distinct numbers using columns 3 and 6 in only one way; i.e. :

111818 111881 111888 118888 181818 181888

So this is our set of six numbers. The sum is 818181.