2 February 2022

The Division Algorithm

Theorem Suppose that a and b are integers and a > 0. Then there exist unique integers r and q so that

  1. b = a*q + r
  2. 0 ≤ r < a

This is the reason that the mod operator % is well-defined. You find q and r this way.

  1. q = b//a
  2. r = b%a

Modular Arithmetic

Primality

An integer n ≥2 is prime if only divisor are 1 and itself.

Sorting