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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Check if a number is sandwiched between primes
- Check if an integer can be expressed as a sum of two semi-primes
- Check if the sum of primes is divisible by any prime from the array
- Count numbers which can be represented as sum of same parity primes
- K-Primes (Numbers with k prime factors) in a range
- Check if all nodes of the Binary Tree can be represented as sum of two primes
- Find the prime numbers which can written as sum of most consecutive primes
- Length of largest sub-array having primes strictly greater than non-primes
- Count primes that can be expressed as sum of two consecutive primes and 1
- Count of primes below N which can be expressed as the sum of two primes
- 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
- Count non-adjacent subsets from numbers arranged in Circular fashion
- Check if a given pair of Numbers are Betrothed numbers or not
- Count of numbers upto N digits formed using digits 0 to K-1 without any adjacent 0s
- Check if two numbers are co-prime or not
- Check whether XOR of all numbers in a given range is even or odd
- Check whether product of 'n' numbers is even or odd
- Check if sum of divisors of two numbers are same
- Check whether two numbers are in golden ratio
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.