I have a problem with the following function. I am trying to implement the "exponentiation by squaring", which is a general method for fast computation of large po