How to find the closest to a given number N to the power of X? Let's say we have a number 4923 and we want to find the closest $n^x$
2 ^ 12 = 4096 but it's not the closest possible  $n^x$, for example 17 ^ 3 = 4913 is closer to 4923
How do we find the closest $n^x$ to a given number without bruteforce? Let's assume it's a positive integer of 4 digits long, as an example

Here is an algorithm which is not brute force:
Given a number $N$ (to which we need to find the closest power)
Consider numbers of the form $$A^{B}$$
For $B \in \{1, 2, \dots, 1+ \lfloor\log_2 N\rfloor]\}$
Fix $B$, then do a binary search for $A$ to figure out which is the closest.
This will be an $O(\log^2 N)$ operations algorithm.
