Tutorials
Courses
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
DSA
22.8K+ articles
Misc
8.8K+ articles
Mathematical
7.8K+ articles
Arrays
6.5K+ articles
Competitive Programming
3.3K+ articles
Algorithms
2.0K+ articles
Prime Number
615+ articles
number-theory
424+ articles
prime-factor
191+ articles
sieve
322+ posts
Recent Articles
Popular Articles
Find two numbers B and C such that their product is A and their GCD is maximum
Last Updated: 19 January 2022
Given a positive integer, A. The task is to find two numbers B and C such that their product is A and their GCD should be maximum.Examples:Input: A = 72Output: 12 6Explana...
read more
Greedy
Mathematical
DSA
GCD-LCM
sieve
Prime Number
Sort given Array in descending order according to highest power of prime factors
Last Updated: 24 March 2023
Given an array arr[] of size N. The task is to sort the elements in arr[] based to their Highest Degree of Expression, in descending order. The Highest Degree of a number ...
read more
Sorting
Mathematical
Algo Geek
Algo-Geek 2021
DSA
Arrays
sieve
prime-factor
Smallest integer having at least K prime divisors with difference between each factor at least D
Last Updated: 22 February 2023
Given two integers D and K. The task is to find the smallest number N which has at least K prime divisors and the difference between each pair of divisors is at least D.Ex...
read more
Misc
Mathematical
DSA
sieve
prime-factor
Generate Array such that max is minimized and arr[i] != arr[j] when j is a multiple of i
Last Updated: 01 February 2023
Given an integer N, the task is to generate an array arr[] having N positive integers such that arr[i] ≠ arr[j] if j is divisible by i (1-based indexing is considered) suc...
read more
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
sieve
divisors
Count of factors of combination of N and K (nCk)
Last Updated: 07 April 2022
Given integers N and K, the task is to find the number of factors of NCK. Since the answer can be very large return the count of factors modulo 998244353.Example:Input: N ...
read more
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
sieve
prime-factor
Minimize operations to reduce N to 0 by replacing N by its divisor at each step
Last Updated: 04 May 2022
Given a positive integer N. Find the minimum number of operations needed to reduce N to 0 when N can reduced by its divisor at each operation.Example:Input: N = 5Output: 4...
read more
Greedy
Mathematical
Competitive Programming
TrueGeek
Geeks Premier League
Geeks-Premier-League-2022
DSA
sieve
divisors
Find set of size K such that any value of the set is co-prime with any Array element
Last Updated: 20 December 2022
Given a set S of having numbers 1, 2, 3, . . ., N, and an integer K, the task is to form a set A by taking K values from S such that any pair formed by taking one value fr...
read more
Mathematical
Competitive Programming
DSA
Arrays
sieve
Prime Number
Count unvisited leaves after Frog Jumps
Last Updated: 04 January 2024
Given an array arr[] of size N, an integer K representing the number of leaves in the pond, and the arr[i] indicating the strength of the ith frog's jump, where 0 = i N. ...
read more
Mathematical
DSA
sieve
Number of ways to make N using product of M integers
Last Updated: 31 July 2023
Given two integers N (1 = N = 1e9) and M (M = 1e5), the task is to find the number of ways to represent the number N in terms of the product of M integers. Find the answer...
read more
Mathematical
DSA
combinatorics
sieve
prime-factor
Prime Number
Permutation and Combination
binomial coefficient
C++ Program to Count Primes in Ranges
Last Updated: 17 August 2023
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 = L = R 10000. Consider that there are a large number of que...
read more
Mathematical
C++ Programs
C++
DSA
array-range-queries
prefix-sum
sieve
Prime Number
Java Program to Count Primes in Ranges
Last Updated: 13 January 2022
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 Examples: Input : Query 1 : L = 1, R = 10 Query 2 : L...
read more
Java
Mathematical
Java Programs
DSA
array-range-queries
prefix-sum
sieve
Prime Number
Python3 Program to Count Primes in Ranges
Last Updated: 05 September 2024
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 = L = R 10000. Consider that there are a large number of que...
read more
Mathematical
Python
Python Programs
DSA
array-range-queries
prefix-sum
sieve
Prime Number
PHP Program to Count Primes in Ranges
Last Updated: 22 July 2024
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 = L = R 10000. Consider that there are a large number of que...
read more
Mathematical
Web Technologies
PHP
PHP Programs
DSA
array-range-queries
prefix-sum
sieve
Prime Number
Javascript Program for Count Primes in Ranges
Last Updated: 17 September 2024
Given a range [L, R], we need to find the count of total numbers of prime numbers in the range [L, R] where 0 = L = R 10000. Consider that there are a large number of que...
read more
Mathematical
JavaScript
Web Technologies
DSA
array-range-queries
prefix-sum
sieve
Prime Number
Subtree with exactly K primes
Last Updated: 09 March 2024
Given a tree with N nodes and (N - 1) edges, where the nodes are assigned values from 1 to N, and the root node is 1. The task is to determine if there exists a subtree wi...
read more
Graph
DSA
sieve
DFS
1
2
3
4
...
22
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 !