You know how we count in base 10? That’s just a convention. We could count in any base. Computers use base 2 (binary). Programmers use base 16 (hexadecimal). Mathematicians use whatever base makes the problem easier.
And then there’s modular arithmetic—basically clock math. It shows up everywhere in competitions and makes huge problems manageable.
Let’s talk about both.
Base Conversion: Same Number, Different Representation
The Idea
In base 10, each digit represents a power of 10. The number 123 means .
In base 2 (binary), each digit represents a power of 2. The number means .
Same number, different way of writing it.
Converting to Binary (The Easy Way)
Want to convert 45 to binary? Keep dividing by 2 and write down the remainders:
- remainder
- remainder
- remainder
- remainder
- remainder
- remainder
Now read the remainders from bottom to top: . That’s it.
Check: . ✓
Other Bases
Same trick works for any base. Converting 314 to base 5?
- remainder
- remainder
- remainder
- remainder
So .
Hexadecimal (Base 16)
This one’s fun because we need 16 digits. We use 0-9, then A-F for 10-15.
Converting 255 to hex:
- remainder (that’s F)
- remainder (that’s F again)
So . Neat, right?
Converting Back to Base 10
This is easier. Just multiply each digit by its place value and add.
.
? A is 10, so: .
The Shortcut for Powers of 2
Converting between binary and octal (base 8) or hex (base 16) is super easy because 8 and 16 are powers of 2.
For binary to octal: group digits in threes from right to left. becomes , which is , so .
For binary to hex: group digits in fours. becomes (pad with zeros), which is , so .
Modular Arithmetic: Clock Math
The Basic Idea
Modular arithmetic is about remainders. When you work “modulo ,” you only care about what’s left after dividing by .
because both 17 and 2 leave remainder 2 when divided by 5. Or equivalently, because is divisible by 5.
It’s like a clock. On a 12-hour clock, 13 o’clock is 1 o’clock. That’s .
Why It’s Useful
It makes huge problems small. Want the last digit of ? Work modulo 10.
Find the pattern:
It repeats every 4. Since , we have:
So the last digit is 7. No need to compute .
The Rules
Modular arithmetic plays nice with addition, subtraction, and multiplication:
- If and , then
- Same for subtraction and multiplication
Division is trickier. You can’t just divide both sides unless you’re careful.
Fermat’s Little Theorem
Here’s a powerful shortcut: if is prime and isn’t divisible by , then .
Want ? Since 7 is prime and 5 isn’t divisible by 7, we know .
Since :
Done. No giant calculations.
Finding Patterns
Many competition problems involve finding patterns in powers. The key is to compute a few small powers, see the pattern, then use it.
For :
Pattern repeats every 3. Since , the answer is .
Where You’ll See This
Base conversion shows up in:
- Computer science (binary, hex)
- Competition problems
- Cryptography
- Understanding how computers work
Modular arithmetic shows up in:
- Competition problems (constantly)
- Cryptography (RSA encryption)
- Calendar calculations
- Finding last digits, remainders, patterns
The Takeaway
Both topics seem abstract, but they’re incredibly practical. Base conversion helps you understand how numbers work at a fundamental level. Modular arithmetic makes impossible problems possible.
The key is recognizing when to use them. If a problem asks about remainders, last digits, or divisibility, think modular arithmetic. If it asks about number representations or computer-related math, think base conversion.
Practice both. They’ll save you time and make you look like a genius.