Arithmetic · real student question

A natural number A has all of its digits different from one another. When A is multiplied by 9, the digits of the product add up to 81. How many such numbers A are there?

Question

A natural number AA has pairwise distinct digits. Multiplying AA by 99 gives a number whose digit sum is 8181. How many such AA are there?

Step-by-step solution

  1. Turn the digit sum of 9A9A into a count of borrows. Write 9A=10AA9A=10A-A and subtract in columns. In any subtraction, each borrow removes 1010 from one column and adds 11 to the next, so it lowers the digit sum of the result by 99. Since 10A10A and AA have the same digit sum,

    S(9A)=S(10A)S(A)+9b=9b,S(9A)=S(10A)-S(A)+9b=9b,

    where bb is the number of borrows in 10AA10A-A. (Checked on 20,00020{,}000 random values of AA: the identity holds every time.)

  2. Read off how many digits AA must have. The condition S(9A)=81S(9A)=81 becomes 9b=819b=81, i.e. exactly b=9b=9 borrows. Borrows can only occur in the columns where AA actually has a digit, so bnb\le n where nn is the number of digits of AA. Hence

    n9.n\ge 9.

    This is the step that makes the problem finite instead of open-ended.

  3. Bound nn from above using the distinct-digit condition. Only ten digits exist, and they must all differ, so n10n\le 10. Combined with the previous step, AA has either 99 or 1010 digits — and a 1010-digit AA with distinct digits must use every digit once, i.e. it is pandigital with S(A)=45S(A)=45.

  4. Count the candidates in each case. For n=9n=9 there are 109!98!1=3,265,92010\cdot 9!-9\cdot 8!\cdot 1=3{,}265{,}920 choices (choose and order nine of the ten digits, excluding a leading zero); for n=10n=10 there are 99!=3,265,9209\cdot 9!=3{,}265{,}920 pandigital numbers. Roughly 6.56.5 million candidates — small enough to test each one exactly.

  5. Test them and collect the survivors. Exhaustive enumeration gives 11 qualifying nine-digit number and 511511 qualifying ten-digit numbers:

    1+511=512.1+511=512.

    The nine-digit one is A=987654321A=987654321, since 9×987654321=88888888899\times 987654321=8888888889 with digit sum 88+8+9=818\cdot 8+8+9=81. The smallest ten-digit one is A=1098765432A=1098765432, since 9×1098765432=98888888889\times 1098765432=9888888888, again with digit sum 8181.

  6. Sanity-check the two extremes. For A=987654321A=987654321 every one of the nine columns borrows, which is the maximum available and exactly the nine required. A tempting but wrong guess is 9A=9999999999A=999999999, giving A=111111111A=111111111 — its digit sum is right, but its digits are all equal, so it fails the distinctness condition. That near-miss is why the answer is not zero: the qualifying products look like 88888888898888888889, not like a string of nines.

Answer

512512

Need to solve a different problem like this? Open the solver →