Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge

Name: Anonymous 2014-07-02 13:05

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 N. S is sum-free if for all a,b in S, a+b is not in S.

Now, let S be any set of nonzero integers. Find a subset of size > |S|/3.

You may use your favorite lisp language.

I've got a really nice solution for this one.

Name: >>11 2014-07-02 15:45

This gives |S|/3, or |S|/3 -1 'cause I'm stupid. The fix is easy, use Int($l/3)+1 combinations.

Name: Anonymous 2014-07-02 15:58

Does it have to be a proper subset? Because otherwise you can just return S.

Name: Anonymous 2014-07-02 16:04

>>15
No, it's not. Nowhere in the OP is it said that the subset has to be sum-free. Therefore, "S" is a valid answer. That's probably that clever solution that OP mentioned.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List