How many numbers have a units digit that equals the digit sum of previous digits

combinatorics

How many numbers have a units digit that equals the digit sum of previous digits?

  • No negative number solutions.
  • No more than 3 digits
  • Digit sum of all digits except the units digit must equal the units digit

Feel free to solve without these specific restrictions

Examples of a solution:

  • 11, 22, 33…
  • 101, 202, 303…
  • 112, 224, 336…
  • 123, 246
  • 0

(347 is a solution because 3+4=7)

How many total numbers exist? And what are some requirements for solutions other than this rule?

I'm in high school and I thought of this problem and wasn't sure what field of math it would fall into but I think its an interesting challenge.

Edits:

  • @JMoravitz came up with a number of 55 solutions with 3 digits, but I was wondering if there could be a general summation for a variable number of digits.
  • @aqualubix found general expression for the number of solutions with n digits.

Best Answer

If we exclude $0$ and remove the limit on the number of digits appearing we can find a nice stars and bars approach to get the number. If the final digit is $9$ we start with $1111111119$. There are eight potential spaces for bars between the $1$s and after choosing which to receive bars you sum up the $1$s between them, so $11|111|11119$ would give us $2349$. As there are eight spaces there are $2^8=256$ numbers ending in $9$. Similarly, if the last digit is $n$ there are $2^{n-1}$ numbers, so the total number is $\sum_{i=1}^9 2^{i-1}=2^9-1=511$. This is the same approach suggested by lulu's comment.