Given a set of integers and operators, find if number is obtainable

185 Views Asked by At

Let's say I have a set of sequential integers $(x_1,x_2,x_3,x_4,\ldots,x_n)$ and operators $(+,-,\times,/,(,))$ (arithmetic operators and parenthesis).

Now say we can have any $t$ numbers from the set (repetition allowed), then, given a number $n \leq xn^3$ (since that's the max possible in our case), is there a straight-forward method of finding if $n$ is obtainable from our set of numbers and operators?

For example, if our set is $(1,2,3,4)$ and we can use $t=3$ numbers, then the max is $4\times4\times4 = 64$. now given a number, say $21$, we want to apply an algorithm to find out if that number is obtainable (in this case, $(3+4)\times3$), or not (like $22$).

Seems to me like one has to de-compose the number using the available set somehow, but I'm not sure how to proceed.

Thanks.

1

There are 1 best solutions below

3
On

Basically you are given a subset of $\mathbb Z$ and a bunch of functions $\mathbb Z_2\times \mathbb Z_2\mapsto\mathbb Z_2$ and you want to know if given an integer $m$ we can get to $n$ by taking two numbers from the set, applying one of the functions, then taking a number from from the set and applying the function to that number and so on....

The answer is that it is not possible, for example take one function: $f(x,y)=3x+1$ if $x$ is odd and $f(x)=\frac{x}{2}$ if $x$ is even.and let the set have only one number. We can't know if we can get to $1$ or not easily.