DDSA Solutions

Number Theory

14 problems · 8 with full explanations

0 Easy4 Medium3 Hard
Number theory problems involve primes, divisors, GCD, modular arithmetic, and number bases. Key algorithms: Sieve of Eratosthenes (O(n log log n) primes), Euclidean GCD (O(log n)), and modular exponentiation (O(log n)). Most competitive problems use modulo 10⁹+7.

How to practice

To practice Number Theory problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the number theory pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.

Open the full study guide →

All Number Theory problems