[math-fun] minimising leaf-count
It is possible to write any integer as sums of expressions containing only digits 1 or 2 or powers of 2, so that the exponents are also such expressions. Cfr Bill Dubuque's funny transliterations a few years back. But is it feasible to minimise the 'leaf count' of the result by expressing {n} as {2^k}-{n-2^k} if the count of 1-bits exceeds the count of 0-bits in the binary representation of n? So, 14 becomes -2+2^(2^2) and not just 2+2^2+2^(1+2) What I aim for is an over-all minimised leaf-count, not a minimisation at each step. a trial on n= 30197521 could give: 1 + 2^2^2 + 2^2^(1 + 2) + 2^(-1 + 2^2^2) + 2^(2 + 2^2^2) + 2^(1 + 2 + 2^2^2) + 2^(2 + 2^2 + 2^2^2) + 2^(1 + 2^(1 + 2)) + 2^(2 + 2^(1 + 2)) + 2^(2 + 2^2 + 2^(1 + 2)) + 2^(2^2^2 + 2^(1 + 2)) + 2^(-1 - 2^(1 + 2) + 2^(1 + 2^2)) but I doubt if it is optimal. W.
participants (1)
-
wouter meeussen