If you have 7 integer variables, e.g. a, b, c, d, e, f, g, and you can use each at most once in an expression with the operators +, -, *, / (integer division), how many unique expressions can be formed?
E.g. (a - b) * c + f is mathematically the same as:
c * (a - b) + f
f + (a - b) * c
f + c * (a - b)
so they all correspond to a single unique expression.
If there was one variable, there are 7 unique expressions.
With two variables, I think there are 133 unique expressions.
I don't know the answer (yet), and I very much doubt anyone can find a closed form formula for the general problem. About the context where this problem originated, I suspect it was intended to be virtually unsolvable... (and deceptively mediocre-looking)
Question
voider
If you have 7 integer variables, e.g. a, b, c, d, e, f, g, and you can use each at most once in an expression with the operators +, -, *, / (integer division), how many unique expressions can be formed?
E.g. (a - b) * c + f is mathematically the same as:
c * (a - b) + f
f + (a - b) * c
f + c * (a - b)
so they all correspond to a single unique expression.
If there was one variable, there are 7 unique expressions.
With two variables, I think there are 133 unique expressions.
I don't know the answer (yet), and I very much doubt anyone can find a closed form formula for the general problem. About the context where this problem originated, I suspect it was intended to be virtually unsolvable... (and deceptively mediocre-looking)
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.