This is still WIP. There are a few missing details, still I think it's better than nothing. Feel free to edit in the missing details.
Given a problem of SUBSET-SUM
. We have a set of A
={a1,a2,...,an} numbers, and another number s
. The question we're seeking answer to is, whether or not there's a subset of A
whose sum is s
.
I'm assuming that the 24-game allows you to use rational numbers. Even if it doesn't, I think that it is possible to emulate rational numbers up to denominator of size p
with integers.
We know that SUBSET-SUM
is NP-complete even for integers only. I think the SUBSET-SUM
problem is NP
-hard even if you allow treating each ai as a negative number. That is even if A
is of the form A
={a1,-a1,a2,-a2,...,an,-an}. This is still a wrinkle I need to iron out in this reduction.
Obviously, if there's a subset of A
with sum s
, then there's a solution to the 24
-problem for how to reach using A
to s
. The solution is only using the +
sign.
The problem is, what happens if there's no solution which only uses the +
sign, but there is a solution which uses other arithmetic operations.
Let us consider the following problem. Let's take a prime p
which is larger than n
, the total number of elements in A
. Given an oracle which solves the 24
-problem, and a SUBSET-SUM
problem of A
={a1,a2,...,an} and s
. We'll ask the oracle to solve the 24
-problem on
A
={a1+(1/p),a2+(1/p),...,an+(1/p)}
for the following values:
s1=s+1/p,s2=s+2/p,...,sn=s+n/p.
If the solution includes multiplication, we will have a denominator larger than p
in the end result, and thus we will not be able to reach any si.
Given an arithmetric expression that contains aiaj=x+(1/p2), It is impossible that the denominator p2 would "cancel" out, since there are at most n
elements in the summation, and thus the numerator would never reach p
, since p>n
.
THIS IS NOT QUIT RIGHT! The expression aiaj-akal will be an integer, and therefor our oracle might return answer which includes two multiplications one negative and one positive.
What about division? How can we be sure no division will occur. Find another prime q
which is different than p, and larger than the largest ai times n
. Multiply all answers by q
. The set A
will be
A
={qa1+(1/p),qa2+(1/p),...,qan+(1/p)}
We will look for the following values:
s1=qs+1/p,s2=qs+2/p,...,sn=qs+n/p.
In that case, ai/aj will be smaller than the minimal element in A
, and therefor the end result which will contains ai/aj will never be one of the si we're looking for.