Calculate Exponents bit by bit
JavaScript (ES7), 55 bytes

f=(a,b,c=2)=&gt;b&gt;1?b%c?f(a,b,c+1):a+['^'+b,f(a**c,b/c)]:a


Uses , in place of = (2^15,8^5,32768).

Test cases



f=(a,b,c=2)=&gt;b&gt;1?b%c?f(a,b,c+1):a+['^'+b,f(Math.pow(a,c),b/c)]:a
g=(a,b)=&gt;console.log(`f(${a}, ${b}):`,f(a,b))

g(4,8)
g(5,11)
g(2,15)




Note: the snippet uses Math.pow instead of ** for cross-browser compatibility.