For example, A mod B, if a is less than or equal to b, the result is a.
Modular operations are widely used in number theory and programming, from the discrimination of odd and even numbers to the discrimination of prime numbers, from modular exponentiation to the solution of the greatest common divisor, from grandson problem to Caesar's cipher problem, all of them are full of modular operations. Although many number theory textbooks introduce modular operation to some extent, most of them are based on pure theory, and the application of modular operation in programming is not much involved.
Proof of distribution law of modular operation;