you have a flashlight that takes 2 working batteries . you have 8 batteries but only 4 of them work . what is the fewest number of pairs you need to test to guarantee you can get the flashlight on ?
if you break the batteries into 3 groups : two groups of 3 and one group of 2 . by doing this you guarantee that one of the groups has 2 working batteries . both of the groups of 3 have 3 possible combinations of 2 batteries and the group of 2 only has 1 combination . so , 3 + 3 + 1 = 7 tries at most to find two working batteries .
add(multiply(add(2, const_1), 2), const_1)