Find the remainder after division by a modulus. This is toy arithmetic only, not deployable security.

cryptography The values in this lesson are deliberately tiny so every modular arithmetic step can be checked exactly.

Example

Find the remainder after division by a modulus.

highlighted = computed this step

Step 1 — Set up

Set up the exact toy cryptography values.

a, m(17, 5)\begin{array}{c|c}\text{a, m}&\text{(17, 5)}\end{array}

Step 2 — Quotient

Compute the highlighted cryptography value.

a // m3\begin{array}{c|c}\text{a // m}&\hlmath{\text{3}}\end{array}

Step 3 — Remainder

Compute the highlighted cryptography value.

a mod m2\begin{array}{c|c}\text{a mod m}&\hlmath{\text{2}}\end{array}

Step 4 — Result

Compute the highlighted cryptography value.

residue2\begin{array}{c|c}\text{residue}&\hlmath{\text{2}}\end{array}