The documentation about the pow(base, exp[, mod]) function says,
"If mod is present and exp is negative, base must be relatively prime to mod. In that case, pow(inv_base, -exp, mod) is returned, where inv_base is an inverse to base modulo mod."
I don't understand the line at all and also how it works. The provided example is as follows:
>>> pow(38, -1, mod=97) 23 >>> 23 * 38 % 97 == 1 True Shouldn't it behave like (38**-1)%97 = 0.02631578947368421 ?
If I try to go from 23 * 38 % 97 == 1 to backward, I don't know what's the inverse of modulo.
Can anyone kindly give me a clear explanation of how it ended being 23? A mathematical explanation will be highly helpful.
TypeError: pow() takes no keyword argumentsis the error i get when i run it