# Tag Archives: Prime Number

Given a number N (1 ≤ N ≤ 9×1018), the task is to find P and Q satisfying the equation N = P 2. Q… Read More
Given a number N, the task is to print the first N prime numbers. Examples:  Input: N = 4Output: 2, 3, 5, 7 Input: N… Read More
Given a number N, the task is to check if the number is a prime number or not. Check if given number N is Prime… Read More
Given a positive integer N and an integer K, The task is to find all prime numbers in the range of 1 to N that… Read More
Given a string S of size N. The task is to find the number of Invalid characters. Index i (0 ≤ i < N) is… Read More
Given two integers N and M which denotes a matrix of size N*M that has the value of each cell as the sum of its… Read More
Given two integers L and R, the task is to find the value of (number of composites – number of primes) that lie in the… Read More
Given an integer N, the task is to find a minimum possible Y that satisfies the following condition: Y > N. Y is not divisible… Read More
Given a string S, the task is to print all words with prime length in the given string. Examples: Input: S = “This is a… Read More
Given a set S of having numbers 1, 2, 3, . . ., N, and an integer K, the task is to form a set… Read More
Why do we check up to the square root of a number to determine if that number is prime? Prime numbers are natural numbers greater… Read More
Given two integers L and R, where  L < R, the task is to find Co-prime numbers X and Y such that L <= X… Read More
Given an array A[] of size N. An array has to be created using the given array considering the following conditions. If the index is… Read More
Given an array arr[] of size N, the task is to find the maximum subarray sum that can be obtained such that the length of… Read More
Given a number N, the task is to check whether N has 7 divisors or not. Examples: Input: 64Output: 1 Explanation: 1, 2, 4, 8, 16,… Read More