githubEdit

Exponentiation

Exponentiation

Basic

We can calculate the exponentiation using '**' operator in Python.

2 ** 4
# 16

6 ** 8
# 1679616

Using Pow Method in Python

The pow method can be used for the exponentiation.

pow(2, 4)
# 2 ** 4 = 16

Modular Exponentiation

In addition, we can find the remainder of dividing a rased value by a specific number. This may be sometimes used to find the secret key in key derivation functions, etc.

pow(2, 4, 6)
# 2 ** 4 % 6 = 4

Inverse

Last updated