# Tag Archives: Prime Number

Given an array arr[], the task is to check if it is possible to sort the given array using any number of operations where at… Read More
Given a 2d array mat[][], the task is to find and print the prime numbers along with their position (1-based indexing) in this 2d array.… Read More
Find the number of permutations of first N positive integers such that the sum of any two consecutive numbers is prime where all the cyclic… Read More
Given a number N, the task is to check if N can be represented as the product of a prime and a composite number or… Read More
Given a positive integer N. In one operation subtract N with its highest divisor other than N and 1. The task is to find minimum… Read More
Given a positive integer N, the task is to find the number of unordered pairs of semi-prime numbers in the range [1, N] such that… Read More
Given an array arr[] of size N. The task is to find the minimum number of swaps required to re-arrange the array such that all… Read More
Given two Geometric Progressions (a1, r1) and (a2, r2) where (x, y) represents GP with initial term x  and common ratio y and an integer… Read More
Given an integer array arr[] of N integers, the task is to make each adjacent pair in the array co prime, by adding minimum number of… Read More
Given a string S of size N consisting of digits [1, 9], the task is to find the length of the smallest subsequence in the… Read More
Given an array arr[] consisting of N distinct positive integers and a range [L, R], the task is to find the element in the given… Read More
Given an array arr[], the task is to find the longest subarray whose sum is a prime number. Examples:Attention reader! Don’t stop learning now. Get… Read More
Given a number N, the task is to calculate the count of numbers of length N having prime numbers at odd indices and odd numbers… Read More
Given an integer N, find a prime number S such that all digits of N occur in a contiguous sequence. There may be multiple answers.… Read More
Given an array arr[] consisting of N positive integers, the task is to find the number of pairs such that the Greatest Common Divisor(GCD) of… Read More