How many "$m$" digit numbers with digits that sum to "$N$"

252 Views Asked by At

How many "$m$" digit numbers can be formed whose digits sum to "$N$"?

  • The collection of these numbers can have preceding zeros .
  • The collection of these numbers cannot duplicate multiplicity of digits except when the digit is zero.

e.g. when $m = 5$ and $N = 5$

  • If $00023$ is chosen, then $00041$ is legal for another choice.

  • If $00023$ is chosen, then $00203$ is not legal for another choice.

I appreciate any insight into solving this problem. Thanks in advance:)


Edit:

I was told that my question is better posed if I call what I called "numbers" above, functions of the form:

$$f:\quad \{0,1,\ldots,9\}\to{\mathbb N}_{\geq0}$$ ("multisets") satisfying $\sum_{k=0}^9 k f(k)=N$.


Edit $2:$

I'm realizing now that my original question is very general and opens up another dimension of difficulty.

Therefore, I propose specifying this problem such that $$N=m$$ AND $$f:\quad \{0,1,\ldots,k\}\to{\mathbb N}_{\geq0}$$ $$k\quad \epsilon \quad {\mathbb N}_{\geq0}$$

The motivation for this question is to evaluate the number of passive electrical component combinations that use each of $m$ elements in each combination as $N$ grows.

  • each component is of like value and type
  • each combination is restricted to be a series connection of parallel combinations.

The function $f$ , introduced above, has values at each $f(k)$ that represent the number of parallel elements in the $k^{th}$ link in the series connection.

1

There are 1 best solutions below

2
On BEST ANSWER

It actually seems that you are searching for a number of partitions of number $N$ using only digits form $1$ to $9$ (and including $0$s) and that have a limited top length of $m$!

Since partitions cannot be easily directly calculated, instead they are usually computed.

I believe this can be computed in GAP using RestrictedPartitions(N,[0..9],m);

Here are some of the solutions I have found for your $N$ sum and $m$ digits:

$$ \begin{array}{c|c} & m & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline N & & \\ \hline 1 & & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & \\ \hline 2 & & 1 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & 2 & \\ \hline 3 & & 1 & 2 & 3 & 3 & 3 & 3 & 3 & 3 & 3 & 3 & \\ \hline 4 & & 1 & 3 & 4 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & \\ \hline 5 & & 1 & 3 & 5 & 6 & 7 & 7 & 7 & 7 & 7 & 7 & \\ \hline 6 & & 1 & 4 & 7 & 9 & 10 & 11 & 11 & 11 & 11 & 11 & \\ \hline 7 & & 1 & 4 & 8 & 11 & 13 & 14 & 15 & 15 & 15 & 15 & \\ \hline 8 & & 1 & 5 & 10 & 15 & 18 & 20 & 21 & 22 & 22 & 22 & \\ \hline 9 & & 1 & 5 & 12 & 18 & 23 & 26 & 28 & 29 & 30 & 30 & \\ \hline 10& & 0 & 5 & 13 & 22 & 29 & 34 & 37 & 39 & 40 & 41 & \\ \hline 11& & 0 & 4 & 14 & 25 & 35 & 42 & 47 & 50 & 52 & 53 & \\ \hline 12& & 0 & 4 & 15 & 30 & 43 & 54 & 61 & 66 & 69 & 71 & \\ \hline 13& & 0 & 3 & 15 & 32 & 50 & 64 & 75 & 82 & 87 & 90 & \\ \hline 14& & 0 & 3 & 15 & 36 & 58 & 78 & 93 & 104 & 111 & 116 & \\ \hline 15& & 0 & 2 & 15 & 38 & 66 & 91 & 112 & 127 & 138 & 145 & \\ \hline 16& & 0 & 2 & 14 & 41 & 74 & 107 & 134 & 156 & 171 & 182 & \\ \hline 17& & 0 & 1 & 13 & 41 & 81 & 121 & 157 & 185 & 207 & 222 & \\ \hline 18& & 0 & 1 & 12 & 43 & 88 & 139 & 184 & 222 & 251 & 273 & \\ \hline 19& & 0 & 0 & 10 & 41 & 93 & 152 & 210 & 258 & 297 & 326 & \\ \hline 20& & 0 & 0 & 8 & 41 & 98 & 169 & 239 & 302 & 352 & 392 & \\ \end{array} $$

Here is my Project I made and used to calculate the data in the table. Hope this was helpful to you.