dsa3 min read
Number Theory: Perfect Numbers, Abundant, and Digit Problems
Explore digit manipulation, perfect/abundant numbers, Armstrong numbers, and common math interview patterns.
Read →
1575 articles
Explore digit manipulation, perfect/abundant numbers, Armstrong numbers, and common math interview patterns.
Compute combinations nCr efficiently with precomputed factorials, Pascal's triangle for small n, and Catalan numbers for tree/parenthesis counting.
Compute Euler's totient phi(n) for cryptography and modular inverse applications. Sieve variant for all values up to n.
Factor integers efficiently with trial division O(sqrt n), SPF sieve O(log n), and understand when each approach is optimal.
Master modular arithmetic for competitive programming: binary exponentiation O(log n), modular inverse, and Chinese Remainder Theorem.