.. _sphx_glr_api_gallery_number_theory_modular_arithmetic:
Modular arithmetic
--------------------
The extended Euclidean algorithm, modular inverses, and fast modular
exponentiation.
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /api/gallery/number_theory/modular_arithmetic/images/thumb/sphx_glr_plot_01_euclidean_algorithm_thumb.png
:alt:
:doc:`/api/gallery/number_theory/modular_arithmetic/plot_01_euclidean_algorithm`
.. raw:: html
Euclid's algorithm and Bézout's identity
.. raw:: html
.. only:: html
.. image:: /api/gallery/number_theory/modular_arithmetic/images/thumb/sphx_glr_plot_02_toy_rsa_thumb.png
:alt:
:doc:`/api/gallery/number_theory/modular_arithmetic/plot_02_toy_rsa`
.. raw:: html
A toy RSA encryption/decryption round trip
.. thumbnail-parent-div-close
.. raw:: html
.. toctree::
:hidden:
/api/gallery/number_theory/modular_arithmetic/plot_01_euclidean_algorithm
/api/gallery/number_theory/modular_arithmetic/plot_02_toy_rsa