2

I had this challenge question for my perms and combs homework, but I am a bit unsure on how to go about solving it.

How many $7$-digit numbers have a digit sum of $11$?

To do this problem, I tried setting the boundaries for some digits. So, there are in total $8×9×9×9×9×9×9=4251528$ $7$-digit numbers, with a minimum digit sum of $1$ and a maximum sum of $63$.

Order of the digits is used in this equation, so I think need to use permutations, but I am stuck on what $n$ and $r$ would be for the equation, as the digit $0$ cannot be the first digit, and the sum of the digits must total $11$.

I would like some help in how to solve it.

  • 1
    $11$ is pretty small...I guess I'd look at the maximal digit. If it's $9$, then you either have only $9,2$ or $9,1,1$. Easy to count. And so on. – lulu Sep 24 '23 at 00:54
  • @lulu Yes, I understand this method, but is there a faster way to do this? – lightningjay Sep 24 '23 at 00:56
  • My first thought was to do it recursively, but I bet the suggestion I wrote is much faster. – lulu Sep 24 '23 at 00:56
  • ok, then, if $9$ is one of the digits, and $2$ is the other, there are $\frac {7!} {(7-2)!}$ cases that can work, or am I doing this wrong? – lightningjay Sep 24 '23 at 01:01
  • because if I am doing this method for all cases, I think it would take quite a while – lightningjay Sep 24 '23 at 01:03
  • 1
    The $9,2$ case has $2\times 6=12$ examples. You need the lead digit to be either $2$ or $9$ so the factor of $2$ tells you which it is. Then the other one has to appear in one of the $6$ other digits, so that's the factor of $6$. – lulu Sep 24 '23 at 01:05
  • I think you are looking for a magic solution that doesn't exist. But I might be missing something...so, good luck! – lulu Sep 24 '23 at 01:05
  • 1
    Your course should have provided you with a way to solve this. For example, represent each number as $$D_i(x) = 1+x^1+ \ldots+x^9$$ and then multiply $$D_i(x) \quad (\text{for} \ i \in {1,\ldots,7}).$$ Then look at the coefficient of $$x^{11}$$. – Ben123 Sep 24 '23 at 01:07
  • 1
    Personally, I would begin by finding the number of partitions of $11$ (which can be calculated using a generating function), then exclude those with any parts exceeding $9$. I'd then separate the remaining partitions into two sets: one containing the partitions with at least one part equal to $0$, the other containing partitions with no parts equal to $0$. From there I would apply permutations, being careful with the partitions in the first set to account for the number of zeroes – H. sapiens rex Sep 24 '23 at 01:10
  • Alright, I will try and solve this problem with your strategies. I will come back here if I don't have a clear solution or need verification for it. – lightningjay Sep 24 '23 at 01:14
  • Qualification, I am not sure what I wrote exactly solves it (but something along those lines), but as @H.sapiensrex said, it should be possible to solve this using generating functions.

    One reference to use: Ralph P. Grimaldi:s "Discrete and Combinatorial Mathematics: An Applied Introduction".

    – Ben123 Sep 24 '23 at 01:16
  • What is a generating function? I do not think that I have covered this in class – lightningjay Sep 24 '23 at 01:18
  • Oh, hm, I have not thought this problem through thoroughly, but I think being familiar with generating functions would be nice for you. But if you have not covered it, it is possible the teacher wants you to solve this using other methods (covered in class).

    For more information on generating functions, see the book I referenced (and there is always wikipedia).

    – Ben123 Sep 24 '23 at 01:20
  • 3
    @lightningjay Have you learnt the Star and Bars method? The problem is equivalent to putting $11$ balls into $7$ urns. Note that the first urn must be non-empty and none of the urns contain $10$ or $11$ balls. – Li Kwok Keung Sep 24 '23 at 01:56
  • I second the comment of @LiKwokKeung. For Stars and Bars theory, see this article and this article. For help dealing with the upper bound of $~9,~$ on all of the variables, and the lower bound of $~1~$ on the variable $~x_1,~$ see this answer. – user2661923 Sep 24 '23 at 02:16
  • If you have programming skills, you can calculate the answer by brute force very quickly. With that, you can verify the answer against your meticulous and carefully reasoned hand computation. – Nayuki Sep 24 '23 at 16:42

1 Answers1

4

You want to find the number of solutions of $x_1+x_2+x_3+x_4+x_5+x_6+x_7=11$ in non-negative integers with some constraints. The first constraint is that $x_1 \geq 1$ so instead we'll seek the number of solutions of $y_1+x_2+x_3+x_4+x_5+x_6+x_7=10$ with some constraints, where $y_1+1=x_1$.

Stars and bars tells us there are $\binom{16}{6}$ unconstrained solutions to this equation. We know that $y_1 \leq 8$, so let's determine how many solutions are forbidden because $y_1 \geq 9$. There are $7$ such solutions.

Now let's determine how many solutions are forbidden because $x_n \gt 9$ for some $n$ with $2 \leq n \leq 7$. There is exactly $1$ such forbidden solution for each $n$. Thus, there are $13$ forbidden solutions to our unconstrained equation.

There are, therefore $\binom{16}{6}-13=7995$ seven-digit (decimal) numbers with digit sum $11$.

Robert Shore
  • 26,056
  • 3
  • 21
  • 49