Division

Let a and b be two integers with a $\neq$ 0, we say that a divides b if there is an integer k such that b=ka, and we write a | b

Notations

Basic Rules

Division Algorithm (mod)

Let a be an integer and d be a positive integer. Then there are unique integers q and r with 0 ≤ r < d, such that a = dq + r

a : dividend d : divisor

q : quotient r : remainder

Notation:

Modular Arithmetic

Let a and b be integers and M a positive integer. We say that a is congruent to b modulo M if M divides a-b. We write,

a $\equiv$ b (mod M) if and only if M | (a - b)

[Theorem 3]

If a $\equiv$ b (mod M) and c $\equiv$ d (mod M)

[Corollary]

Let M be a positive integer and let a and b be integers. Then,

(a+b) mod M = ((a mod M) + (b mod M)) mod M

(ab) mod M = ((a mod M) x (b mod M)) mod M

[Computing $b^n$ mod $m$]