Generate equation with the result value closest to the requested one, have speed problems
问题 I am writing some quiz game and need computer to solve 1 game in the quiz if players fail to solve it. Given data : List of 6 numbers to use, for example 4, 8, 6, 2, 15, 50. Targeted value, where 0 < value < 1000, for example 590. Available operations are division, addition, multiplication and division. Parentheses can be used. Generate mathematical expression which evaluation is equal, or as close as possible, to the target value. For example for numbers given above, expression could be : (6