[Math] Number of ways to add up to a number without repetition (order does not matter)

combinatoricsinteger-partitions

I have a number x and want to find how many ways there are to add up to that number using the y numbers from numbers 1-z.
for example, for x=15 y=3, z=9, there are 8 ways to add up to 15 using 3 numbers chosen from 1-9 without repetition (and order does not matter):

    1,5,9
    1,6,8
    2,4,9
    2,5,8
    2,6,7
    3,4,8
    3,5,7
    4,5,6

How can i generalize this formula?

Best Answer

@jenny :I do not a see a formula in your post that you expect to generalize.

We are counting partitions of $x$ with $y$ parts and the largest part not exceeding $z$.

  1. One way is to use recursive formulation as pointed out by @Kevin Carlson.

  2. Another quick way on a computer is to use the generating function: $$\sum_{\text{over }y\text{-element subsets of }[z-1]}\left( \prod_{\text{over elements of a y-element subset}}\frac{1}{1-n^s} \right)$$and then look at the coefficient of $n^{x-y}$ where $[z-1]=\{1,2,\dots, z-1\}$

Related Question