I have a machine that supports the arithmetic operations plus, minus (unary and binary), multiply, divide and exponent and can load single digit integer constants. Arithmetic operations are performed using floating-point, e.g., 3/2
returns 1.5
.
Given an integer constant, X, is there an efficient algorithm that will return an expression containing the minimum number of operators needed to calculate this value?
For instance, the constant 123
can be calculated using three operators as (2+9)^2+2
, but there is a two operator solution 5^3-2
.
I have a blog post providing more background and some numbers.
No comments:
Post a Comment