1

In how many ways we can have some natural numbers that their sum is equal to $n$ and none of them is greater than $k$, for given $n$ and $k$?

NOTE: We don't know the number of the elements.

Can anyone help me with this problem? I can't find anything on the internet. For example, for $n = 5$ and $k = 2$ the answer is $8$:

2 + 2 + 1, 2 + 1 + 2, 1 + 2 + 2, 1 + 1 + 1 + 2, 1 + 1 + 2 + 1
1 + 2 + 1 + 1, 2 + 1 + 1 + 1, 1 + 1 + 1 + 1 + 1
Kevin Long
  • 5,235
  • Where are your attempts, thoughts,... ?! You can start by looking at a small example. – callculus42 Mar 02 '17 at 13:36
  • Have a look at http://math.stackexchange.com/questions/938517/how-many-tuples-of-numbers-from-1-n-have-the-sum-of-its-elements-equal-to-n and https://en.wikipedia.org/wiki/Composition_%28combinatorics%29 – callculus42 Mar 02 '17 at 14:04

2 Answers2

2

How about using generating functions? The number of ways to add $m$ positive integers each of which is less than or equal to $k$ so that their sum is $n$ is the coefficient of $x^n$ in $(x+x^2+\ldots+x^k)^m$. So the coefficient of $x^5$ in $\sum_{m=1}^{5} (x+x^2)^m$ is the answer for your example, which is 8.

0

This problem is very closely related to the number of partitions of n (https://en.wikipedia.org/wiki/Partition_(number_theory)). So for k = n, the number of ways in which it can be done will approximately be $$\frac{1}{4n \sqrt{3}}exp(\pi \sqrt{\frac{2n}{3}})$$ Refering to the restricted partitions section may give further insight into the problem Edit : I found a problem which is a special case of this problem, which has a solution Number of partitions of $2n$ with no element greater than $n$

  • I don't think this is answer to my question. I edited the statement could you please read it one more time? thank you – Zhu xing Mar 02 '17 at 13:49
  • It is pretty much the same. But, looking at your latest edit I assume that you are looking for all permutations as well. I am not claiming that this is the answer but I feel it could point you in the right direction. Sorry if this added no value –  Mar 02 '17 at 13:52