## How is the time complexity of Sieve of Eratosthenes is n*log(log(n))?

Pre-requisite: Sieve of Eratosthenes What is Sieve of Eratosthenes algorithm? In order to analyze it, let’s take a number n and the task is to… Read More »

## Prime Numbers present at Kth level of a Binary Tree

Given a number K, the task is to print the prime numbers present at that level given all the prime numbers are represented in the… Read More »

## Remove all the prime numbers from the given array

Given an array arr[] of N integers, the task is to remove all the prime numbers. Examples: Input: arr[] = {4, 6, 5, 3, 8,… Read More »

## Count of primes below N which can be expressed as the sum of two primes

Given an integer N, the task is to find the count of all the primes below N which can be expressed as the sum of… Read More »

## Queries to count integers in a range [L, R] such that their digit sum is prime and divisible by K

Given Q queries and an integer K where each query consists of a range [L, R] and the task is to find the count of… Read More »

## Sum of all the prime numbers with the count of digits ≤ D

Given an integer D, the task is to find the sum of all the prime numbers whose count of digits is less than or equal… Read More »

## Minimum difference between any two primes from the given range

Given two integers L and R, the task is to find the minimum difference between any two prime numbers in the range [L, R]. Examples:… Read More »

## Sum of numbers in a range [L, R] whose count of divisors is prime

Given Q queries where each query consists of an integer range [L, R], the task is to find the sum of the integers from the… Read More »

## Find the sum of prime numbers in the Kth array

Given K arrays where the first array contains the first prime number, the second array contains the next 2 primes and the third array contains… Read More »

## GCD of elements which occur prime number of times

Given an array arr[] of N elements, the task is to find the GCD of the elements which have prime frequencies in the array. Note… Read More »

## Absolute difference between the XOR of Non-Prime numbers and Prime numbers of an Array

Given an array arr[] of N positive integers, the task is to calculate the absolute difference between XOR of non-prime numbers and prime numbers. Note… Read More »

## Bitwise AND of the sum of prime numbers and the sum of composite numbers in an array

Given an array of positive numbers, the task is to find the bitwise AND of the sum of non-prime numbers and the sum of prime… Read More »

## Print characters having prime frequencies in order of occurrence

Given a string str containing only lowercase characters. The task is to print the characters having prime frequency in the order of their occurrence. Note… Read More »

## Find the XOR of first N Prime Numbers

Given a positive integer N, the task is to find the XOR of the first N prime numbers. Examples: Input: N = 3 Output: 4… Read More »

## Program for Mobius Function | Set 2

Given an integer N. The task is to find Mobius function of all numbers from 1 to N. Examples: Input: N = 5 Output: 1… Read More »