Monday 20 March 2017

algorithms - Calculate constant using minimum number of operations on single digit constants

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

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...