2

First of all, my question is very similiar to this one: How many numbers between $100$ and $900$ have sum of their digits equal to $15$? but i didn't quite understand how to adapt it to my problem, so heres my problem:

Let's say i have a digit system with the basis 15 and 4 available digits. How many numbers are there between 0000 and FFFF where the sum of the digits equals 15. I'm not only interested in the answer, but also how to get there.

2 Answers2

1

If the sum of the digits adds up to 15 and each digit can go up to 15 (so we don't have to worry about any upper limits) and we have 4 digits to work with, the problem can be solved with a stars and bars approach I believe.

Imagine, say, 15 stones laid in a row and three dividers. Wherever the dividers are will separate the stones into numbers for each digits and the sum of the digits will always be 15. And we are arranging 18 objects (15 stones plus 3 dividers). So the solution is $${18\choose15}=816$$

ETA: For example:$$***************|||=F000\\***|***|***|******=3336$$

turkeyhundt
  • 7,733
0

In base $15$, Each digit can be any value between $0$ and $14$. So the question becomes, "how many ways can we split $15$ into four parts (with order counting, so that $(1,2,3,9)$ is considered different from $(9,2,3,1)$ and with none of the parts the whole 15?

Splitting a number into $n$ parts is like taking $n$ balls in a line, and inserting $n-1$ separating walls at $n-1$ points among the line of balls. The trick in this problem is to pretend each ball-or-wall is one "thing"; then there are $15+3 = 18$ things to arrange, and you care where in that line of 18 things the 3 walls appear. This is just 18 choose 3, or $\binom{18}{3}$.

But in our case, we have to discard the arrangements where all 15 balls are in one partition; there are four such arrangements (corresponding to the improper "numbers" $(15,0,0,0)$, $(0,15,0,0)$, $(0,0,15,0)$ and $(0,0,0,15)$.

So the answer to your problem is $$ \binom{18}{3} - 4 = \frac{18\cdot 17 \cdot 16}{3\cdot 2\cdot 1}-4 = 812 $$

Mark Fischler
  • 41,743