Modular exponentiation keeps numbers small by reducing after each operation. This lesson pins the modulus and the starting value.

highlighted = computed this step

Why the modulus is present

The modulus keeps every intermediate value inside a small exact remainder set. Here the modulus is 33.

m=33m=33
Modular reductionThe ladder rows are recomputed from pinned base, exponent, and modulus.Modular reduction - 7^13 mod 33stepbitpriorsquaremultiplyresult01117711716131320134skip4314161313

Reduce the base

The base is 7, and it already reduces to 7 modulo 33.

7mod33=77\bmod{}33=7
Modular reductionThe ladder rows are recomputed from pinned base, exponent, and modulus.Modular reduction - 7^13 mod 33stepbitpriorsquaremultiplyresult01117711716131320134skip4314161313

Keep only remainders

After each square or multiply, the ladder keeps only the remainder modulo 33. That is why the table never needs the full power.

keep remainders mod 33\text{keep remainders mod }33
Modular reductionThe ladder rows are recomputed from pinned base, exponent, and modulus.Modular reduction - 7^13 mod 33stepbitpriorsquaremultiplyresult01117711716131320134skip4314161313

Start from one

The ladder starts with result 1 before reading exponent bits.

rstart=1r_{\text{start}}=1
Modular reductionThe ladder rows are recomputed from pinned base, exponent, and modulus.Modular reduction - 7^13 mod 33stepbitpriorsquaremultiplyresult01117711716131320134skip4314161313

Watch the first row

The first visible row squares start value 1, then multiplies by base 7 because the bit is 1. The row result is 7.

171\to7
Modular reductionThe ladder rows are recomputed from pinned base, exponent, and modulus.Modular reduction - 7^13 mod 33stepbitpriorsquaremultiplyresult01117711716131320134skip4314161313

Summary

Modular exponentiation keeps reducing after each operation, so every displayed row stays small and inspectable.

reduce after every step\text{reduce after every step}
Modular reductionThe ladder rows are recomputed from pinned base, exponent, and modulus.Modular reduction - 7^13 mod 33stepbitpriorsquaremultiplyresult01117711716131320134skip4314161313