Calculating power of n with O(log n)
Understood O(log n) complexity