Mark Dickinson <dicki...@gmail.com> added the comment:
> it's still a bit subtle that you have to use pow(a, -1,p) instead of pow(a, > p-2, p) to let the modular inverse be computed efficiently That's not 100% clear: the binary powering algorithm used to compute `pow(a, p-2, p)` is fairly efficient; the extended gcd algorithm used to compute the inverse may or may not end up being comparable. I certainly wouldn't be surprised to see `pow(a, p-2, p)` beat a pure Python xgcd for computing the inverse. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36027> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com