3
$\begingroup$

I have this problem where I want to add some numbers together to make a final number. I ask how many ways are there to make this final number using exactly k numbers? Here is the condition:

(1) The numbers are in a consecutive sequence but with a number missing like 1,3,4 or 2,3,4,5.

(2) I want to have at least one of each number.

(3) I can use any number as many times like the permutation like 1,1,3,4,4.

I have this examples:

I want to make final number 12 with 1,3,4 in exactly 5 numbers. I can do only 1,1,3,3,4. And can do it 5!/(2!2!)=30 ways.

I want to make final number 21 with 1,2,3,4,6 in exactly 8 numbers. I can do only 1,1,2,2,2,3,4,6 or 1,1,1,2,3,3,4,6. I can do both in 8!/(2!3!)=3360 ways.

I think it involves partitions or combinations but I can't find a nice or any formula to do it. Is it possible to do this?

Thank you in advance. Sorry for the format I am new to maths exchange.

$\endgroup$
2
  • $\begingroup$ Note that the second constraint is easily eliminated by subtracting one copy of each number from the target. E.g. the first example becomes making 4 with exactly 2 numbers drawn from 1,3,4; the second example becomes making 5 with exactly 3 numbers drawn from 1,2,3,4,6. $\endgroup$ Commented May 30, 2018 at 7:20
  • $\begingroup$ Were it so easy. I have tried that. And we miss all the rearrangements of those numbers. Because sure you get 1,3,4 then you take 2 numbers to make 4 like 1,3. But Then you can't arrange the first 3 numbers 1,3,4 and 1,3 separately. Otherwise we would be done. That is why the second constraint cannot be removed UNLESS I only choose from exactly 1 number. $\endgroup$ Commented May 30, 2018 at 7:43

1 Answer 1

0
$\begingroup$

Your question is similar to this one if not the sameFinding all possible combinations of numbers to reach a given sum

i wanted to comment but couldnt so i had to put it as an answer

$\endgroup$
1
  • $\begingroup$ Oh thank you for the answer! It may come in handy but this is not what I am looking for. The solution does not allow duplicates or account for permutations. $\endgroup$ Commented May 29, 2018 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .