My Adventures in Math and Technology
© Daniel Marvin.
Computing \(x^n\) can be done quickly when we leverage the following:
function rtlexp(x, n) y = 1 while n > 0 if isodd(n) y = x*y end x = x * x n = fld(n, 2) end y end