# Tag Archives: sieve

## Construct a string that has exactly K subsequences from given string

Given a string str and an integer K, the task is to find a string S such that it has exactly K subsequences of given… Read More »

## Count of elements having Euler’s Totient value one less than itself

Given an array arr[] of N integers, and a range L to R, the task is to find the total number of elements in the… Read More »

## First element of every K sets having consecutive elements with exactly K prime factors less than N

Given two integers N and K, the task is to find the first element for every set of K consecutive elements which have exactly K… Read More »

## Non-repeating Primes

Given an array arr[] containing repetitive prime and nonprime numbers, the task is to find the prime numbers occurring only once. Examples: Input: arr[] =… Read More »

## Sum of main diagonal elements in a Matrix which are prime

Given a matrix mat[][] of R rows and C columns. The task is to find the sum of all elements from the main diagonal which… Read More »

## Minimum changes required to make all Array elements Prime

Given an array of integers arr[], the task is to count the minimum number of changes required to convert each array element to its nearest… Read More »

## Count all prime numbers in a given range whose sum of digits is also prime

Given two integers L and R, the task is to find the count of total numbers of prime numbers in the range [L, R] whose… Read More »

## Minimise N such that sum of count of all factors upto N is greater than or equal to X

Given a number X, the task is to find the minimum number N such that the sum of the count of all factors from 1… Read More »

## Check if the Matrix follows the given constraints or not

Given a matrix A[][] of size N*M, the task is to check if the given matrix satisfies the following two conditions or not: Sum of… Read More »

## Find all possible ways to Split the given string into Primes

Given a string str that represents a number. The task is to find all possible ways to split the given string such that each segment… Read More »

## Woodall Primes

Woodall Primes are prime numbers that are also Woodall number. Find the Woodall prime numbers less than N Given a number N, print all Woodall… Read More »

## Brilliant Numbers

Brilliant Number is a number N which is product of two primes with same number of digits. Few Brilliant numbers are: 4, 6, 9, 10,… Read More »

## Count of distinct power of prime factor of N

Given a positive integer N, the task is to find the total number of distinct power of prime factor of the given number N. Examples:… Read More »

## Nearest prime number in the array of every array element

Given an integer array arr[] consisting of N integers, the task is to find the nearest Prime Number in the array for every element in… Read More »

## Minimum addition/removal of characters to be done to make frequency of each character prime

Given a string S of length N, the task is to find the minimum operations required to make the frequency of every distinct character prime.… Read More »