Modular Arithmetic
Introduction
Throughout practicing many problems, you may have encountered problems of the following type:
Find the remainder when is divided by .
There exists an entire branch of mathematics centered around tackling such problems involving remainders, divisibility, etc. termed Modular Arithmetic.
Terminology
- (pronounced, " is congruent to modulo "): has the remainder, , when divided by .
- Residue Classes: Modular arithmetic groups all integers into a finite set of "residues" based on their remainders. In modulo 5, every integer is essentially reduced to one of five values:
The Last Digit
Suppose you are solving a problem involving very large numbers, and you are asked to compute the last digit of the result. For instance:
Find the last digit of when
Instead of dealing with the entire number , we should only deal with its remainder modulo , i.e, . Hence, the problem reduces to:
Find the last digit of when
which is a lot easier as the last digit of any positive integral power of is always .
Principles:
- If and , then for all positive integers :
Tips:
- When considering divisibility, move all terms to one side in a congruence equation. For instance, if: , then: . This tells us that is divisible (if , is divisible by ) by which is a useful fact.
- Given an -digit positive integer , we can 'expand' it to get: . Now we can treat each term separately and consider its modulo some remainder, and sum all of them at the end. This is how divisiblity tricks are obtained!
Divisibility Tricks
For an -digit positive integer :
- Divisible by 2 if , i.e. the last digit is even.
- Divisible by 5 if , i.e. the last digit is or .
- Divisible by 4 if the last two digits form a number divisible by , since .
- Divisible by 3 if , i.e. the sum of digits is divisible by .
- Divisible by 9 if , i.e. the sum of digits is divisible by .
- Divisible by 11 if , i.e. the alternating digit sum is divisible by .
Focus Problem:
Solution:
Let where and .
The reversal of is .
Condition 1:
Condition 2:
Since is divisible by , its last digit must satisfy , so (since , as is a three-digit number, and is impossible).
So , meaning .
Applying Condition 1:
Since , we have , so:
We need to count pairs with , such that .
Note that ranges over all integers from to . Among any consecutive integers, exactly one is congruent to . Since , the values contain:
- complete cycles of , giving solutions.
- A partial cycle (i.e., ), neither of which is .
Therefore there are three-digit integers satisfying both conditions.
Module Progress:
Join the AoPS Community!
Stuck on a problem, or don't understand a module? Join the AoPS community and get help from other math contest students.
