Powers of 2:
2^ -3 = 1/8
2^ -2 = 1/4
2^ -1 = 1/2
2^ 0 = 1
2^ 1 = 2
2^ 2 = 4
2^ 3 = 8
So 8 expressed as a power of 2 is 2^3.
You could say the answer is 2^ (log(8) / log(2)), but since log(8)/log(2) = 3 it becomes 2^3
In general terms if you're asking for x expressed as a power of y, the answer will be y^ (log(y) / log(x)).
It's the same for all conversions if x and y are both positive numbers.