Back to Academy
math misc
Modular Arithmetic
Modular arithmetic performs operations within a fixed range defined by a modulus. Modular exponentiation efficiently computes large powers modulo a number using repeated squaring. Key properties include distributivity over addition and multiplication.
Use Cases
- •Cryptographic systems like RSA and Diffie-Hellman
- •Hashing functions and hash table implementations
- •Competitive programming problems involving large number computations
Complexity Analysis
| Metric | Best | Average | Worst |
|---|---|---|---|
| Time | O(log n) | O(log n) | O(log n) |
| Space | O(1) | ||
Visualization
Implementation
Output
Click "Run Code" to see output...