I can't understand the equation "$p-q=15-9\times$(the number of borrowing(s) of $p-q$)"

124 Views Asked by At

$9$ cards are given($i$-th card represents i) and following numbers $a$ and $b$ are defined by using all these 9 cards.

$a:=$ $5$ digits natural number which are given by concatenating $5$ cards.

$b:=$ $4$ digits natural number which are given by concatenating $4$ cards.

The last goal is to determine $a$ and $b$ such that $a-b=33333$ .

The following formulas are from the solution which I have.

$p,q:=$ Digit sums of a,b respectively.

And $a-b \equiv p-q\equiv 3 \times5\equiv6\pmod 9$ are satisfied.

$p+q=45 \equiv0\pmod 9$

$2\times p \equiv6 \pmod 9$

$p \equiv3 \pmod 9$

$15=1+2+3+4+5\leqq p\leqq5+6+7+8+9=35$

from above inequality,the candidates of $p =21,30 \quad(q=24,15 )$ .

Of course $p-q=15$ is true when the borrowing wasn't done.

And my problem begins from here.

The solution states $p-q=15-9 \times$(the number of borrowing(s) of p-q).

How could this proven?.

1

There are 1 best solutions below

4
On

Too long for a comment.

As you correctly deduced, we have only two cases $(p,q) = (21,24)$ or $(30,15)$. Suppose we write out the digits as $a = a_4 a_3 a_2 a_1 a_0$ and $b = b_3 b_2 b_1 b_0$.

In case of $(30,15)$, because $30-15 = 15 = digitsum(33333)$ already, we know when we do the subtraction there was no "borrowing" i.e. $\forall j \in \{0,1,2,3\}: a_j > b_j$ and in fact $a_j - b_j = 3$. This also immediately means $a_4 = 3$. Of the remaining digits $\{1,2,4,5,6,7,8,9\}$, there is no way to split them into $4$ pairs $(a_j, b_j)$ s.t. $a_j - b_j = 3$ for each pair. So there is no solution in this case.

Meanwhile, in case of $(21,24)$ there must have been two "borrowings". Each "borrow" effectively adds $9$ to $a$'s digitsum, because you subtract $1$ from one digit and add $10$ to the next lower digit. E.g. consider the much simpler example $55 - 8 = 47$, where we have

$$digitsum(55) = 5+5 = 10 \neq digitsum(8) + digitsum(47) = 8+4+7 = 19$$

But when the borrowing happens, it is as if the "new" digitsum is $4 + 15 = 19$, and we now have:

$$newdigitsum(55) = 4 + 15 = 19 = digitsum(8) + digitsum(47)$$

So back to the $(21,24)$ case, there are two "borrowings" because $21 + 2 \times 9 - 24 = 15$. So among $j \in \{0,1,2,3\}$, there are exactly two cases of $a_j < b_j$ and two other cases of $a_j > b_j$. Moreover, $a_4 = 3$ or $4$ depending on whether $a_3 >$ or $< b_3$. However, there still seems a lot of cases and I'm not sure how to find the answer(s).