title: Repetitive squaring (python)
body: <p>I implemented the <a href="http://en.wikipedia.org/wiki/Exponentiation_by_squaring" rel="nofollow">exponentiation by squaring algorithm</a> in Python</p>
  
  <pre><code>    (x,n)=(input(),input())
  
      def exp_itr(x,n):
          r=1
          while n!=0:
            if n%2==1:
              r=r*x
              n=n-1
            x=x*x
            n=n/2
      return r
  </code></pre>
  
  <p>And now, I need the recursive algorithm. How can I do it?</p>