Topic 3 - Modular Arithmetic
Topic 3 - Modular Arithmetic
MODULAR ARITHMETIC
FUNCTIONS
MODULAR
ARITHMETIC
QUESTION:
If it is now September,
what month will it be 25
months from now?
QUESTION:
if it is now Wednesday,
you know that in 23 days it
will be?
What is modular arithmetic?
Modular arithmetic is an
abstraction of a method of
counting that you often use.
Surprisingly, this simple idea
has numerous important
applications in mathematics
and computer science.
What is modular arithmetic?
When a=qn+r, where 3 mod 2 = 1 since 3= 1∙2+1
q is the quotient and r 6 mod 2=0 since 6=3∙2+0,
is the remainder upon 11 mod 3=2 since 11=3∙3+2,
dividing a by n, we 62 mod 85=62 since 62=0∙85+62,
write a mod n = r. -2 mod 15 = 13 since -2 =(-1)15+13
What is modular arithmetic?
In general, if a and b Example:
are integers and n is a (27∙36) mod 11
positive integer, then a
mod n = b mod n if and
only if n divides a-b.