>>11,12combinations is a nice function (or method or prodecure, or whatever the proper terminology is :P). What I understand of this is that you are checking all sets of cardinality |S|/3 + 1 and find a sumfree one. The problem is, even though I can guarantee to you the existence of a sum-free set with more than |S|/3 elements, I'm not saying you can find one for all k > |S|/3. k is to be found as well as the set (the spec in
>>1 does not require this, but your function depends on it). So you need to alter your function to continue searching for sum-free subsets starting from |S|/3 + 1 and going up to |S|, until you (surely) hit one.
>>12,13,16No the spec was wrong, sigh... I hate myself for giving you a wrong spec. I will retype this so that you don't get the wrong idea, excuse the lack of bbcode.
A set of integers is sum-free when addition always gets you out of the set (i.e. x + y = z has no solutions -- in other words S + S and S are disjoint). Formally, let S be a subset of Z. S is sum-free if for all a,b in S, a+b is not in S.
Now, let X be any set of nonzero integers. Find a subset S of X, such that S is sum-free and size(S) > size(X)/3.
In short, your program is given X and produces S.
Anyway I won't post the solution yet as to give you some time and not ruin this for anyone else who wants to try.