# Find all values of a,b,c such that a-b = c, a,b,c are three digit numbers and the digits are distinct.

Hello everyone this is my first question on here.

What is the relation between a and b when a-b=c | a,b,c ∈ Z | 123 ≤ a,b,c ≤ 987 and a,b,c have distinct digits 1-9.

For example one possible value of a and b are: a = 459, b = 173, c = a-b = 286. This works as no digit repeats, it is a three digit number, 0 is not used and a is greater than b.

I've gone through every possibility with a computer which gives 336 possible combinations of a and b. Obviously though a-b=c and a-c=b are both true so every combination has a "duplicate".

I have not yet found a way of deriving these numbers with a mathematical rule, as it doesn't fit with any standard formulas. If anyone could find one i'd be very interested.

Here's the list of possible values of a (left-column) and b if it can be of aid:

• 459 : 173, 176, 183, 186, 273, 276, 283, 286
• 468 : 173, 175, 193, 195, 273, 275, 293, 295
• 486 : 127, 129, 157, 159, 327, 329, 357, 359
• 495 : 127, 128, 167, 168, 327, 328, 367, 368
• 549 : 162, 167, 182, 187, 362, 367, 382, 387
• 567 : 128, 129, 138, 139, 218, 219, 248, 249, 318, 319, 348, 349, 428, 429, 438, 439
• 576 : 182, 184, 192, 194, 382, 384, 392, 394
• 594 : 216, 218, 276, 278, 316, 318, 376, 378
• 639 : 152, 157, 182, 187, 452, 457, 482, 487
• 648 : 251, 257, 291, 297, 351, 357, 391, 397
• 657 : 218, 219, 238, 239, 418, 419, 438, 439
• 675 : 182, 183, 192, 193, 281, 284, 291, 294, 381, 384, 391, 394, 482, 483, 492, 493
• 693 : 215, 218, 275, 278, 415, 418, 475, 478
• 729 : 143, 146, 183, 186, 543, 546, 583, 586
• 738 : 142, 146, 192, 196, 542, 546, 592, 596
• 783 : 124, 129, 154, 159, 214, 219, 264, 269, 514, 519, 564, 569, 624, 629, 654, 659
• 792 : 134, 138, 154, 158, 634, 638, 654, 658
• 819 : 243, 246, 273, 276, 352, 357, 362, 367, 452, 457, 462, 467, 543, 546, 573, 576
• 837 : 142, 145, 192, 195, 241, 246, 291, 296, 541, 546, 591, 596, 642, 645, 692, 695
• 846 : 317, 319, 327, 329, 517, 519, 527, 529
• 864 : 125, 129, 135, 139, 271, 273, 291, 293, 571, 573, 591, 593, 725, 729, 735, 739
• 873 : 214, 219, 254, 259, 614, 619, 654, 659
• 891 : 234, 237, 254, 257, 324, 327, 364, 367, 524, 527, 564, 567, 634, 637, 654, 657
• 918 : 243, 245, 273, 275, 342, 346, 372, 376, 542, 546, 572, 576, 643, 645, 673, 675
• 927 : 341, 346, 381, 386, 541, 546, 581, 586
• 936 : 152, 154, 182, 184, 752, 754, 782, 784
• 945 : 162, 163, 182, 183, 317, 318, 327, 328, 617, 618, 627, 628, 762, 763, 782, 783
• 954 : 216, 218, 236, 238, 271, 273, 281, 283, 671, 673, 681, 683, 716, 718, 736, 738
• 963 : 215, 218, 245, 248, 715, 718, 745, 748
• 972 : 314, 318, 354, 358, 614, 618, 654, 658
• 981 : 235, 236, 245, 246, 324, 327, 354, 357, 624, 627, 654, 657, 735, 736, 745, 746

Also, I've noticed the sum of every "a" value is 18, this may be significant.

A sub question that I have aswell is why the number of possibilities is 336. I noticed it is equal to $8*7*6$ but why I don’t know.

Thankyou for taking the time to read this question.

• If I understand what it is you wanted to ask, it's "Is there a mathematical rule for this?" Certainly you might try to rewrite the problem as $a = b+c$. Perhaps you should try to prove "the sum [of digits?] of every 'a' value is $18$." Sep 26, 2018 at 19:54
• It's easy to prove that the sum of the digits of $a$ must be either $9$ or $18$ by casting out nines. I don't see a quick way of eliminating $9,$ but that doesn't mean there isn't one. Sep 26, 2018 at 20:01
• Actually, it's easy to eliminate $9$ as a possible sum of the digits of $a$. I'm thinking of the requirement as $a=b+c.$ If the sum of the digits of $a$ is $9,$ the leading digit is $6$ at most, and then the other digits of $a$ must be $2$ and $1$. The smallest unused digits are $3$ and $4,$ so this is not possible. Using a smaller leading digit for $a$ only makes things worse. Sep 26, 2018 at 20:11
• BTW, you missed the following possible values of $a;\ 648,783,873$ which give another $32$ solutions in total. These were found by computer search. You've found all the other solutions, though. Sep 26, 2018 at 20:42
• @saulspatz Thanks for the interest in the question. I’ve updated it to include the 32 missed possibilities that you pointed out and to modify the question slightly. Also, can you clarify how the “casting out nines” method can prove that the sum of digits of “a” is either 9 or 18. I don’t understand this sorry. Sep 27, 2018 at 6:43

Casting out nines is an old method for checking arithmetic. It's based on arithmetic modulo $$9$$. What makes the method tick is that if we add up the digits of a positive integer $$n$$, the sum is congruent to $$n$$ modulo $$9$$. For example the sum of the digits of $$782$$ is $$17$$ and one can check that $$782\equiv17\pmod{9}$$ Indeed $$782=9\cdot85+17$$ Of course, we can add up the digits of $$17$$ and see that to see that $$782\equiv17\equiv8\pmod{9}$$ and that's how casting out nines is done. If the sum of the digits is not a one-digit number, we add up the digits of the sum, repeating the process until we do arrive at a one-digit number. Leet's call this the "digital root" of the number we started with.

Now, if we want to check the addition of a column of figures, we add up the digital roots of all the summands, take the digital root of that sum, and it should equal the digital root of the total. Of course, we if we made a mistake, and the difference between the correct answer and the answer we erroneously got is divisible by $$9,$$ casting out nines won't detect it.

Before explaining how this applies to your question, let me take a moment to explain about the digital roots. Suppose $$n=3472,$$ for example. Then, \begin{align} n&=3\cdot1000+4\cdot100+7\cdot10+2\\ &=3(999+1)+4(99+1)+7(9+1)+2\\ &\equiv3+4+7+2\pmod{9} \end{align}

Now, back to the question. Rewrite it as $$a=b+c$$ Each of the digits from $$1$$ to $$9$$ occurs once in the sum $$a+b+c$$ and the sum of the digits from $$1$$ to $$9$$ is $$45$$ so by looking at the digital roots, we have $$9|(a+b+c)=2a\iff 9|a$$ since $$2$$ and $$9$$ are relatively prime. Since $$a$$ has three distinct digits, the sum of the digits of $$a$$ can only be $$9$$ or $$18.$$

As I indicated in a comment, it's easy to exclude the possibility that the sum of the digits is $$9$$. The only possibilities are $$1+2+6,\ 1+3+5\text{ and }2+3+4.$$ In each case, it's easy to see that none of the $$3$$ digits could be the leading digit.

• Thank you so much for the explanation. I understand now how escaping nines work and why the sum of a is 18. Sep 27, 2018 at 15:38
• @JoeClinton Glad to hear it. Sep 27, 2018 at 15:54
• I am also wondering now what the significance of the number 336 for the number of possibilities of a and b is. I can get this number by doing nPr(9,3)/1.5 or 8*7*6 on a calculator but I can’t seem to see how this can be derived. Do you know how? Sep 27, 2018 at 17:46
• @JoeClinton I imagine it's just a coincidence. Given any number, you can find lots of ways to calculate it, but they don't necessarily mean anything. What I noticed however, is that there are always $8$ or $16$ possibilities for a given value of $a$. That's too many cases to be a coincidence. There ought to be a way to deduce it, I would think. Sep 27, 2018 at 21:05