I know this question has been asked here a couple of times.
We have four charged batteries, four uncharged batteries, and a radio which needs two charged batteries to work. We do not know which batteries are charged and which ones are uncharged. What is the least number of attempts that suffices to make sure the radio will work? (An attempt consists of putting two batteries in the radio and checking if the radio works or not).
It also has a brilliant solution using graph theory, but I'm interested in general problem, as it can be applicable to variety of other things.
My question is: What approach would be optimal to take if there were $n$ number of batteries, out of which $m$ batteries are charged, and most important: $k$ working batteries were needed start the radio?
EDIT: What I'm trying to do is bring some of the optimization to the program that I have. It's not about batteries, but this analogy helps me reason about it. I'm not only interested in the number of combinations (even though it's really helpful), but also the exact combinations.
I was thinking about example $k = 6$, and $n = 48$, and let's say $m=28$. I figured that dividing the batteries into groups of 8 like:
1 2 3 4 5 6
1 2 3 4 7 8
1 2 5 6 7 8
3 4 5 6 7 8
would require 2 of those not working in order not to fire, and then divided the complete pile into 6 smaller piles, then I thought about combining the piles in order to maximize the number of the broken batteries required to drop the combination set, and this is where I know I'm not doing something optimal and that it must exist mathematical approach to the problem.
I also figured out based on Daniels answer that this is not a trivial thing, and I am willing to accept the answer which points me to the right direction. (with $k,n,m$ from example above or with general case)