Modulus arithmetic
- Basic postulates (Including modular linear equations, Continued fraction and Pell’s equation)
- Suggested Reading -
- Chapter 1 from Number Theory for Computing by SY Yan (Recommended)
- 31.1, 31.3 and 31.4 from Cormen
- www.topcoder.com/tc?module=Static&d1=tutorials&d2=primeNumbers
- Problems
- http://projecteuler.net/index.php?section=problems&id=64
- http://projecteuler.net/index.php?section=problems&id=65
- http://projecteuler.net/index.php?section=problems&id=66
- http://www.topcoder.com/stat?c=problem_statement&pm=6408&rd=9826
- http://www.topcoder.com/stat?c=problem_statement&pm=2342
Fermat’s theorem, Euler Totient theorem (totient function, order, primitive roots)
- Suggested Reading
- 1.6, 2.2 from Number Theory by SY Yan
- 31.6 , 31.7 from Cormen
- Problems
- http://projecteuler.net/index.php?section=problems&id=70
- http://www.spoj.pl/problems/NDIVPHI/
Chinese remainder theorem
- Suggested Reading
- 31.5 from Cormen
- 1.6 from Number Theory by SY Yan
- Problems
- Project Euler 271
- http://www.topcoder.com/stat?c=problem_statement&pm=10551&rd=13903
Primality tests
- Deterministic O(sqrt(n)) approach
- Probabilistic primality tests - Fermat primality test, Miller-Rabin Primality test
- Suggested Reading -
- http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=primalityTesting
- Cormen 31.8
- 2.2 from Number Theory by SY Yan
- Problems
- PON, PRIC, SOLSTRAS on SPOJ
- http://www.topcoder.com/stat?c=problem_statement&pm=4515
- Prime generation techniques - Sieve of Erastothenes (PRIME1 on SPOJ)
GCD using euclidean method
- Suggested Reading - 31.2 Cormen
- Problems
- GCD on SPOJ
- http://uva.onlinejudge.org/external/114/11424.html
Logarithmic Exponentiation
- Suggested Reading - http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=primalityTesting
Integer Factorization
- Naive O(sqrt(n)) method
- Pollard Rho factorization
- Suggested Reading
- 2.3 from Number Theory SY Yan
- 31.9 Cormen
- Problems -
- http://www.topcoder.com/stat?c=problem_statement&pm=2986&rd=5862
- http://www.spoj.pl/problems/DIVSUM2/
- http://www.topcoder.com/stat?c=problem_statement&pm=4481&rd=6538
Other
- Stirling numbers
- Wilson theorem
- nCr % p in O§ preprocess and O(log n) query
- Lucas Theorem
- Suggested Reading for Number Theory -
- Number theory for computing by Song Y Yan (Simple book describing concepts in details)
- Concepts are also superficially covered in Chapter 31 of Introduction to Algorithms by Cormen
- http://www.codechef.com/wiki/tutorial-number-theory
- http://www.algorithmist.com/index.php/Category:Number_Theory
- Problems on Number Theory -
- http://www.algorithmist.com/index.php/Category:Number_Theory
- http://problemclassifier.appspot.com/index.jsp?search=number&usr=