This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients BTaskaya, mark.dickinson, tim.peters
Date 2019-08-21.00:16:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566346582.92.0.933388051482.issue37893@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-08-21 00:16:22tim.peterssetrecipients: + tim.peters, mark.dickinson, BTaskaya
2019-08-21 00:16:22tim.peterssetmessageid: <1566346582.92.0.933388051482.issue37893@roundup.psfhosted.org>
2019-08-21 00:16:22tim.peterslinkissue37893 messages
2019-08-21 00:16:22tim.peterscreate