'Time complexity of a^n

I was learning about time complexity recently and I was wondering time complexity of a algorithm to compute a^n. My answer will be O(n). However, I was thinking about the divide and conquer method. As a^n/2 * a^n/2 = a^n. Is it possible to turn time complexity of an algorithm a^n into a algorithm with O(logn) time complexity but I was stuck thinking how would such an algorithm be and how would it works?

I would greatly appreciate if anyone could share their thoughts with me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source