Tag Archives: prime-number

Find two prime numbers with given sum

Given an even number (greater than 2 ), print two prime numbers whose sum will be equal to given number. There may be several combinations possible. Print only first such pair. An interesting point is, a solution always exist according to Goldbach’s conjecture. Examples: Input: n = 74 Output: 3 71 Input : n =… Read More »

Right-Truncatable Prime

A Right-truncatable prime is a prime which remains prime when the last (“right”) digit is successively removed. For example, 239 is right-truncatable prime since 239, 23 and 2 are all prime. There are 83 right-truncatable primes. The task is to check whether the given number (N > 0) is right-truncatable prime or not. Examples: Input:… Read More »

Super Prime

Super-prime numbers (also known as higher order primes) are the subsequence of prime numbers that occupy prime-numbered positions within the sequence of all prime numbers. First few Super-Primes are 3, 5, 11 and 17. The task is to print all the Super-Primes less than or equal to the given positive integer N. Examples: Input: 7… Read More »

Mersenne Prime

Mersenne Prime is a prime number that is one less than a power of two. In other words, any prime is Mersenne Prime if it is of the form 2k-1 where k is an integer greater than or equal to 2. First few Mersenne Primes are 3, 7, 31 and 127. The task is print… Read More »

Circular primes less than n

Find all circular primes less than given number n. A prime number is a Circular Prime Number if all of its possible rotations are itself prime numbers. Examples: 79 is a circular prime. as 79 and 97 are prime numbers. But 23 is not a circular prime. as 23 is prime but 32 is not… Read More »