Number of possible combinations which sum to X using only y specific numbers

203 Views Asked by At

I have to find out the possible number combinations which sum up to $X$ using $Y$ specefic digits only, as in $Y$ means using $3$ digits, that too specefied such $1,2,3$ only. For example, in a specefic case where, $X = 5$ and $Y = \{1,2,3\}$ only so my possible number of combinations, keeping in mind, every different combination will also be counted different would be as follows:

(1 1 1 1 1)

(1 1 1 2)

(1 1 2 1)

(1 2 1 1)

(2 1 1 1)

(1 2 2)

(2 2 1)

(2 1 2)

(1 1 3)

(1 3 1)

(3 1 1)

(2 3)

(3 2)

which now sums up to be $13$, I came up with something although it was related to fibonacci series, any specefic relation with the above.

1

There are 1 best solutions below

0
On

HINT:

First look at the different ways you can partition $X$ (Ferrer diagrams can be helpful to pick specific ones "having only some specific integers")

Then you can use permutation of a multiset to find the number of arrangements.

Hope this helped