Tim Peters <t...@python.org> added the comment:
I don't have a problem with the trivial ring - I wasn't being that high-minded ;-) I was testing a different inverse algorithm, and in the absence of errors checked that minv(a, m) * a % m == 1 for various a and m >= 0. Of course that failed using pow(a, -1, m) instead when m=1. Offhand, I couldn't imagine a plausible use case for finding an inverse mod 1 - and still can't ;-) In abstract algebra, sure - but for concrete numerical computation? Oh well. In any case, testing (minv(a, m) * a - 1) % m == 0 instead appears to work for all non-error cases. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37893> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com