The Wayback Machine - https://web.archive.org/web/20240627104139/https://www.geeksforgeeks.org/number-theory-competitive-programming/
Open In App

Number Theory for DSA & Competitive Programming

Last Updated : 11 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

What is Number Theory?

Number theory is a branch of pure mathematics that deals with the properties and relationships of numbers, particularly integers. It explores the fundamental nature of numbers and their mathematical structures. Number theory has been studied for centuries and has deep connections with various areas of mathematics, including algebra, analysis, and geometry.

Basics of Number Theory:

Modular Arithmetic:

Number Theory:

Game Theory:

Practice Problems on Number Theory:

Problems

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

Miscellaneous Practice Problems on Number Theory:

Problems

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

Quick Links



Similar Reads

Dynamic Programming in Game Theory for Competitive Programming
In the fast-paced world of competitive programming, mastering dynamic programming in game theory is the key to solving complex strategic challenges. This article explores how dynamic programming in game theory can enhance your problem-solving skills and strategic insights, giving you a competitive edge. Whether you're a seasoned coder or a newcomer
15+ min read
Tips and Tricks for Competitive Programmers | Set 2 (Language to be used for Competitive Programming)
This is a question asked quite often as in which language should be preferred to be efficient in competitive programming. It is something one should not worry about as what matters is the logic, not the language. Most of the languages are more or less same, but till now the most preferred language is C++, and here are the reasons. Python Simple and
5 min read
What is DSA | DSA Full Form
What is DSA?DSA(Data Structures and Algorithms) is defined as a combination of two separate yet interrelated topics – Data Structure and Algorithms. DSA is one of the most important skills that every computer science student must have. It is often seen that people with good knowledge of these technologies are better programmers than others and thus
2 min read
A Quick Guide on DSA and Competitive Coding in Java
Data Structures and Algorithms (DSA) are the building blocks of efficient and optimized software solutions, especially in the realm of competitive coding. In this quick guide, we'll explore key concepts of DSA using Java, a versatile and widely used programming language. Table of Content Arrays In Java:Strings In Java:Stack in Java:Queue in Java: L
11 min read
Competitive Programming vs General Programming
Programming enthusiasts face a crossroads - Competitive Programming or General Programming? This article sheds light on the distinctions between Competitive Programming vs General Programming, offering a quick guide for those navigating the coding landscape. Whether you're aiming for speed and precision in competitions or tackling real-world projec
3 min read
Top Programming Languages For Competitive Programming
Building an application, running a server, or even implementing a game needs a programming language as the foundation. There are almost more than 700 programming languages which are the most popular ones and this number will increase day by day. But, you don't need to learn all of them. Having a good command of anyone is enough for you to grow your
13 min read
Dynamic Programming meaning in DSA
Dynamic Programming is defined as an algorithmic technique that is used to solve problems by breaking them into smaller subproblems and avoiding repeated calculation of overlapping subproblems and using the property that the solution of the problem depends on the optimal solution of the subproblems Properties of Dynamic Programming:Optimal Substruc
2 min read
Programming or DSA: Which one should I learn first?
Programming and Data Structures and Algorithms (DSA), both are important to learn because they form the foundation of creating computer programs and solving problems effectively. But deciding where to start in computer science can be tricky, i.e. Should you learn Programming first or jump into Data Structures and Algorithms (DSA) directly? Table of
10 min read
How to read Competitive Programming Questions?
Competitive Programming is considered as a sport in the field of computer science. The culture of this sport is growing day by day and a lot of people are also considering this as a career choice. So, to help the participants with improving their efficiency in this sport, in this post, we have tried to cover all possible things, needed to keep in m
5 min read
Some useful C++ tricks for beginners in Competitive Programming
Here are some of the basic C++ tricks that every beginner in Competitive Programming should follow for increased speed. However, competitive programming can only be mastered with time and lots of practice. These tricks will just help you to save a little time during the contests which sometimes matters a lot. Using the auto keyword to declare data
3 min read
three90RightbarBannerImg