# Two Three-Digit Numbers Added to Make Four-Digit Sum. No Number Can Repeat Itself.

A friend posed this question to me a few days ago, and I just haven't been able to get it off of my mind.

"There are ten numbers from 0 to 9. You can use any number you like in the box, but the number cannot repeat itself."

 [][][]
+[][][]


[][][][]


If you can provide the way in which arrived to the answer, that would be great. I would really like to learn.

• Can the first digit of the answer be a zero? If that's the case, I've found a solution,
– астон вілла олоф мэллбэрг
Commented Feb 17, 2017 at 1:05
• астон вілла олоф мэллбэрг: Normally not in puzzles like this, but there are exceptions. In fact, I start with the thousands digit of the sum being $1$ Commented Feb 17, 2017 at 1:06
• A more usual way to write this is $$\ \ ABC\\ \underline {+DEF}\\GHJK$$ which gives a way to refer to the digits. My previous comment then could include $G=1$ because that is all you can carry from the addition of two numbers. Commented Feb 17, 2017 at 1:13
• One example would be 537+489=1026
– Smurf
Commented Feb 17, 2017 at 1:34
• And $342+756=1098$, $742+356=1098$ ... my program counts exactly $96$ solutions...
– ringø
Commented Feb 17, 2017 at 1:56

1)    246 + 789 = 1035
2)    249 + 786 = 1035
3)    264 + 789 = 1053
4)    269 + 784 = 1053
5)    284 + 769 = 1053
6)    286 + 749 = 1035
7)    289 + 746 = 1035
8)    289 + 764 = 1053
9)    324 + 765 = 1089
10)   325 + 764 = 1089
11)   342 + 756 = 1098
12)   346 + 752 = 1098
13)   347 + 859 = 1206
14)   349 + 857 = 1206
15)   352 + 746 = 1098
16)   356 + 742 = 1098
17)   357 + 849 = 1206
18)   359 + 847 = 1206
19)   364 + 725 = 1089
20)   365 + 724 = 1089
21)   423 + 675 = 1098
22)   425 + 673 = 1098
23)   426 + 879 = 1305
24)   429 + 876 = 1305
25)   432 + 657 = 1089
26)   437 + 589 = 1026
27)   437 + 652 = 1089
28)   439 + 587 = 1026
29)   452 + 637 = 1089
30)   457 + 632 = 1089
31)   473 + 589 = 1062
32)   473 + 625 = 1098
33)   475 + 623 = 1098
34)   476 + 829 = 1305
35)   479 + 583 = 1062
36)   479 + 826 = 1305
37)   483 + 579 = 1062
38)   487 + 539 = 1026
39)   489 + 537 = 1026
40)   489 + 573 = 1062
41)   624 + 879 = 1503
42)   629 + 874 = 1503
43)   674 + 829 = 1503
44)   679 + 824 = 1503
45)   743 + 859 = 1602
46)   749 + 853 = 1602
47)   753 + 849 = 1602
48)   759 + 843 = 1602


Here's the brute-force Ruby program I used to enumerate these:

(2..10)
.to_a
.permutation
.map { |a, b, c, d, e, f, g, h, i| ["#{a}#{b}#{c}".to_i, "#{d}#{e}#{f}".to_i, "1#{g}#{h}#{i}".to_i] }
.select { |a, b, c| a < b && a + b == c }
.map { |a, b, c| "#{a} + #{b} = #{c}" }

• Hmm I count 96 lines (commutativity is not duplication) ... and that fits the output of my program :-) Btw I think OP looks for a mathematical resolution, rather than a raw output ... Or at least show your algorithm! (well, I could have provided mine as well, but this is not stackoverflow, so not sure it qualifies!)
– ringø
Commented Feb 17, 2017 at 2:00
• With $48$ answers to cover, a complete solution based on purely analytic techniques seems difficult.
– Oscar Lanzi
Commented Feb 17, 2017 at 2:02
• @OscarLanzi well, 96 out of 10 billions possibilities is not so much...
– ringø
Commented Feb 17, 2017 at 2:05
• @ringo not $10^{10}$. All digits must be distinct which removes most of the tuples; digit G has to be $1$; the other initial digits cannot be zero; and in my book two solutions that differ only by switching the addends are not really different. Thus I am left with only about $130,000$ candidates.
– Oscar Lanzi
Commented Feb 17, 2017 at 2:38
• Conversely, this could be cut down to 12 truly unique solutions, annotated with digit-wise commutativity (e.g., 246 + 789 = 249 + 786 = 286 + 749 = 289 + 746). Commented Feb 18, 2017 at 22:20