The pow()
function returns the result of raising a number(base) to a certain power(exponent), i.e., base^exponent.
pow(base, exp)
The base
is the numeric value that we want to raise to some power, while the exp
i.e exponent, is the value that indicates to how many times the base should be multiplied by itself.
When both base and exponent are integers, the function accepts an optional third argument , the modulus
, which is used to calculate the result of the expression in modula arithmetic.
pow(base, exp, mod)
The expression gets solved as (base ^ exp % mod).