*remainder*of division of one number by another, e.g. 5 mod 2 = 1. For mathematician modulo is a

*congruence*relation between two numbers:

*a*and

*b*are said to be congruent modulo

*n*, written

*a*≡ b (mod n), if their difference

*a*−

*b*is an integer multiple of

*n*.

These two definitions are not equivalent. The former is a special case of the latter: if

*b*mod

*n*=

*a*then

*a*≡

*b*(mod

*n*). The inverse is not true in general case. 5 mod 2 = 1, and 1 ≡ 5 (mod 2) because 1 - 5 = -4 is integer multiple of 2. Now 5 ≡ 1 (mod 2) because 5 - 1=4 is evenly divisible by 2, but 1 mod 2 = 1, not 5.

The biggest confusion happens when programmer and mathematician start arguing about Gauss' famous golden theorem where both definitions of modulus can be used.

## No comments:

Post a Comment