Compute (x raised to the power n) using recursion. plaintext Input: x=2, n=10 Output: 1024 Input: x=3, n=0 Output: 1 Input: x=5, n=3 Output: 125 The naive approach is to multiply by itself times.
But there's a faster way using the property: if is even if is odd This is called "fast exponentiation" or "exponentiation by squaring."