Number Theory for Competitive Programming
Topics:
- GCD and LCM
- Factorial
- Prime factors
- Binomial Coefficient
- Catalan numbers
- Euclid’s Lemma
- Basic and Extended Euclidean algorithms
- Integer sequences: Fibonacci, Padovan, OESIS
- Euler’s Totient Function
- Euler’s Totient function for all numbers smaller than or equal to n
- Modular Exponentiation (Power in Modular Arithmetic)
- Find remainder without using modulo operator
- Modular multiplicative inverse
- Multiplicative order
- Compute nCr % p | Set 1 (Introduction and Dynamic Programming Solution)
- Compute nCr % p | Set 2 (Lucas Theorem)
- Compute nCr % p | Set 3 (Using Fermat Little Theorem)
- Chinese Remainder Theorem – Set 1 (Introduction), Set 2 (Inverse Modulo based Implementation)
- Find Square Root under Modulo p | Set 1 (When p is in form of 4*i + 3)
- Find Square Root under Modulo p | Set 2 (Shanks Tonelli algorithm)
- Modular Division
- Cyclic Redundancy Check and Modulo-2 Division
- Primitive root of a prime number n modulo n
- Euler’s criterion (Check if square root under modulo p exists)
- Using Chinese Remainder Theorem to Combine Modular equations
- Multiply large integers under large modulo
- Compute n! under modulo p
- Wilson’s Theorem
- Primality Test | Set 1 (Introduction and School Method)
- Primality Test | Set 2 (Fermat Method)
- Primality Test | Set 3 (Miller–Rabin)
- Primality Test | Set 4 (Solovay-Strassen)
- Legendre’s formula (Given p and n, find the largest x such that p^x divides n!)
- Carmichael Numbers
- number-theoryGenerators of finite cyclic group under addition
- Sum of divisors of factorial of a number
- GFact 22 | (2^x + 1 and Prime)
- Sieve of Eratosthenes
- Goldbach’s Conjecture
- Pollard’s Rho Algorithm for Prime Factorization
- Searching for Patterns | Set 3 (Rabin-Karp Algorithm)
- Measure one litre using two vessels and infinite water supply
- Program to find last digit of n’th Fibonnaci Number
- GCD of two numbers when one of them can be very large
- Find Last Digit Of a^b for Large Numbers
- Remainder with 7 for large numbers
- Find (a^b)%m where ‘a’ is very large
- Find sum of modulo K of first N natural number
- Count all sub-arrays having sum divisible by k
- Partition a number into two divisble parts
- Find power of power under mod of a prime
- Rearrange an array in maximum minimum form | Set 2 (O(1) extra space)
- Subset with no pair sum divisible by K
- Number of substrings divisible by 6 in a string of integers
- How to compute mod of a big number?
- BigInteger Class in Java
- Modulo 10^9+7 (1000000007)
- How to avoid overflow in modular multiplication?
- RSA Algorithm in Cryptography
- ‘Practice Problems’ on Modular Arithmetic
- ‘Practice Problems’ on Number Theory
- Ask a Question on Number theory
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above