Algorithm: modexp(a,k,n) Input : a,k,n where 0 ≤ a < n, k ≥ 0, n > 1 Output: x such that x = a^k mod n