Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.4k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Competitive Programming
2.3k+ articles
Algorithms
2k+ articles
number-digits
600+ articles
Prime Number
590+ articles
series
510+ articles
GCD-LCM
330+ articles
prime-factor
180+ articles
number-theory
410+ posts
Popular Articles
Recent Articles
Find first and last digits of a number
Last Updated: 13 December 2023
Given a number to find the first and last digit of a number.Examples:Input : 12345 Output : First digit: 1 last digit : 5Input : 985
...read more
Mathematical
number-digits
number-theory
DSA
Fermat's little theorem
Last Updated: 20 February 2025
Fermat's little theorem states that if p is a prime number, then for any integer a, the number a p - a is an integer multiple of p.Here p is
...read more
Mathematical
GCD-LCM
number-theory
DSA
Program to find sum of first n natural numbers
Last Updated: 07 March 2025
Given a number n, find the sum of the first n natural numbers.Examples :Input: n = 3Output: 6Explanation: Note that 1 + 2 + 3 = 6Input : 5O
...read more
Mathematical
series
number-theory
DSA
Basic Coding Problems
Similar Topics
DSA
22.4k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Competitive Programming
2.3k+ articles
Algorithms
2k+ articles
number-digits
600+ articles
Prime Number
590+ articles
series
510+ articles
GCD-LCM
330+ articles
prime-factor
180+ articles
Modulo 10^9+7 (1000000007)
Last Updated: 28 November 2022
In most programming competitions, we are required to answer the result in 10^9+7 modulo. The reason behind this is, if problem constraints a
...read more
Mathematical
Competitive Programming
Modular Arithmetic
number-theory
DSA
RSA Algorithm in Cryptography
Last Updated: 06 January 2025
RSA(Rivest-Shamir-Adleman) Algorithm is an asymmetric or public-key cryptography algorithm which means it works on two different keys: Publi
...read more
cryptography
Computer Networks
number-theory
How to prepare for ACM - ICPC?
Last Updated: 25 May 2023
ACM ICPC(Association for Computing Machinery - International Collegiate Programming Contest) is a worldwide annual multi-tiered programming
...read more
Competitive Programming
ACM-ICPC
Segment-Tree
Binary Indexed Tree
sieve
number-theory
DSA
Top 10 Algorithms and Data Structures for Competitive Programming
Last Updated: 10 September 2024
In this post, we will discuss Important top 10 algorithms and data structures for competitive coding.Topics :Graph algorithmsDynamic program
...read more
GBlog
Competitive Programming
BFS
Segment-Tree
Binary Indexed Tree
sieve
Modular Arithmetic
DFS
Topological Sorting
BIT
number-theory
GBlog-Competitive-Programming
DSA
Primality Test | Set 3 (Miller–Rabin)
Last Updated: 14 November 2022
Given a number n, check if it is prime or not. We have introduced and discussed School and Fermat methods for primality testing.Primality Te
...read more
Mathematical
Modular Arithmetic
Prime Number
number-theory
DSA
Introduction to Primality Test and School Method
Last Updated: 13 February 2025
Given a positive integer, check if the number is prime or not. A prime is a natural number greater than 1 that has no positive divisors othe
...read more
Mathematical
Prime Number
number-theory
DSA
Modular multiplicative inverse
Last Updated: 11 October 2024
Given two integers A and M, find the modular multiplicative inverse of A under modulo M.The modular multiplicative inverse is an integer X s
...read more
Mathematical
Modular Arithmetic
Prime Number
number-theory
DSA
Euler's Totient Function
Last Updated: 24 February 2025
Euler's Totient function Φ(n) for an input n is the count of numbers in {1, 2, 3, ..., n-1} that are relatively prime to n, i.e., the numbe
...read more
Mathematical
GCD-LCM
sieve
Modular Arithmetic
Prime Number
Numbers
number-theory
euler-totient
DSA
Find the Factorial of a large number
Last Updated: 26 March 2025
Factorial of a non-negative integer, is the multiplication of all integers smaller than or equal to n. Examples:Input: 100Output: 9332621544
...read more
Strings
Microsoft
Morgan Stanley
MAQ Software
BrowserStack
MakeMyTrip
Mathematical
Combinatorial
Philips
factorial
number-theory
DSA
Excel column name from a given column number
Last Updated: 27 April 2025
MS Excel columns have a pattern like A, B, C, …, Z, AA, AB, AC, …., AZ, BA, BB, … ZZ, AAA, AAB ..... etc. In other words, column 1 is
...read more
Strings
Microsoft
Amazon
Directi
Samsung
Paytm
Accolite
Zoho
number-theory
DSA
Lexicographic rank of a String
Last Updated: 21 April 2025
Given a string str, find its rank among all its permutations when sorted lexicographically.Note: The characters in string are all unique.Exa
...read more
Strings
FactSet
Combinatorial
number-theory
DSA
Sieve of Eratosthenes
Last Updated: 17 March 2025
Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number.Examples:Input: n = 10Output: 2 3 5
...read more
Qualcomm
VMWare
MAQ Software
Dynamic Programming
Mathematical
GE
sieve
Prime Number
number-theory
DSA
1
2
3
4
5
6
7
8
>>
Last
1
2
3
4
5
6
>>
Last
1
2
3
4
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !