Encyclopedia > Talk:Exponentiating by squaring

  Article Content

Talk:Exponentiating by squaring

I guess we should present the iterative version of this algorithm:

 power(x,n) is computed as long as n is not negative
     assign 1 to result
     as long as n is positive
        assign x*x to x if n is even
        assign result*x to result if n is odd
        assign the truncated to next integer of n diveded by 2 to n

     return result

    
Robert Dober 2003-07-05 MEDST


Never mind, and there is even an error in my algorithm, really well done Robert, sorry for the noise :(

Robert Dober 2003-07-05 MEDST



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Northwest Harbor, New York

... 37.6 km² (14.5 mi²) of it is land and 4.1 km² (1.6 mi²) of it is water. The total area is 9.81% water. Demographics As of the census of 2000, ...

 
 
 
This page was created in 38.1 ms