Basic Modular Arithmetic

Notes

If n is a positive integer, then two integers a and b are congruent modulo n if their difference is an integer multiple of n, that is a-b = kn for an integer k. The integer n is the modulus of the congruence and the integers congruent to a mod n create a congruence/residue class.
The Sage command R = IntegerModRing(n) assigns R as a function mod n. Inputting arithmetic expressions into R as R(x), returns the residue class mod n. Example: for R = IntegerModRing(2) and x = 3*5, a = R(x) = R(3*5) = R(15) = 1.