Today I ran into a this relatively simple (At least from my perspective ) problem. Basically the task is to be able to express any number using only a single number an any combination of arithmetic operations, square roots, exponentiation or factorials. To further elaborate I will make an example.
The input of the program would be a number 57 and a 8. The solution would be expressing the number 57 using only 8s and any of the defined operations.
In this case the number 57 could be expressed as 57 = (8+8+8+8+8+8+8)+8/8 Alternatively if we had the number 25 and 3 as an input, we could also do 25 = 3^3 - 3/3 - 3/3
The task is to define the input number with a similar method mentioned above, using the least amount of operations.
The person who created this problem defined it as difficult and no matter how hard I think about it, I just can not find a reason why. In most cases the problem will spin around simple integer factorization and in special cases, using factorials (With big numbers) or exponentiation will yield a less lengthy result.
What I am asking for is if there is any better, more efficient method to solve this problem and whether I am missing something obvious which would make this problem look as "Difficult" as it was defined.
Thanks for the answers in advance.