Modular inverse: Difference between revisions

Content added Content deleted
imported>Koen
(add builtin function "pow" to python)
Line 2,801: Line 2,801:


=={{header|Python}}==
=={{header|Python}}==

===Builtin function===
Since python3.8, builtin function "pow" can be used directly to compute modular inverses by specifying an exponent of -1:
<syntaxhighlight lang="python">>>> pow(42, -1, 2017)
1969
</syntaxhighlight>


===Iteration and error-handling===
===Iteration and error-handling===