Given a positive integer n, the task is to check if it is a Chen prime number. If the given number is a Chen Prime number then print ‘YES’ otherwise print ‘NO’.
The first few Chen prime numbers are:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 53, 59, 67, 71, 83, 89, 101
Input : 11 Output: YES Explanation: 11 is prime number and 11+2 (i.e 13 is also prime number) Input : 7 Output: YES Explantion: 7 is prime number and 7+2 ( i.e 9 ) is a semi prime number
- Check if the given number – ‘n’ is a prime or not.
- If n is a prime number:
- Check if n+2 is either prime or semi-prime
- Print ‘YES’ if n+2 is either prime number or a semi-prime number
- Otherwise print ‘NO’
Below is the implementation of the above idea
- Print the nearest prime number formed by adding prime numbers to N
- Count occurrences of a prime number in the prime factorization of every element from the given range
- Check if a prime number can be expressed as sum of two Prime Numbers
- Find coordinates of a prime number in a Prime Spiral
- Number which has the maximum number of distinct prime factors in the range M to N
- Represent a number as a sum of maximum possible number of Prime Numbers
- Check if a number is divisible by all prime divisors of another number
- Largest number less than N whose each digit is prime number
- Number with maximum number of prime factors
- Find third number such that sum of all three number becomes prime
- Prime number in PL/SQL
- N-th prime factor of a given number
- Sum of all the prime divisors of a number
- Sum of every K’th prime number in an array
- Twisted Prime Number
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.