liveBook · Manning

Modulo arithmetic

Modulo arithmetic is arithmetic in which values are identified as equivalent when they differ by a multiple of a fixed modulus.

How 3 Manning books explain it

Hacking Cryptography

Arithmetic in which values are identified according to their remainders modulo a specified integer.

How it is used
Uses modular reduction to implement linear congruential generator state transitions and recover their hidden parameters.
How deep it goes
Explains recurrence, inverses, negative remainders, and recovery equations, then stops short of broader modular-arithmetic theory.
Examples
Demonstrates clock wraparound, 7’s inverse modulo 12, Go’s negative remainder, and LCG parameter-recovery code.
What you can do after
Diagnose/debug with it by implementing modular state updates and handling inverses and negative remainders correctly.

Read how Hacking Cryptography explains modulo arithmetic →

Real-World Cryptography

Modular arithmetic is arithmetic in which values are identified according to their remainders after division by a fixed modulus.

How it is used
Uses wrapped arithmetic and modular multiplication as foundations for Diffie–Hellman key exchange.
How deep it goes
Defines remainders, demonstrates multiplication and inverses, and connects the operation to multiplicative groups.
Examples
Uses a clock analogy, division by 5, and the product 3 × 2 modulo 5.
What you can do after
Apply modular reduction to simple divisions and multiplications, and identify multiplicative inverses modulo 5.

Read how Real-World Cryptography explains modulo arithmetic →

Grokking Data Structures

Modular arithmetic is arithmetic in which values are considered equivalent when they have the same remainder under a specified modulus.

How it is used
Uses remainders to map virtual circular-queue positions back to valid array indexes.
How deep it goes
Defines remainders through an eight-element array example and stops short of broader mathematical treatment.
Examples
Uses 8 % 8 = 0, 9 % 8 = 1, and virtual index 8 wrapping to array index 0.
What you can do after
Apply it via the modulo operator to convert virtual circular-queue indexes into safe array positions.

Read how Grokking Data Structures explains modulo arithmetic →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.