Modular Arithmetic (Remainder Arithmetic)

Suppose x is a nonnegative integer and m is a positive integer (called the modulus).

Then x mod m denotes the remainder of x when divided by m.

In Scheme: (remainder x m)

If r = x mod m, then

  1. r is in the set {0, 1, ..., m-1}, and

  2. there is an integer q such that:

    x = qm + r