[Home]Exponentiating by squaring

HomePage | Recent Changes | Preferences

Showing revision 1
Exponentiating by squaring is an algorithm used for the fast computation of large powers of a number x. The following recursive algorithm computes xn for a natural number n:

                      /  1;                      if n = 0 
     Power(x, n)  =  {   Power(x2, n/2);         if n is positive and even
                      \  x * Power(x2, (n-1)/2); if n is odd

Compared to the ordinary method of multiplying x with itself n-1 times, this algorithm speeds up the computation of xn tremendously.

The method works in every semigroup and is often used to compute powers of matrices, and, especially in cryptography, to compute powers in a ring of integers modulo q.


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions | View current revision
Edited December 10, 2001 2:04 am by AxelBoldt (diff)
Search: