Wonder if someone could come up with general solution within these constraints.
Wonder if someone could come up with general solution within these constraints.
This may be easier to see in a stack machine / RPN model. An expression is a list of operations, drawn from a finite set, each of is either “push the number 2” or something that decreases the stack size by at least 1. And you need exactly 4 pushes. So a valid expression has four pushes and at most 3 other operations, because otherwise the stack would underflow. This gives a finite number of possible expressions, but there are an infinite number of integers, so it can’t work.
Not with only four inputs you can't. You can only have three operations, because you have no way of getting another input parameter.
And yes I think your analysis that only allowing n-ary funcs with n>=2 would make general solution very much impossible since you can only have a limited number of inputs.