Fastest algorithm to split any integer into the shortest possible equation consisting of add/multiply/power of numbers 1, 3, 5, and 7

17 Views Asked by At

I am trying manually to find an answer but don't see a pattern:

1
1+1=2
3=3
1+3=4
5
3+3=6
7
7+1=8
3^3=9
7+3=10 (or 5*2)

Does such a pattern exist where it would be efficient to take a number such as 765432 and break it into an equation only consisting of 1, 3, 5, and 7? My mental process is to try a bunch of different things, come up with a few equations, and then determine which is the shortest. Is there a better approach?