title: Finding sum of x^k from k= 0 to n in O(logn) time
body: <p>So my question is how to do this in C more specifically. I'm aware that O(logn) usually means that we'll be using recursion by somehow splitting one of the parameters.</p>
  
  <p>What I'm trying to achieve is the sum of k = 0 to n of x<sup>n</sup>.
  for example exponent_sum(x, n) would be the parameters in this case.</p>
  
  <p>Then, </p>
  
  <p><code>exponent_sum(4, 4)</code> would be 4<sup>0</sup> + 4<sup>1</sup> + 4<sup>2</sup> + 4<sup>3</sup> + 4<sup>4</sup> = 341.</p>
  
  <p>I'm not sure where to start. Some hints would be really appreciated.</p>