[issue457066] pow(a,b,c) should accept b<0

Thomas Dybdahl Ahle report at bugs.python.org
Sun Jan 22 10:24:15 CET 2012


Thomas Dybdahl Ahle <lobais at gmail.com> added the comment:

For anyone who finds this through google,
if you are finding the inverse mod a prime, you can use fermats little theorem: pow(a, -1, mod) = pow(a, a-2, mod).
(You also need that mod doesn't divide a).

----------
nosy: +Thomas.Dybdahl.Ahle

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue457066>
_______________________________________


More information about the Python-bugs-list mailing list