chickadee » modular-arithmetic » modexpt

modulus a bprocedure

Computes a raised to the power of b modulo the given modulus, but does so far more efficiently than using

 (modulo (* a b) modulus).

If b is negative, the multiplicative inverse of a is raised to the power of (abs b).