Skip to content

Tag Archives: Prime Number

Given an integer N. The task is to find the next prime number i.e. the smallest prime number greater than N. Examples:  Input: N =… Read More
Given two integers L and R (L < = R). The task is to find all square free semiprimes in the range L to R… Read More
Given an integer N. The task is to find the Nth prime number. Examples:   Input : 5 Output : 11 Input : 16 Output : 53 Input… Read More
Given a number N, the task is to check if its first and last digit is a prime number and their sum is less than… Read More
The task is to find the triangle of numbers arising from Gilbreath’s conjecture. Gilbreath’s conjecture: It is observed that given a sequence of prime numbers, a sequence… Read More
Given an array a[] of size N. The value of a subset is the product of primes in that subset. A non-prime is considered to… Read More
Given an integer N. The task is to find the sum of the first N prime numbers which don’t contain any odd primes as their… Read More
The Nth Ramanujan prime is the least integer Rn for which    where π(x) is a prime-counting functionNote that the integer Rn is necessarily a… Read More
Given an array arr of size N. The task is to find the prime numbers in the first half (up to index N/2) and the… Read More
Given a string str of lowercase English alphabets, the task is to check whether the string is a vowel prime or not. A string is… Read More
Given four integers X, Y, X2%P, Y2%P, where P is a prime number. The task is to find prime P. Note: Answer always exists.Examples:   Input :… Read More
Given four integers X, Y, P and Q such that X ≤ Y and gcd(P, Q) = 1. The task is to find minimum operation… Read More
Given a sorted array of N integers. The task is to find the longest subsequence such that every element in the subsequence is reachable by… Read More
Given an integer N, the task is to find the sum of semi-prime numbers which are less than or equal to N. A Semi prime… Read More
Given an integer N, the task is to partition the first N natural numbers in two non-empty sets such that the sum of these sets… Read More

Start Your Coding Journey Now!