mathlesstraveled.com
Modular exponentiation by repeated squaring
In my last post we saw how to quickly compute powers of the form $latex a^{2^k}$ by repeatedly squaring: $latex (a^2)^2 = a^4$; then $latex (a^4)^2 = a^8$; and so on. This is much more efficient th…