Given three numbers and check whether they are adjacent primes are not. Three prime numbers are said to be adjacent primes if there is no prime between them.
Input : 2, 3, 5 Output : Yes Explanation: 2, 3, 5 are adjacent primes. Input : 11, 13, 19 Output : No Explanation: 11, 13, 19 are not adjacent primes. Because there exits 17 between 13 and 19 which is prime.
We already know what is a prime number. Here we need to check weather given three numbers are adjacent primes or not. First we check given three numbers are prime or not. After that we will find next prime of first number and second number. If satisfies the condition of adjacent primes then it is clear that given three numbers are adjacent primes otherwise not.
- Check if a number is sandwiched between primes
- Check if the sum of primes is divisible by any prime from the array
- Check if an integer can be expressed as a sum of two semi-primes
- K-Primes (Numbers with k prime factors) in a range
- Count numbers which can be represented as sum of same parity primes
- Length of largest sub-array having primes strictly greater than non-primes
- Find the prime numbers which can written as sum of most consecutive primes
- Count primes that can be expressed as sum of two consecutive primes and 1
- Check whether the sum of absolute difference of adjacent digits is Prime or not
- Count numbers < = N whose difference with the count of primes upto them is > = K
- Check whether product of 'n' numbers is even or odd
- Check if sum of divisors of two numbers are same
- Check whether XOR of all numbers in a given range is even or odd
- Check if two numbers are co-prime or not
- Check whether the given numbers are Cousin prime or not
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Mithun Kumar